Skin:Issue:
- the result should be -3.00000 and not -3.00003 (see the Rainmeter log too)
Notes:
- both Frac(4294967295.999) and 1-Frac(4294967295.999) yield the correct results, i.e. 0.999 and 0.001
- because of that, Log() of the above should yield the integral -3 or -3.00000, just like the plain Log(0.001) does
- if I remove 2 digits to make Formula=Log(1-Frac(42949672.999)), the result is correct, but becomes less precise the larger the number
- this is not limited to the Log() function, it occurs when similar many digits values (e.g. around 14 or 15, like 1234567890.12345) are used in computations
- it looks like a floating point range issue (somewhat normal), I just wonder if it can be avoided, and if so, what's the range that guarantees correct results
P.S. I think I touched some related subjects in the past, just can't remember which of them included floating point imprecision out of a certain range.
EDIT: Curiously, the issue also happens if I break the 1 Calc measure into 2 Calc measures (despite the value of the 1st being reasonable), e.g.: and of course, doesn't happen if I use the string value of the 1st Calc measure: Also, it happens when using variables instead of measures.
I think it would be nice if we'd be able to get the correct result in a single Calc measure instead of using all kinds of tricks to force it to be correct.
Code:
[Rainmeter]Update=1000AccurateText=1DynamicWindowSize=1BackgroundMode=2SolidColor=47,47,47,255---Measures---[Value]Measure=CalcFormula=Log(1-Frac(4294967295.999))---Meters---[Result]Meter=StringFontColor=255,255,255,255FontFace=ConsolasFontSize=16Padding=5,5,5,5AntiAlias=1MeasureName=ValueNumOfDecimals=5Text=Value = %1UpdateDivider=-1DynamicVariables=1
- the result should be -3.00000 and not -3.00003 (see the Rainmeter log too)
Notes:
- both Frac(4294967295.999) and 1-Frac(4294967295.999) yield the correct results, i.e. 0.999 and 0.001
- because of that, Log() of the above should yield the integral -3 or -3.00000, just like the plain Log(0.001) does
- if I remove 2 digits to make Formula=Log(1-Frac(42949672.999)), the result is correct, but becomes less precise the larger the number
- this is not limited to the Log() function, it occurs when similar many digits values (e.g. around 14 or 15, like 1234567890.12345) are used in computations
- it looks like a floating point range issue (somewhat normal), I just wonder if it can be avoided, and if so, what's the range that guarantees correct results
P.S. I think I touched some related subjects in the past, just can't remember which of them included floating point imprecision out of a certain range.
EDIT: Curiously, the issue also happens if I break the 1 Calc measure into 2 Calc measures (despite the value of the 1st being reasonable), e.g.:
I think it would be nice if we'd be able to get the correct result in a single Calc measure instead of using all kinds of tricks to force it to be correct.
Statistics: Posted by Yincognito — Yesterday, 11:12 am — Replies 2 — Views 86