If you set one parameter equal to another, the second will change type to match the first. If you have an integer parameter and set it equal to a real parameter, the integer parameter will change type to a real. (This is how you can change parameter types after they are created without recreating them.)
To convert a real to an integer, you will need to use either the FLOOR, CEIL, functions. If you want to choose whether to round up or down automatically, you will need to write a conditional statement to pick which one to use based on your starting value.
Here's an example of using floor and ceil to round off a number. You ought to be able to adapt it to your needs.
/* thickness = od - id divided by 2 thickness=(d15-d14)/2 /* x1= step diam before rounding x1=d14+thickness /* shift moves the decimal point the number of places you want to round to shift=x1*1000 /* Interger removes the numbers to the right of the decimal Interger=floor(shift) /* rounder is just the numbers to the right of the decimal rounder=shift-interger /* the following if/else statement compares the rounder to .5 /* if the rounder is equal to or larger than .5 it rounds up. If /* the rounder is smaller than .5 it rounds down. If rounder<.5 rounded=floor(shift) else rounded=ceil(shift) endif /* reshift moves the decimal point back to the correct place reshift=rounded/1000 /* d13 = the rounded step diam minus the step clearance d13=reshift-0.05
By adding 0.5, if the value is closer to the lower integer, floor will still round down, if it's closer to the upper integer, adding 0.5 will bump it past the upper integer so floor will essentially round up.
I think you're missing the point of what I was trying to do in the relation example.
Say your math ends up with a number like this 123.15963 and you want to round off to 3 places. 123,15963 x 1000 = 123159.63 123159.63 + .5 = 123160.13 Floor of 123160.13 = 123160 123160 /1000 = 123.160
Or you could do Shift=(x1*1000)+.5 Rounded=floor(shift)/1000
Floor(x+.5) isn't letting you choose how many places you want to round off to.
Ah yes, excellent point. If all you want to do is round to the nearest integer (which I think was the original question), the simple one line solution works. If you need to round to a specific # of places, then some additional trickery is required.
"An integer is any number which can be either positive and negative but not a fractional number. It is also a whole number. Examples are -1,256, -589, -1, 0, 1, 569, 5,236. It is always a rational number."
But the whole interchange was educational regardless of the original question ..... thanks gentlemen.
[cid:image001.jpg@01CD08DE.56D51720] The information contained in this electronic mail transmission is intended by Weil-McLain & for the use of the named individual or entity to which it is directed and may contain information that is confidential or privileged. If you have received this electronic mail transmission in error, please notify the sender of the error by reply email so that the sender's address records can be corrected and delete it from your system without copying or forwarding it, including any reply records.