Conversion between REAL_64 and REAL_32
Recently one of our customer found a loss of precision in their floating point arithmetic computations involving REAL_32 and REAL_64. This loss can be seen in the code below:
Indeed, the compiler interprets it as:
Where the signature of
Because y is of type REAL_64 and there is a conversion from REAL_32 to REAL_64, the final code executed by the compiler is actually:
This is with the truncation to REAL_32 that we loose the precision.
The conversion from REAL_64 to REAL_32 was added when the conversion mechanism was put in place to replace the magic behind numerical operation in the original version of Eiffel. The reason for adding it was that we did not want to break existing code that allowed assignment of REAL_64 to REAL_32 entities.
A few years later, we now realize it was a bad move and in the next revision of EiffelStudio (i.e. 6.5) we are planning on removing that conversion. As a result some of your code might not compile. To give you an example, for EiffelStudio, over 6500 classes we had to change less than 60 classes.
To better find out how you feel about that removal, I've created a poll where you can express whether or not you agree to remove that conversion.
- Note also that the breaking change could just appear in the experimental version of the libraries so you might be immune from that problem if you keep using the compatible version.
- Updating your code to compile with that change will not break your code if you are compiling it with an older version of EiffelStudio which is a good thing.