The ceil function isn't working as expected for me. It seems to have something to do with the unit.
For example, this expression
=ceil(40.1) correctly resolves to 41
However this resolves to some weird value:
=ceil(40.1 in) incorrectly resolves to 40.12 in
Ultimately I'm trying to round an expression up to the nearest 1/8th of an inch. Normally I could do that like this:
=ceil( someValue / (1/8) ) * (1/8)
But if someValue is in inches, it doesn't work correctly.
What am I missing here? Thanks in advance!
How to use inches in expression function
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
-
- Posts: 1
- Joined: Sun Jun 20, 2021 7:34 pm
Re: How to use inches in expression function
It is clear that the ceiling is being calculated on the metric equivalent of the entry value.
Probably could be considered a bug, or at least a missing function.
FreeCAD does all internal calculations in metric, so a special function would be needed to calculate floor and ceiling for dimensions in other units.
Most linear and analytic functions work correctly in any units, but floor and ceiling are not linear nor analytic.
Gene
Probably could be considered a bug, or at least a missing function.
FreeCAD does all internal calculations in metric, so a special function would be needed to calculate floor and ceiling for dimensions in other units.
Most linear and analytic functions work correctly in any units, but floor and ceiling are not linear nor analytic.
Gene
Re: How to use inches in expression function
You may need something like
Code: Select all
ceil(someValue*2.54 / (1/8)) * (1/8)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: How to use inches in expression function
One of the closing parentheses is misplaced.chrisb wrote: ↑Mon Jun 21, 2021 6:15 am You may need something likeCode: Select all
ceil(someValue*2.54 / (1/8) * (1/8))
Re: How to use inches in expression function
Thanks for the hint. I have corrected my post above.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.