-
Notifications
You must be signed in to change notification settings - Fork 27.4k
When using rounding numbers that are negative and round to 0 show a negative sign #8489
Comments
Now that I am looking at it seems there is a problem with Math.round and fractions in general with JS. |
I changed my code to this and it seems to be working maybe we can use that in the code? |
Do you think you could provide a pull request for this? |
I created a patch for this, but it seems like this is actually expected behavior? Or at least according to this test |
Huh that makes little sense to me
|
I mean I get it is supposed to signify the original number was negative but
|
in regular math, 0 has no sign --- but with IEEE 754 math, 0 does have a sign because that's just how the format works. But yeah we generally don't want to format it that way =P It should be a pretty small patch to write, why not have a go at it? |
Will do give me a bit to get tests and all setup. I will work on it tonight
|
Actually, I already created a fix earlier, just updated that test case from above in #8745. |
Previously when a negative number was rounded to 0 by the number filter it would be formated as a negative number. This means something like {{ -0.01 | number: 1 }} would output -0.0. Now it will ouput 0.0 instead. Closes #8489
We ran into this while rounding to one decimal
http://plnkr.co/edit/cUqjvRuBnSfcrAC7Visz?p=preview
Basically if I were to have a value like -.01 and I would use number:1 then it shows -0.0 which would seem to be invalid.
The text was updated successfully, but these errors were encountered: