hello everyone,
i tried heavily and searched the web to no avail …
short: doe’s someone have a macro, formula, function or similar at hand which computes the significant ‘after dot’ - decimal - digits of a value even for tricky cases where e.g. 8,1234678901234600E-004 (which is rounded for display by calc) contains some hidden value in the 16 (and 17?) digit and represents the real value of 8,123467890123456(1)E-004?
[edit-2]
i have rarely ‘stood so beautifully on the tube’ … ‘=X-ROUNDSIG(X;3)’ … is very close to what i need, already in the sheet, without macros, for small rounding arguments roundsig will hopefully work correctly, if not it will hopefully be fixed when fixing the other rounding functions,
above just needs some extra math if roundsig is rounding up, the result will have the opposite sign, but i guess i can get that ‘programmed’,
[/edit-2]
[edit]
- deleted the macro as … ‘oh my god what kind of crap have i been working up’, and above looks better
[/edit]
long: for a little project i deal with precision of calculations in calc, and need to know how many significant decimal digits a value has, (digits carrying value trailing zeroes not counted),
normaly it’s quite easy, 1,234 has 3 decimal digits,
i’d solve that in a basic macro by evaluating the string, if there is a better way i’d be thankful,
a little more challenging: 123400,0 has -2! decimal digits - for my use case - solved by string evaluation,
next step: 1234,567E+2 is 1234,567 * 10^2, is 123456,7 and has one significant decimal digit, solved,
small step inbetween: 1234,567E-2 is 1234,567 * 10^-2, is 12,34567 and has 5 significant decimal digits, solved,
but now it comes: 1,12345678901234E+20 has !! -20 !! decimal places (comma shift) from the E+20 but 14 of them are filled with digits and thus ‘not free’, result -6 even that is computeable,
and … - following samples may be inexact - 1,12345678901234E+20 may or may not! carry some ‘hidden value’, two more digits which one can’t see but compute … i managed to get access to theese digits by ‘rawsubtract’ or simply subtracting a truncated ‘upper part’ from the value, e.g. 1,12345678901234E+20 - 1,12345678000000E+20 may result in ‘9,01234E+11’ - no ‘hidden value’, or in ‘9,012341111321E+11’ from which 901234 is the ‘initial visible part’, and ‘1111321’ is the ‘hidden value’ (of which only the first two digits are significant, the first is correct (if not messed up by calc rounding) and the second is somehow granular as not exactly computed / computeable but has valid information about the value of the number, the rest is rounding noise / white noise,
i need: 1,12345678901234(00xyz)E+20 - (00xyz) are the hidden digits / noise - to evaluate to ‘-6’ decimals, 1,12345678901234(40xyz)E+20 to evaluate to -5 decimals, and 1,12345678901234(03xyz)E+20 to ‘-4’ decimals,
similar for negative exponents, 1,12345678901234(40xyz)E-20 has 20 decimals from the ‘E-20’, plus 14 from the visible digits, plus one from the hidden value, thus 35 in total,
anybody an idea?
P.S. i’m aware that some of this value is rounded, know what an ‘ULP’ is and that ‘doubles’ are not exact but placeholders for a range of one ULP, thus imprecise up to +/- 0,5 ULP, and thus what calc computes isn’t exact, not even ‘decimal-exact’ (what itself isn’t as exact as the real world), but what i’m trying is to get the best i can get, and for that it would be nice to get access ‘behind the scenes’ not only to the prettyfied display values …