Add formatting of small floats (10^-n)#319
Conversation
also fixes incorrect rounding
|
On your test-run factorion replied on https://www.reddit.com/r/testingground4bots/comments/1rabfbh/comment/o77a0e8/ The before reply was more precise |
|
Ok investigating this I found, that the true result is Even though I confirmed we now do better (as more correct), I wanna figure out why it was wrong previously. |
|
Checked on master now, and can't reproduce that response, just get |
I needed a while to reproduce, but it happens to me only if the language is NOT Example-test: for |
|
Oh, It's not doing the same calculation at all. Since the decimal separator is ',' and not '.' the latter is simply ignored. So on en we calculate the factorial of 6.631537423e-34, but on ru and de, we calculate the factorial of 6631537423e-34. I am unsure on what should be done. To "fix" this we would have to somehow find, when it is not used as a separator, specifying some pattern of separators per locale (char and interval?) and then? Treat it as a decimal separator or give an error or something? |
|
Ohh, right! That was my bad! This is whole other issue as it appears. We would need a heuristic approach that makes assumptions about the separator. I can merge the PR later in the evening, as it seems to work as intended to me. |
This enables formatting small floats like 6.631537423e-34 as 6.631537423 × 10^-34, by allowing negative exponents in
format_float(and some more logic to handle that).Also fixes #315
Resolves #308