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

strformat produces wrong output for negative zero if sign is requested #7923

Closed
skilchen opened this issue May 31, 2018 · 1 comment
Closed

Comments

@skilchen
Copy link
Contributor

import strformat
echo fmt"{-0.0:+f}"
echo fmt"{-0.0:+e}"
echo fmt"{-0.0:+g}"

produces:

+-0n.000000
+-0.000000e+00
+-0

strformat shouldn't add the '+' in this case.

And btw. if you try to run this on the js backend, you get something like:

res_121201 = f_121023.toFixed(precision_121030);
			                      ^

RangeError: toFixed() digits argument must be between 0 and 100

this is due to strutils.parseBiggestFloat which in the defined(js) branch doesn't handle the case precision < 0.

@skilchen
Copy link
Contributor Author

skilchen commented Jun 5, 2018

has been fixed in #7954. thanks @Varriount for the support!

@skilchen skilchen closed this as completed Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants