View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0037106||FPC||Packages||public||2020-05-18 18:45||2020-05-18 19:19|
|Reporter||Peter Weyrich||Assigned To||Michael Van Canneyt|
|Status||resolved||Resolution||no change required|
|Summary||0037106: fpexprpars IFx-Expression leads to an exception although the branch would not have to be evaluated at all.|
|Description||If one executes IFF (i = 0,0.0,1.0 / i) and i is zero, then an exception is thrown (division by zero), although that is exactly what the IFF is supposed to catch.|
|Additional Information||The IFx expressions should only evaluate the branches if they also apply.|
|Tags||No tags attached.|
|Fixed in Revision|
IFF is not the IFF you have in excel. It stands for IF with Float value - it returns a float result.
The IFD (If with DateTime) ,IFI (If with Integer) ,IFS (if with string) etc.
are regular functions that evaluate all arguments like actual functions in pascal.
They are old functions introduced when the expression parser was just written.
Since then if() was added to the expression evaluator at a lower level. Long story short:
IF(i = 0,0.0,1.0 / i)
will work as you expect.
|2020-05-18 18:45||Peter Weyrich||New Issue|
|2020-05-18 19:19||Michael Van Canneyt||Assigned To||=> Michael Van Canneyt|
|2020-05-18 19:19||Michael Van Canneyt||Status||new => resolved|
|2020-05-18 19:19||Michael Van Canneyt||Resolution||open => no change required|
|2020-05-18 19:19||Michael Van Canneyt||FPCTarget||=> -|
|2020-05-18 19:19||Michael Van Canneyt||Note Added: 0122906|