AngouriMath
Navigation
RefuseNonRealCompilation
Property
Summary
Whether compiling into a function that returns Double or Single refuses an
expression that is not real wherever it is defined. Off by default.
expression that is not real wherever it is defined. Off by default.
Remarks
Compiled over the reals, every value the function computes on the way is a real number. So an expression
whose value at a real argument is not real, or is real only by way of a value that is not --sqrt(x) at -4, sin(arcsin(x)) at 2 -- evaluates to NaN there, as it does where it has no value at all, as
1/x at 0. With this off, that is how such an expression compiles, and a NaN from the compiled
function means that the expression has no value there or that its computation left the reals. With it on,
an expression that cannot be shown to be real wherever it is defined is refused with
UncompilableNodeException, and a NaN means only that there is no value. The
showing is structural and so conservative:sqrt(x) and ln(x) are refused, though both are
real for positive x. Compile over Complex for the value itself.
#2286
whose value at a real argument is not real, or is real only by way of a value that is not --
function means that the expression has no value there or that its computation left the reals. With it on,
an expression that cannot be shown to be real wherever it is defined is refused with
UncompilableNodeException, and a NaN means only that there is no value. The
showing is structural and so conservative:
real for positive x. Compile over Complex for the value itself.
#2286
Example
using static AngouriMath.MathS;
Console.WriteLine("sin(arcsin(x))".Compile<double, double>("x")(2));
using var _ = Settings.RefuseNonRealCompilation.Set(true);
Console.WriteLine("x / (1 + x^2)".Compile<double, double>("x")(2));
try { "sin(arcsin(x))".Compile<double, double>("x"); }
catch (AngouriMath.Core.Exceptions.UncompilableNodeException) { Console.WriteLine("refused"); }Prints
NaN
0.4
refusedAngouri © 2019-2026 · Project's repo · Site's repo · Octicons · Transparency · 5629 pages online