Open Wendelstein7 opened 3 years ago
Since we're actually considering significant figures, it seems like a good time to mention that the roundsignificant
function is actually broken -- whenever it should result in trailing zeroes, it does not provide these zeroes. For example, if I wanted to take a value of exactly 8
and express it with three significant digits, I would have 8.00
. However, the roundsignificant
function would fail to provide these trailing zeroes and instead just give 8
.
Leaving the option flag set to the default of SIGNIFICANTFIGURES = 3
I can demonstrate this behavior:
The same issue exists for large numbers:
Further complicating the issue is the following case:
It seems that the roundsignificant
function only works in a certain, relatively narrow range of cases, and that its shortcomings simply are not typically observed because of the context in which the function is called. Just wanted to make sure you were aware, since fixing the main problem requires fixing the behavior of this roundsignificant
function.
I have some partially-functional code for this feature in a fork. I believe it works for almost all cases, however, I would like this to be tested. I've already uncovered the following issues/limitations during my debugging:
401 * 25.0 = 1002.5
, which has 3 sig figs in the measurement and conversion factor, so gives 3 sig figs in the result. however, 1000.
and 1000
, although equivalent to the correct result in value, both express the wrong number of sig figs. Using the structure for scientific notation standard to outputs in the current state of the bot, the only correct answer to our sample problem is 1.00e+3
. As alluded to in the last bullet, a major issue with the bot is the new inability to construct scientific notation, and as a result, this remains a bug. I intend to fix this before I pull request.Cheers!
I have created a pull request and I believe this fix causes the generator to give the correct number of significant figures for every input, however, third-party verification is always appreciated. If this is in fact true, I would like to request that it be merged. Thanks!
Different input prompts may find different amount of significant digits relevant. A measurement of whole feet typically doesn't need up to three significant digits. While
3 feet
gets corrected to0.914 m
, perhaps0.9 m
or0.91 m
would suffice.Perhaps the significance of the input could be taken into account: prompt
3.00 feet
or12.54 stone
would result in more significant digits than3 feet
and12 stone
would.