You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5f1e85a
Browse filesBrowse the repository at this point in the historyBrowse files
The LINQ compiler gives a constant, a nullable operand and sgn(0) the value evaluation gives (#2242)
Three defects in the LINQ compiler, found by work/compilesweep.
A constant over Complex (#2235). A constant is compiled as the narrowest
type that holds it, -1 as a long, and a function widens a long only to
double. So in an expression compiled over Complex, sqrt(-1), ln(-1) and
arcsin(2) were Math's NaN, widened to (NaN, 0), and 1/0 was +oo, where
evaluation has no value. FastExpression, whose constants are Complex,
was right. Where any argument or the result is Complex, BuildTree now
converts each constant to Complex. Over double, a value that is not real
still has none.
A nullable operand (#2237). An Iverson bracket compiles to an int?, and a
provided integer constant to a long?. No function has a definition for
either, and the widening table has neither. So tan(iverson(pi > 0))
threw KeyNotFoundException, and abs, floor and sgn of one threw
AngouriBugException, which asks for a bug report. The unary and binary
converters now take a nullable number as a double, NaN for none, before
anything else. A statement's bool? stays as it is.
sgn(0) over Complex (#2238). The definition was z / |z|, which is 0/0 at
0. It is the Signum extension FastExpression already used, which is 0
there.
LinqCompilationValueTest compares LINQ over Complex and FastExpression
with evaluation on 16 expressions, among them six constants whose values
are not real, 1/0, five nullable operands and sgn at 0. It also checks
the double compiler on both kinds. 17 of its 21 cases fail on master.
sgn(-1 provided false) is left out: evaluation gives 1 there, which is
wrong, and is #2241.
Fixes#2235. Fixes#2237. Fixes#2238.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
0 commit comments