# LS1008: Domain Uses Binary Floating Point

## Intent

LS1008 is a compiler check that reports a double or float type in Domain, the project that holds business rules, because binary rounding makes totals and equality checks on money and exact quantities quietly wrong. This page states what the rule reports, where the warning sits, and how to hold the value in decimal or a value object.

## Reference

### What the rule enforces

LS1008 enforces [Keep binary floating point out of exact quantities](https://litespec.dev/2.0.0/backend/domain.md#keep-binary-floating-point-out-of-exact-quantities) (`litespec/backend/domain#keep-binary-floating-point-out-of-exact-quantities`). It runs in Domain only. Its category is `LiteSpec.Domain`. It reports a warning and is enabled by default, as the [Analyzers overview](https://litespec.dev/2.0.0/analyzers/README.md) describes.

### What the rule reports

The rule reports each `double` or `float` type in a field, property, indexer, method return, local function return, delegate, operator, parameter, `foreach` variable, declaration expression, or declaration pattern, including nested uses such as `List<double>`, `double?`, tuples, and lambda parameters. The diagnostic sits on the floating point type. Its message names the member and the type text.

### Failing example

```csharp
public sealed class Pricer
{
    public double Total(double rate) => rate;
}
```

### Passing example

```csharp
public sealed class Pricer
{
    private decimal _total;

    public decimal Total(decimal rate) => rate;
}
```

### How to fix

Use `decimal` or a value object for monetary amounts, rates applied to them, and quantities compared for exact equality.

## Notes

### What the rule ignores

The rule does not report `decimal` or `var`. It does not report any floating point use outside Domain.
