I bumped into [WayBack] delphi – Invalid floating point operation calling Trunc() – Stack Overflow, while searching for what might have tests like these fail:
TValueRecordTests.Int64_Through_Value_Container_via_Currency_Intermediate_Is_Identity_Operation(9223372036854775807) = 9223372036854775807
EInvalidOp with message 'Invalid floating point operation'
In the end, it reproduced with a much more simple test case class of which the first three fail (EInvalidOp with message 'Invalid floating point operation'
), but the last three succeed.
Lesson learned:
High(Int64)
stored in Currency
or Double
, will not Trunc
back to their original value.
Low(Int64)
stored in Currency
will not Trunc
back to their original value.
- Testing boundary conditions is nice, but be sure what your boundary conditions are in the first place.
Read the rest of this entry »
Like this:
Like Loading...