Skip to content

A statement where a number is expected: FastExpression answers, LINQ throws outside the library #2227

Closed

Description

@Rafael-SOWNet

A statement in a numeric position, such as the argument of sin or a summand, has no value in evaluation. Evaluation leaves sin(True) and True + 2 as written. The compilers disagree with it, each in its own way.

Measured at x = 2:

evaluated FastExpression, master 5c6a13f LINQ over double, master LINQ over double, 2.6.0
sin(x > 1) sin(True) 0.8414709848078965 throws KeyNotFoundException throws KeyNotFoundException
(x > 1)^2 True ^ 2 1 throws KeyNotFoundException throws KeyNotFoundException
max(x > 1, 0) max(True, 0) 1 throws AngouriBugException throws AngouriBugException
(x > 1) + 2 True + 2 3 refused, UncompilableNodeException refused
iverson(x > 1) + 2 3 3 3 refused
  • FastExpression answers. It carries a statement as its truth value on the stack, so the arithmetic takes 1 for True. That is new since 2.6.0, where FastExpression had no statements; it came with FastExpression compiles statements, provided and piecewise #2209.
  • The LINQ compiler throws exceptions from outside the library's documented ones. KeyNotFoundException comes from widening a bool to double. AngouriBugException asks the user to report a bug in the library.

iverson is the way to take a statement as a number, and it compiles in both. A statement anywhere else that a number is expected should be refused with UncompilableNodeException, by both compilers.

Part of #2195.

🤖 Generated with Claude Code

Activity

  1. added this to the 2.7.0 milestone on Oct 30, 2026
  2. moved this from Todo to In Progress in AngouriMathon Oct 30, 2026
  3. added a commit that references this issue on Oct 30, 2026
    1c9dbce
  4. moved this from In Progress to Done in AngouriMathon Oct 30, 2026
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

    No labels
    No labels

    Type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions