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

Time.fmt does not raise the Size exception. #36

Open
JohnReppy opened this issue Aug 22, 2015 · 0 comments
Open

Time.fmt does not raise the Size exception. #36

JohnReppy opened this issue Aug 22, 2015 · 0 comments
Assignees

Comments

@JohnReppy
Copy link

The code

load "Time";
Time.fmt ~1 (Time.now());

should raise the Size exception, but does not in Moscow ML. The simple fix is to change lines 37-38 of Time.sml to

fun fmt p r = Real.fmt (StringCvt.FIX (SOME p)) (r/1000000.0);

since Real.fmt raises Size on invalid precision specifications.

A better fix is

fun fmt p = if (p < 0)
      then raise Size
      else (fn r => Real.fmt (StringCvt.FIX (SOME p)) (r/1000000.0))

since it is consistent with how Real.fmt treats invalid format specifications.

@kfl kfl self-assigned this Aug 25, 2015
mrhmouse added a commit to mrhmouse/mosml that referenced this issue Apr 25, 2016
This applies changes suggested by @JohnReppy to fix issue kfl#36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants