Difference between revisions of "REAL 64 (issues)"
m (typos) |
|||
Line 1: | Line 1: | ||
[[Category:ELKS]] | [[Category:ELKS]] | ||
− | This page describes issues with the current implementation of REAL_64 in comparison to the [[REAL_64 (interface)| | + | This page describes issues with the current implementation of REAL_64 in comparison to the [[REAL_64 (interface)|interface description]] or desired output when nothing is specified. |
===is_equal and NaN=== | ===is_equal and NaN=== | ||
− | The floating point standard says that 'NaN = NaN' is false. But in order to uphold the postcondition of 'NaN.twin' which says that 'Result.is_equal (Current)' the | + | The floating point standard says that 'NaN = NaN' is false. But in order to uphold the postcondition of 'NaN.twin' which says that 'Result.is_equal (Current)' the comparison with 'is_equal' should yield true. |
At the moment 'is_equal' for reals is optimized in the compiler and is replaced by '=' and thus the postcondition of 'twin' is violated. | At the moment 'is_equal' for reals is optimized in the compiler and is replaced by '=' and thus the postcondition of 'twin' is violated. | ||
Line 12: | Line 12: | ||
Currently when doing a 'floor', 'ceiling', 'rounded' or 'truncate_to_integer' with a number which is too large (e.g. 2^31) the result is {INTEGER}.min_value. | Currently when doing a 'floor', 'ceiling', 'rounded' or 'truncate_to_integer' with a number which is too large (e.g. 2^31) the result is {INTEGER}.min_value. | ||
− | The change in the sign is a not expected | + | The change in the sign is a not expected behavior and violates (informal) contracts. |
===divisible=== | ===divisible=== | ||
By providing NaN and INF every real value can be divided by every other real value. Thus a call of 'divisible' should always return true. This arises again in INTEGER.infix "/". A call to 12 / 0 is not allowed by the current contract but should just return INF. | By providing NaN and INF every real value can be divided by every other real value. Thus a call of 'divisible' should always return true. This arises again in INTEGER.infix "/". A call to 12 / 0 is not allowed by the current contract but should just return INF. |
Revision as of 09:55, 17 November 2006
This page describes issues with the current implementation of REAL_64 in comparison to the interface description or desired output when nothing is specified.
is_equal and NaN
The floating point standard says that 'NaN = NaN' is false. But in order to uphold the postcondition of 'NaN.twin' which says that 'Result.is_equal (Current)' the comparison with 'is_equal' should yield true.
At the moment 'is_equal' for reals is optimized in the compiler and is replaced by '=' and thus the postcondition of 'twin' is violated.
floor, ceiling, rounded and truncated_to_integer
Currently when doing a 'floor', 'ceiling', 'rounded' or 'truncate_to_integer' with a number which is too large (e.g. 2^31) the result is {INTEGER}.min_value.
The change in the sign is a not expected behavior and violates (informal) contracts.
divisible
By providing NaN and INF every real value can be divided by every other real value. Thus a call of 'divisible' should always return true. This arises again in INTEGER.infix "/". A call to 12 / 0 is not allowed by the current contract but should just return INF.