It is currently April 25th, 2024, 2:06 pm

RexExpSubstitute - Easy but Asking Anyway [Solved]

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16169
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: RexExpSubstitute - Easy but Asking Anyway [Solved]

Post by balala »

Yincognito wrote: March 1st, 2020, 1:43 am While your suggestion to use the built-in Rainmeter function to get the value of PI is entirely correct from a coding point of view, I doubt it would make a practical difference in the above scenario, because:
- it's already decimal precision 4, and any decimal precision above that would be invisible to the naked eye - you surely know that from your own very well done projects using the same features
- since PI, as you didactically (and correctly) pointed out, is an irrational constant having an infinite number of decimals, not even a computer or a software can replicate all PI's decimals (since their number is infinite), meaning you can't get a truly precise PI no matter what, so why even trying?
Yep, definitely. Doesn't matter too much. I recommended it just for precision. Practically both values produce the same result.
User avatar
Yincognito
Rainmeter Sage
Posts: 7161
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: RexExpSubstitute - Easy but Asking Anyway [Solved]

Post by Yincognito »

balala wrote: March 1st, 2020, 6:47 pm Yep, definitely. Doesn't matter too much. I recommended it just for precision. Practically both values produce the same result.
The suggestion was spot on, yes. Just not for a reason of practical result, but rather for code clarity. :thumbup:
It would have been different if the use of PI would have been to calculate some trigonometric function result. In those cases, precision is everything, since otherwise you'd get results of, say, 0.98 instead of a plain 1 (just an example).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16169
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: RexExpSubstitute - Easy but Asking Anyway [Solved]

Post by balala »

Yincognito wrote: March 1st, 2020, 7:29 pm The suggestion was spot on, yes. Just not for a reason of practical result, but rather for code clarity. :thumbup:
It would have been different if the use of PI would have been to calculate some trigonometric function result. In those cases, precision is everything, since otherwise you'd get results of, say, 0.98 instead of a plain 1 (just an example).
Agree. You're right here.