You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inconsistent --strict-math handling of certain properties (hardcoded font etc.) #1627
Some magic is happening in LESS. I used
ceil(@font-size-base * 1.25);
.. .
...
ceil(@font-size-base * 1.25);
First ceil was working but not the 2nd one. I was working with prepros downloaded recently. I checked in less2css.org there also same result. Now, it is working on less2css.
Another, issue was with this simple line of code:
@font-size-base * 1.25;
This was also used two times in my less. One for tablet and another for desktop with different number. First one was giving calculated number but another one was giving:
0.6em * 1.5; instead of calculated value.
I put the code here using which I was trying ceil and other:
Sounds like strict maths is on? If it is you have to add parentheses around
every maths operation or it won't compute.
If its not that please give more repro steps and exactly what output or
error you get..
On 31 Oct 2013 13:44, "Satya Prakash" [email protected] wrote:
Some magic is happening in LESS. I used
ceil(@font-size-base * 1.25);
.. .
...
ceil(@font-size-base * 1.25);
First ceil was working but not the 2nd one. I was working with prepros
downloaded recently. I checked in less2css.org there also same result.
Now, it is working on less2css.
Another, issue was with this simple line of code:
@font-size-base * 1.25;
This was also used two times in my less. One for tablet and another for
desktop with different number. First one was giving calculated number but
another one was giving:
0.6em * 1.5; instead of calculated value.
I put the code here using which I was trying ceil and other:
No, strict math was not on. The Code is still producing same result. The problem was with ceil as well but I have changed to make it work. Below code is not calculating. Here the code is not calculating:
@lukeapage I know satya61229 closed his own issue here, but I'm not sure that the "issue" is actually resolved. The fact that a function like ceil() would not do its math correctly because it was being called in a font: property when strict-math was off seems like a bug to me. I understand that the font property has the special case of needing to ignore the size/line-height syntax for math purposes, but that definitely should not affect maths inside functions, and is even questionable if it should affect any math outside a function except perhaps a division. To me, these should both resolve to 240px if strict-math is off:
font: 12px * 20px;
font-size: 12px * 20px;
I have not looked to see what other discussions you have had about font and the use of the size/line-height syntax, but I could even see spaces being important with strict-mathoff, so that:
font: 12px/20px; // no math done in the font property
font: 12px / 20px; // math done even in font property
However, that might be pushing it. Of course, all the above would require parenthesis if strict-math was on, no matter the operation or if it was in a function call like ceil().
For my purpose, working with LESS, it is resolved as I found a way to work. but from LESS own stability I agree with @scottgit . So, I am opening it. Hope you can close it later.
changed the title [-]There is some issue with ceil() and math calculation[/-][+]Inconsistent `--strict-math` handling of certain properties (hardcoded `font` etc.)[/+]on Apr 17, 2016
Activity
lukeapage commentedon Oct 31, 2013
Sounds like strict maths is on? If it is you have to add parentheses around
every maths operation or it won't compute.
If its not that please give more repro steps and exactly what output or
error you get..
On 31 Oct 2013 13:44, "Satya Prakash" [email protected] wrote:
satya61229 commentedon Nov 1, 2013
No, strict math was not on. The Code is still producing same result. The problem was with ceil as well but I have changed to make it work. Below code is not calculating. Here the code is not calculating:
Output in last media query:
Just checked in less2css.org. Above output is coming there as well w/o strict math.
seven-phases-max commentedon Nov 3, 2013
@satya61229, see my answer here.
@lukeapage, it's in tree/rule.js:34.
satya61229 commentedon Nov 4, 2013
Got it. It can be the case. Checked again in less2css.org and it work when changed to font-size from font. Accepted as right answer there. Thanks.
scottgit commentedon Nov 5, 2013
@lukeapage I know satya61229 closed his own issue here, but I'm not sure that the "issue" is actually resolved. The fact that a function like
ceil()would not do its math correctly because it was being called in afont:property whenstrict-mathwas off seems like a bug to me. I understand that thefontproperty has the special case of needing to ignore thesize/line-heightsyntax for math purposes, but that definitely should not affect maths inside functions, and is even questionable if it should affect any math outside a function except perhaps a division. To me, these should both resolve to240pxifstrict-mathis off:I have not looked to see what other discussions you have had about
fontand the use of thesize/line-heightsyntax, but I could even see spaces being important withstrict-mathoff, so that:However, that might be pushing it. Of course, all the above would require parenthesis if
strict-mathwas on, no matter the operation or if it was in a function call likeceil().satya61229 commentedon Nov 5, 2013
For my purpose, working with LESS, it is resolved as I found a way to work. but from LESS own stability I agree with @scottgit . So, I am opening it. Hope you can close it later.
lukeapage commentedon Nov 16, 2013
You are right, we switch on the option inside font declarationa but we should actually switch it off again for functions.
[-]There is some issue with ceil() and math calculation[/-][+]Inconsistent `--strict-math` handling of certain properties (hardcoded `font` etc.)[/+]seven-phases-max commentedon Apr 17, 2016
Merging to #1880 (since this one is impossible to "fix" w/o breaking a lot of things anyway).