tass_co wrote: ↑December 11th, 2020, 6:18 am
Hi everyone,
How can i multiply a decimal number?
For example; i want to multiply "7,89" with 8970.
I wrote code but wrong result.
Where am i doing wrong i dont know...
Code: Select all
[MeasureTT]
Measure=Plugin
Plugin=WebParser
URL=[MeasureTop]
StringIndex=2
"MeasureTT=7,89"
[ClcCalc]
Measure=Calc
Formula=(MeasureTT * 8970)
"Result=62790"
And also i tried a different formula. "Formula=(((MeasureTT * 100) * 8970)/100)" but didnt change result..
The problem is that Rainmeter is not seeing 7,89 as a decimal number. It is expecting 7.89. So when the string "7,89" is used in a formula, it is seeing the "7", but then ignoring the "," and everything after it. So 8970 * 7 is in fact 62790.
I don't have your WebParser result, but if I fake it up with a String measure, I would do it something like this:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
[MeasureTT]
Measure=String
String=7,89
Substitute=",":"."
[ClcCalc]
Measure=Calc
Formula=([MeasureTT] * 8970)
DynamicVariables=1
[MeterOne]
Meter=String
MeasureName=ClcCalc
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Result is 70773.
Note that I use the [MeasureTT] string value section variable in the formula, not the number value, since the number value is "7" as I said before. If you use the string value, you get the benefit of the Substitute, which replaces the "," with a ".".