MIN/MAX function
28 Jun 2013 13:47 #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
.
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
![:) :)](/media/kunena/emoticons/smile.png)
Please Log in or Create an account to join the conversation.
28 Jun 2013 15:27 #36147
by andypugh
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...2038993a733526#l2272
is moderately interesting reading (G-code ATAN is very odd in syntax)
Replied by andypugh on topic MIN/MAX function
I don't think so. G-code doesn't seem to support any functions that take more than one argument.Hi! Is there any way to get min or max of two parameters except using if expression?
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 or Create an account to join the conversation.
28 Jun 2013 16:54 - 28 Jun 2013 16:57 #36150
by Nick
Replied by Nick on topic MIN/MAX function
Yep - atan has a kind of strange syntax ![:) :)](/media/kunena/emoticons/smile.png)
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![;) ;)](/media/kunena/emoticons/wink.png)
Probably it can be done as #<res> = #1 MAX #2
but still it'll have odd syntax
![:) :)](/media/kunena/emoticons/smile.png)
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
![;) ;)](/media/kunena/emoticons/wink.png)
Probably it can be done as #<res> = #1 MAX #2
but still it'll have odd syntax
![:) :)](/media/kunena/emoticons/smile.png)
Last edit: 28 Jun 2013 16:57 by Nick.
Please Log in or Create an account to join the conversation.
Time to create page: 0.091 seconds