Replies: 1 comment
-
There isn’t anything built into FixedNumber for comparison. I’ve thought about it, but it seems like something that would be drought with confusion, unless it required a common base. Most often a bunch of different fixed numbers are use to represent different units, and using inequalities on different units usually means you are doing something wrong, but it may make sense to add if using a common base. The main purpose of FixedNumber has been for string conversion and calculation. To compare value though, you can convert them to a common unit using the That does seem overly complex though; I’ll look into adding a comparison feature in v6 too. :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What is a good way to compare FixedNumbers? For example how do I compare two FixeNumbers to find out which one is greater, or if they are equal etc?
The Javascript comparison operators like >, < etc. appear to work but sometimes they don't work and give wrong results. For example this code gives the wrong result:
Beta Was this translation helpful? Give feedback.
All reactions