Skip to content
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

Closed
jsm28 opened this issue Dec 19, 2015 · 3 comments
Closed

Conversions wrongly produce zero instead of subnormal #30

jsm28 opened this issue Dec 19, 2015 · 3 comments
Assignees
Labels

Comments

@jsm28
Copy link

jsm28 commented Dec 19, 2015

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

@tuliom tuliom added the bug label Dec 24, 2015
@racardoso
Copy link

This is related to #32. Now it's returning a 0x0.0000000000001p-1022 since it's considering a obvious underflow. Maybe my #61 is incomplete. I am working on this now.

@racardoso racardoso self-assigned this Oct 5, 2017
@racardoso
Copy link

The problem here is that BINPOWOF10_LIMIT is E308 (for double) that's the exponent for max and min normal number but, the min subnormal exponent is E324 (4.9406564584124654e-32).

@racardoso racardoso mentioned this issue Mar 1, 2018
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>
@racardoso
Copy link

This is already fixed. Although, we still have some problems with subnormal numbers there's already issues #32 #71 #29 that point that issues. So I am closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants