On a html template I use the mathPLUS facility to work out the difference between 2 temp sensors.
<aside>
mathPLUS is not really written like that, but if I try to write it correctly, Joomla seems to 'eat' the plus sign, so where you see mathPLUS just imagine that it's math followed by a plus sign!
</aside>
For several months I've been using:
{mathPLUS -[actual_th0_temp_c] [actual_t8_temp_c]}
Last night I noticed that the calculation was failing. The problem seemed to be that actual_th0_temp_c was negative.
Today I tried to get around that by replacing the simple negative prefix with a nested math*, i.e.:
{mathPLUS {math* -1.0 [actual_th0_temp_c]} [actual_t8_temp_c]}
but that doesn't seem to work at all.
Am I missing something obvious?
Subtraction of negative numbers using {math+...}
Moderator: Mattk
-
skyewright
- Platinum Boarder

- Posts: 873
- Joined: Fri Jan 25, 2008 6:27 pm
- Location: Isle of Skye, Scotland
Re:Subtraction of negative numbers using {math+...}
Meteohub's math parsing is very basic, it does not allow for nested formulas. I will introduce a "math-" to fix this. I have not thought of negative numbers, when suggesting the "-" prefix.
-
skyewright
- Platinum Boarder

- Posts: 873
- Joined: Fri Jan 25, 2008 6:27 pm
- Location: Isle of Skye, Scotland
Re:Subtraction of negative numbers using {math+...}
Thank you. :cheer:admin wrote:I will introduce a "math-"
-
skyewright
- Platinum Boarder

- Posts: 873
- Joined: Fri Jan 25, 2008 6:27 pm
- Location: Isle of Skye, Scotland
Re:Subtraction of negative numbers using {math+...}
Afterthought...
What if math+ just looked out for, and stripped any doubled minus signs? e.g. --0.5 gets processed as 0.5, which is what it effectively is?
Just a thought. If math- seems a better idea to you, that's fine by me.
PS. It seems that it is only the 'Preview' that 'eats' the plus signs! :)
What if math+ just looked out for, and stripped any doubled minus signs? e.g. --0.5 gets processed as 0.5, which is what it effectively is?
Just a thought. If math- seems a better idea to you, that's fine by me.
PS. It seems that it is only the 'Preview' that 'eats' the plus signs! :)