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

Real.fromManExp does not return expected value if man = 0.0 #72

Closed
1 of 5 tasks
JohnReppy opened this issue Jul 15, 2022 · 5 comments
Closed
1 of 5 tasks

Real.fromManExp does not return expected value if man = 0.0 #72

JohnReppy opened this issue Jul 15, 2022 · 5 comments
Assignees
Labels
basis-lib problem with Standard ML Basis library bug Something isn't working fixed-in-110.99.3 issues that will be fixed in the 110.99.3 version floating-point problem related to floating-point operations gforge bug (or feature request) ported from smlnj-gforge repository

Comments

@JohnReppy
Copy link
Contributor

JohnReppy commented Jul 15, 2022

Version

110.99

Operating System

  • All
  • Linux
  • macOS
  • Windows
  • Other Unix

OS Version

No response

Processor

Any

Component

Basis Library

Severity

Minor

Description of the problem

For any integer exp the expression

Real.fromManExp {man = 0.0, exp = exp}

does not return the expected value. The Basis Library states "If man is +-0, the result is +-0."
https://smlfamily.github.io/Basis/real.html#SIG:REAL.fromManExp:VAL

With 110.85, the expression raises the exception Overflow.

With 110.99, evaluation of the expression does not terminate.

Transcript

No response

Expected Behavior

No response

Steps to Reproduce

Evaluate the expression

  Real.fromManExp {man = 0.0, exp = 0};

with versions 110.99 and 110.85.

Additional Information

No response

Email address

phil.clayton@veonix.com

Comments from smlnj-gforge

Original smlnj-gforge bug number 316

Submitted via web form by Phil Clayton phil.clayton@veonix.com on 2022-07-05 at 13:02:00

Keywords: reals

comment by @JohnReppy on 2022-07-05 15:12:00 +000 UTC

Fixed for 110.99.3 and 2022.1

@JohnReppy JohnReppy added basis-lib problem with Standard ML Basis library bug Something isn't working floating-point problem related to floating-point operations gforge bug (or feature request) ported from smlnj-gforge repository labels Jul 15, 2022
@JohnReppy JohnReppy self-assigned this Jul 15, 2022
@pclayton
Copy link

I have found other values where Real.fromManExp has similar incorrect behaviour. Did the fix for the issue reported here also fix the following cases?

Real.fromManExp {man = Real.posInf, exp = 0};  (* man = inf *)
Real.fromManExp {man = Real.posInf - Real.posInf, exp = 0};  (* man = nan *)

These cases produce the same result as above:

  • With 110.85, the expressions raise the exception Overflow.
  • With 110.99, evaluation of the expressions does not terminate.

In these cases, I would expect Real.fromManExp to return man.

@pclayton
Copy link

Great to see that SML/NJ has moved to Github! I would have built the source to check for myself but I don't see build instructions so thought it would be quicker just to ask.

@JohnReppy
Copy link
Contributor Author

I've added instructions to the README for how to build from a repository clone. I also checked the two examples you give and they are both fixed.

@pclayton
Copy link

Thanks for the build instructions in the README - the build worked fine. Out of interest, is it necessary to always perform step 2 for subsequent builds? For example, after pulling further commits from a remote branch, can I start at step 3?

@JohnReppy JohnReppy added the fixed-in-110.99.3 issues that will be fixed in the 110.99.3 version label Jul 19, 2022
@JohnReppy
Copy link
Contributor Author

You can start at Step 3 (I've added a note to that effect to the README).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
basis-lib problem with Standard ML Basis library bug Something isn't working fixed-in-110.99.3 issues that will be fixed in the 110.99.3 version floating-point problem related to floating-point operations gforge bug (or feature request) ported from smlnj-gforge repository
Projects
None yet
Development

No branches or pull requests

2 participants