-
Notifications
You must be signed in to change notification settings - Fork 790
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
%+f
printf format specifier adds both plus and minus for negative zero (-0) on .NET Core
#15557
Comments
From a mathematical point of view this is a compendium of horrors. LHS: RHS: Some of these horrors come from dotnet (the useless idea of unary +, the idea of "negative zero") but we should try to protect against this nonsense and certainly not go out of our way to support it. |
IEEE 754 strictly defines both Notably, Many computer languages do also define an unary None of these are "useless" or "nonesense" and can help with readability, maintainability, clarity, and correctness of the overall code. Particularly in specialized domains/fields. But beyond all that, some form of support for the functionality is also strictly required by any language/runtime that touts IEEE 754 conformance. |
@charlesroddie I'm mostly just making the point that the current behavior observed in this corner isn't consistent with itself under any interpretation. I'd rather it print By the way, long time no see! I hope you are doing well. |
%+f
printf format specifier adds both plus and minus for negative zero (-0)%+f
printf format specifier adds both plus and minus for negative zero (-0) on .NET Core
Noting here that this bug only affects FSharp.Core under .NET Core. See: #18147 (comment) |
printf
formatting a value of-0.0
with a%f
format specifier and setting the+
flag adds a plus and a minus sign to the result.Expected behavior
sprintf "%+f" -0.0
should display-0.000000
sprintf "%+f" -0.0
should display+0.000000
(to match .NET Framework behavior).Actual behavior
Displays
+-0.000000
Known workarounds
None known.
Related information
Potentially related to: dotnet/runtime#70460
The text was updated successfully, but these errors were encountered: