[aspect-devel] muparser and Floating point exception from divide by zero.
Timo Heister
heister at clemson.edu
Sat Jun 30 08:56:56 PDT 2018
Bob,
> You're using a muParser if syntax that was deprecated a few years ago.
This is not quite correct. "if(expression, A, B)" is actually an a
function we register with function parser inside deal.II. The problem
is of course that A and B are evaluated before the expression is
checked and divisions by zero would generate an error. This never
occurred to me before. Oops. :-)
> The new syntax uses lazy evaluation to evaluate only the required branch of the if-statement. Try this:
>
> x>0 ? TS+(TM-TS)*(1-erfc((YMAX-y)/(2*sqrt(K*x/VSUB)))) : TM
I checked and this does work (my example would be "(expression) ? (A)
: (B)") . Great!
More information about the Aspect-devel
mailing list