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

skilchen opened this Issue May 31, 2018 · 1 comment


None yet
2 participants
Copy link

skilchen commented May 31, 2018

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



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.


This comment has been minimized.

Copy link

skilchen commented Jun 5, 2018

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

@skilchen skilchen closed this Jun 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment