It is currently July 16th, 2024, 1:11 pm

String cannot show the correct number

Report bugs with the Rainmeter application and suggest features.
comic3344
Posts: 13
Joined: November 13th, 2012, 4:17 am

String cannot show the correct number

Post by comic3344 »

I find a "bug", the code is as follows:

Code: Select all

[Rainmeter]
Author=
AppVersion=
Update=
Background=#@#Background.png

[Metadata]
Description=
License=
Version=

[Variables]
InputStr=12345678901234567
fontName=Trebuchet MS
textSize=8
colorBar=235,170,0,255
colorText=255,255,255,205

; ----------------------------------

[measureStrNum]
Measure=Calc
Formula=#InputStr#
DynamicVariables=1
; ----------------------------------

[meterTitle]
Meter=STRING
StringAlign=LEFT
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
X=20
Y=12
W=140
H=18
Text=[measureStrNum]
DynamicVariables=1
the meterTitle should be "12345678901234567
", but a "6" come out as the last character of the string

I hope some Master could help me, Thx~~

:)
Last edited by Brian on November 13th, 2012, 5:16 am, edited 1 time in total.
Reason: Use [code] tags please.
comic3344
Posts: 13
Joined: November 13th, 2012, 4:17 am

Re: String cannot show the correct number

Post by comic3344 »

Nobody wanna have a try and check the bug? :-(
User avatar
Brian
Developer
Posts: 2706
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: String cannot show the correct number

Post by Brian »

The problem is how a computer stores a floating-point number. We have defined the Calc measure to return a "double" value, which means it can work with a number within this range of 1.7e-308 to 1.7e+308. However, when a number gets beyond 9,007,199,254,740,992, the only "representable" ones are the even digits.

This is just a limitation with all computers using "double" floating point variables. Here is some more information: http://en.wikipedia.org/wiki/Double-precision_floating-point_format

-Brian
comic3344
Posts: 13
Joined: November 13th, 2012, 4:17 am

Re: String cannot show the correct number

Post by comic3344 »

Many Thanks~ :D