Skip to content

mdl: Vensim :NA: is read as NaN instead of the finite -2^109 #586

Closed

Description

@bpowers

Vensim's :NA: is not IEEE NaN; it is the finite number -2^109 (-6.490371073168535e32), which is what makes the common IF THEN ELSE(x = :NA:, ...) existence test work (Vensim documentation, na.html and dataequations.html).
Simlin read :NA: in an equation as NaN and :NA: in a data list as -1e38.
Under NaN the existence test never fires and any arithmetic touching the value turns the whole series NaN; this made hundreds of C-LEARN series entirely NaN.

Status

Fixed on main by #592.
Both paths now produce float::NA (-2^109), pinned bit for bit by a test, and C-LEARN runs without NaN series.
Genuine NaN is still produced where Vensim produces it: out-of-range vector reads and empty reducers.

The comparison against Vensim's VDF output treats Simlin's sentinel as matching Vensim's saved value; two C-LEARN variables still show a sentinel mismatch, tracked in #591.

Pointers

  • src/simlin-engine/src/float.rs: NA and its module docs
  • src/simlin-engine/src/mdl/xmile_compat.rs, src/simlin-engine/src/mdl/parser.rs

Activity

  1. added
    bug
    engine
    on May 19, 2026
  2. changed the title [-]engine: Vensim :NA: was mishandled as IEEE NaN (should be the finite sentinel -2^109)[/-] [+]mdl: Vensim :NA: is read as NaN instead of the finite -2^109[/+] on Oct 12, 2026
  3. added
    compat
    on Oct 12, 2026
  4. bpowers commented on Oct 12, 2026

    @bpowers
    OwnerAuthor

    Closing: already fixed on main.

    float::NA = -2^109 (src/simlin-engine/src/float.rs:110, pinned bit for bit by na_is_negative_two_pow_109 at :274) is what both import paths emit: the expression literal in mdl/xmile_compat.rs:230 and the data-list literal in mdl/parser.rs:55/70, each with its own test (xmile_compat.rs:2373-2383, parser.rs:1952-1990).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcompatengine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions