New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversions wrongly produce zero instead of subnormal #30
Labels
Comments
The problem here is that |
Merged
racardoso
pushed a commit
to racardoso/libdfp
that referenced
this issue
Mar 20, 2018
This commit fixes the incorrect result when use "to nearest" round mode in a underflow result generated by a decimal to binary float/double cast. It should return -0.0/0.0 if the absolute value of the result is less than or equal to half the least subnormal or subnormal otherwise (task libdfp#32). This commit also fixes a wrongly produced zero instead a subnormal. The underflow case should be checked by the minimum subnormal exponent (-324 and -45) respectively instead the minumum normal exponent (task libdfp#30). Signed-off-by: Rogerio Alves <rcardoso@linux.vnet.ibm.com>
racardoso
pushed a commit
that referenced
this issue
Mar 20, 2018
This commit fixes the incorrect result when use "to nearest" round mode in a underflow result generated by a decimal to binary float/double cast. It should return -0.0/0.0 if the absolute value of the result is less than or equal to half the least subnormal or subnormal otherwise (task #32). This commit also fixes a wrongly produced zero instead a subnormal. The underflow case should be checked by the minimum subnormal exponent (-324 and -45) respectively instead the minumum normal exponent (task #30). Signed-off-by: Rogerio Alves <rcardoso@linux.vnet.ibm.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
At least some libdfp conversions between decimal and binary types wrongly convert values in the subnormal range of the target type to zero instead of a subnormal. For example, for conversions from _Decimal128 to double, the attached test (on POWER8 little-endian) outputs:
0x0.012688b70e62bp-1022 0x0p+0
whereas if I use the libgcc conversions I get the expected:
0x0.012688b70e62bp-1022 0x0.012688b70e62bp-1022
subnormal.txt
The text was updated successfully, but these errors were encountered: