CADINP - function to round numbers?

Hello everyone,

I am quite new to SOFiSTiK and very excited to learn more about it.
For the geometrical model of a bridge I’m making in Teddy with a script, I have to round the result of a calculation. For instance, I have #length1 and #length2 and I calculate #length1/#length2. If this result is 5.3 for example, then I want it to become 5. If it’s 3.8, it should become 4.

I’ve tried to use round(…) with no luck, and I also couldn’t find much information about such commands or functions online. Any help would be much appreciated!

Kind regards

Hello Bingelbi,

please have a look on the following example:

#DEFINE ROUND
let#M 1
let#N MOD(#Z,1)
$ prt#N
if #N<0.5
let#M 0
endif
let#Z DIV(#Z,1)+#M
#ENDDEF

+prog template
Head
let#Z 3.8
prt#Z
#include Round
prt#z

let#z 5.3
prt#z
#include Round
prt#z
end

Greetings
Phil

Awesome! Thank you very much for the quick reply, ploosmann.