Replies: 13 comments
-
That's an interesting one, thanks for reporting @zcohan . Reason is both prefixes Lines 1338 to 1356 in a514b8c We somehow need to distinguish the two types of prefixes. I don't have an idea right away what would be a handy approach though, @ericman314 do you have any ideas? |
Beta Was this translation helpful? Give feedback.
-
Right, the prefix is chosen to keep the rendered value "not too big" and "not too small". I don't know of a quick fix for this, it'll take a little more thought. |
Beta Was this translation helpful? Give feedback.
-
If anyone is interested in picking this issue up please let me know. |
Beta Was this translation helpful? Give feedback.
-
I would be interested in fixing this issue |
Beta Was this translation helpful? Give feedback.
-
Is what we need to do is similar to choosing between feet and meters for distances? |
Beta Was this translation helpful? Give feedback.
-
Thanks for your offer @jackcmason, some help would be great. I think we first need to come up with an idea on how to solve this issue. Do you have any suggestion? |
Beta Was this translation helpful? Give feedback.
-
@harrysarson I think it's a similar to not wanting to mix short prefixes (like |
Beta Was this translation helpful? Give feedback.
-
However, |
Beta Was this translation helpful? Give feedback.
-
:) yes true, I just mean they are somehow similar but should not get mixed together. |
Beta Was this translation helpful? Give feedback.
-
The problem is, how do we decide what the user wants to see? It is a combination of choosing a prefix to keep the magnitude of the value reasonable, choosing the correct format of the prefix (long or short), and the correct unit system, SI or something else. All we have to go on is options the user configures, and what the user has used in the past. Here's one possible approach. We could make several highly customizable options which explicitly define what units and prefixes the user will see. Things like GB or GiB. Then, to achieve the "automagic" behavior that math.js currently tries to do, the options would be selected automatically as the user is interacting with a math.js instance. That would go a long way to eliminating the mystery of what's going on behind the scenes in the unit formatter, since the user could just query the current config to see why a unit was formatted the way it was. For most users that are happy with the way things work now, it would still work the same, but for the few that need to control how units get formatted they could do so. |
Beta Was this translation helpful? Give feedback.
-
I think that bits should be restricted to SI or IEC prefixes when parsed or by the |
Beta Was this translation helpful? Give feedback.
-
@ericman314 I like your idea, I think we should en up with putting all current magic in configurable options which have a good as possible default settings. That will empower users that want total control. @jackcmason would be nice as a start, in many (or some?) cases we can know the typeof prefix from the input (like Would be nice if we could make a first small step in the right direction splitting these prefixes, and as a second step work towards a configurable solution. |
Beta Was this translation helpful? Give feedback.
-
@jackcmason you made a start with implementing this feature in #1390, do you feel like working on the next steps maybe? |
Beta Was this translation helpful? Give feedback.
-
I'm seeing GiB in some unit calculations, when I expect GB.
There seems to be a threshold point. Here's an example:
5 minutes * 54.74 MB/second = 16.422 GB
5 minutes * 54.75 MB/second = 15.296973288059 GiB
Beta Was this translation helpful? Give feedback.
All reactions