It is currently December 9th, 2021, 4:21 am

[LIL'BUG?] Signed Zero?

Report bugs with the Rainmeter application and suggest features.
User avatar
sl23
Posts: 929
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [LIL'BUG?] Signed Zero?

Post by sl23 »

Yeah, I got the -0 issue, it was the formulas that were being thrown in as efforts to resolve it, I was just totally lost at that point! :? :oops:
User avatar
Yincognito
Rainmeter Sage
Posts: 4108
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [LIL'BUG?] Signed Zero?

Post by Yincognito »

sl23 wrote: November 19th, 2021, 11:17 pm Yeah, I got the -0 issue, it was the formulas that were being thrown in as efforts to resolve it, I was just totally lost at that point! :? :oops:
Ah, well, they were just the "astronomical" side of my skin at work, LOL. A couple of Sin() and Asin() to spice things up and get the needed result, that's all. :D The others were just attempts to find a workaround.
User avatar
SilverAzide
Rainmeter Sage
Posts: 1678
Joined: March 23rd, 2015, 5:26 pm

Re: [LIL'BUG?] Signed Zero?

Post by SilverAzide »

You know signed zero is actually a thing, right? No Nobel prize in Math for the Rainmeter Team, I'm afraid...

Signed Zero

(Yes, I'm being facetious. ;-))
Gadgets Wiki GitHub More Gadgets...
User avatar
Yincognito
Rainmeter Sage
Posts: 4108
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [LIL'BUG?] Signed Zero?

Post by Yincognito »

SilverAzide wrote: November 20th, 2021, 12:45 am You know signed zero is actually a thing, right? No Nobel prize in Math for the Rainmeter Team, I'm afraid...

Signed Zero

(Yes, I'm being facetious. ;-))
Huh, really?! I should have known this, thanks for clearing it up - that explains everything. After reading that, it's obvious that the Nobel Prize in Math (which doesn't exist, by the way - that was one of the reasons I mentioned it, apart from some fun on the issue) has nothing to do with this, as it's a system dictated by other programming considerations, and specific to the language Rainmeter was written in.

In other words, you managed to convince me back to my initial assessment that this is useful and should be kept. But then, how to best workaround it for ALL cases and exactly WHEN this happens (so we can avoid it) are problems that still remain, and Wikipedia unfortunately doesn't provide a direct answer on the solution to these on that page.

The most shocking thing about it is not necessarily that it happens, it's how something like:
(180/PI*(-Asin(Sin(Rotation*PI/180))+2-2)) = -0
but an exact same formula where +2 and -2 are swapped, like:
(180/PI*(-Asin(Sin(Rotation*PI/180))-2+2)) = 0
This makes the behavior totally unpredictable thus hard to handle appropriately. It almost feels like one of those childhood moments when someone questioned whether 2+2 really equals 4 and came up with some funky theory to prove it. Uncertainty here is the real issue.

P.S. For now I use the -2+2 workaround which works in my case, but I wouldn't be surpised to see it fail on other formulas or results, just like the previous +0 workaround...