diff --git a/CHANGELOG.md b/CHANGELOG.md index f79657a9..b0f02c18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ it releases that version ([RELEASING.md](https://github.com/energy-models/mathsp ## Upcoming version +- feat(language): a parameter value that is null or NaN is refused when the data is attached ([#788](https://github.com/energy-models/mathspec/pull/788)) - fix(language): a where string names several columns in at's over= and into=, as an expression does ([#782](https://github.com/energy-models/mathspec/pull/782)) - fix(language): a file whose terms read each other's sums is refused at load ([#780](https://github.com/energy-models/mathspec/pull/780)) - fix(language): dual(c) is the rate at which the optimal objective rises with the right side of c, so an equality has a sign too ([#751](https://github.com/energy-models/mathspec/pull/751)) diff --git a/docs/reference/language/absence.md b/docs/reference/language/absence.md index ecb57e7d..45fa3f36 100644 --- a/docs/reference/language/absence.md +++ b/docs/reference/language/absence.md @@ -36,6 +36,8 @@ The [grammar](expressions.md#where-strings) says what a `where:` may hold. Nothing else creates absence. **A missing parameter row is not absence.** It reads as the value that contributes nothing: `0` as a coefficient, and `false` in a `where`. +A missing row is the only gap a parameter has: a null or NaN value is +[refused](declarations.md#parameters) when the data is attached. Where no such value exists, loading is refused. There are four such positions: a divisor, a `bounds:` entry, the whole constant side of a comparison, and a diff --git a/docs/reference/language/declarations.md b/docs/reference/language/declarations.md index 07ef0595..d32c8b4d 100644 --- a/docs/reference/language/declarations.md +++ b/docs/reference/language/declarations.md @@ -38,6 +38,9 @@ The column has to match the `dtype`: | `bool` | a boolean column | `1` and `0` are not booleans. Cast the column | | `str` | a string column | | +**A null or NaN value is refused** when the data is attached. A coordinate +with no value has no row. `inf` and `-inf` are values. + Only `float` and `int` are values. A `str` parameter is a label and a `bool` parameter is a mask: each selects rows in a [`where`](expressions.md#where-strings), and writing either as a coefficient, diff --git a/src/mathspec/program.py b/src/mathspec/program.py index ad882ec9..f32a9955 100644 --- a/src/mathspec/program.py +++ b/src/mathspec/program.py @@ -591,7 +591,9 @@ class ParameterDeclaration: ``dtype`` is what the declaration claims the values are, and a consumer attaching data refuses a column that is not it — so the *declaration* is - what is read, rather than whatever the column happens to hold. + what is read, rather than whatever the column happens to hold. It + refuses a null or NaN value too: a coordinate with no value has no row, + and ``inf`` is a value. """ dims: tuple[str, ...]