1 Pages (3 items)
units and trunc() - Messages
#1 Posted: 9/9/2010 1:34:40 AM
I want to do the following:
length := 16 in
diameter := trunc(((length + 2 in)/pi)in)
diameter = 7.0000 in
I need to be able to set the result of a parenthesis-enclosed
expression
to inch units, then apply the trunc() function to
it, retaining the units as inches. At the moment, it
seems as though it is only possible to apply the trunc()
function to the results of computation in parenthesis
using SI units, so the result becomes 0 because the
value of (length + 2 in)/pi is 0.1779 m.
The workaround seems to be to not use units at all,
but that is not nearly as nice.
length := 16 in
diameter := trunc(((length + 2 in)/pi)in)
diameter = 7.0000 in
I need to be able to set the result of a parenthesis-enclosed
expression
to inch units, then apply the trunc() function to
it, retaining the units as inches. At the moment, it
seems as though it is only possible to apply the trunc()
function to the results of computation in parenthesis
using SI units, so the result becomes 0 because the
value of (length + 2 in)/pi is 0.1779 m.
The workaround seems to be to not use units at all,
but that is not nearly as nice.
#2 Posted: 9/9/2010 2:32:46 AM
Hello,
What about this

The argument inside "trunc" divide by the desired unit (in - in this case).
Then, the entire expression multiply by the desired unit (in - in this case)
In general, when you do not want SI units - divide the expression by the desired unit.
Then you will get the dimensionless number with the value in the desired unit.
Regards,
Radovan
What about this
The argument inside "trunc" divide by the desired unit (in - in this case).
Then, the entire expression multiply by the desired unit (in - in this case)
In general, when you do not want SI units - divide the expression by the desired unit.
Then you will get the dimensionless number with the value in the desired unit.
Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
1 Pages (3 items)
-
New Posts
-
No New Posts