MIN/MAX function

More
13 years 4 months ago #36146 by Nick
MIN/MAX function was created by Nick
Hi! Is there any way to get min or max of two parameters except using if expression?
O100 IF [#1 GT #2]
#<max> = #1
O100 ELSE
#<max> = #2
O100 ENDIF

It'll be great if we would be able to find max inline :).

Please Log in to join the conversation.

More
13 years 4 months ago #36147 by andypugh
Replied by andypugh on topic MIN/MAX function

Nick wrote: Hi! Is there any way to get min or max of two parameters except using if expression?

I don't think so. G-code doesn't seem to support any functions that take more than one argument.
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...2038993a733526#l2272
is moderately interesting reading (G-code ATAN is very odd in syntax)

Please Log in to join the conversation.

More
13 years 4 months ago #36150 by Nick
Replied by Nick on topic MIN/MAX function
Yep - atan has a kind of strange syntax :)
I thought that we can use SUB CALL with any amount of parameters up to 30 but it would not be an inline max...


PS GT LT MOD and others do support 2 arguments ;)
Probably it can be done as #<res> = #1 MAX #2
but still it'll have odd syntax :)

Please Log in to join the conversation.

Time to create page: 0.084 seconds
Powered by Kunena Forum