It is currently March 29th, 2024, 5:01 am

Rainmeter "Round" returning "-0" for values between 0 and -0.3

Get help with creating, editing & fixing problems with skins
AttemptsAtFlight
Posts: 4
Joined: October 2nd, 2019, 4:18 pm

Rainmeter "Round" returning "-0" for values between 0 and -0.3

Post by AttemptsAtFlight »

So it's starting to get cold here and I'm noticing this for the first time, I think the title sums it up pretty well, I'm using the Round formula to get decimal point temperatures to be a single digit but for the specific values that are in the negatives, but aren't large enough to round to -1, it seems like Rainmeter returns me a "-0" result. My code is below, do I appear to be doing something wrong? And if not, how do I get it to display 0 instead?

Code: Select all

[MeasureFeelsLike]
Measure=Plugin
Plugin=WebParser
Url=[mWeatherData]
StringIndex=9

[mFeelsLike]
Measure=Calc
Formula=Round([MeasureFeelsLike],0)
DynamicVariables=1
And here's an example input/output

https://i.gyazo.com/a77737bb1a4892cfffe4ddd8d631d8bf.png
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rainmeter "Round" returning "-0" for values between 0 and -0.3

Post by balala »

AttemptsAtFlight wrote: November 3rd, 2019, 6:43 am And if not, how do I get it to display 0 instead?
Try the following formula into the [mFeelsLike] measure: Formula=(( Round ( [MeasureFeelsLike], 0 ) = 0 ) ? 0 : Round ( [MeasureFeelsLike], 0 )).
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Rainmeter "Round" returning "-0" for values between 0 and -0.3

Post by mak_kawa »

balala's solution is really smart, I think. My simple suggestion is... how about adding Substitute="-0":"0" to the measure [mFeelsLike]?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rainmeter "Round" returning "-0" for values between 0 and -0.3

Post by balala »

mak_kawa wrote: November 3rd, 2019, 7:51 am My simple suggestion is... how about adding Substitute="-0":"0" to the measure [mFeelsLike]?
Right, another good solution. But note that this has to be added to the original [mFeelsLike] measure, not to the modified one (not to that using my updated formula).
AttemptsAtFlight
Posts: 4
Joined: October 2nd, 2019, 4:18 pm

Re: Rainmeter "Round" returning "-0" for values between 0 and -0.3

Post by AttemptsAtFlight »

Respectively super clever and super simple, thank you both :)
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rainmeter "Round" returning "-0" for values between 0 and -0.3

Post by balala »

AttemptsAtFlight wrote: November 4th, 2019, 3:30 am Respectively super clever and super simple, thank you both :)
I'm glad from my part if I helped.