Page 5 of 5
Re: Absolute Val for Integers?
Posted: Mon Feb 04, 2019 6:47 pm
by Michael Vogel
Didn't want to start an 'endless' discussion 'bout that, sorry...
...just thought, the compiler should also avoid 'endless' in it's error message

Re: Absolute Val for Integers?
Posted: Mon Feb 04, 2019 11:33 pm
by Demivec
Here's my version also just for the confusion of it

:
Code: Select all
Macro mMin(a, b)
(a) * Bool((a) And (((a) <= (b)) Or ((b) = 0))) + (b) * Bool((b) And (((b) < (a)) Or ((a) = 0)))
EndMacro
s.s = ""
Debug "m |-3 -2 -1 0 1 2 3"
Debug "--+--------------------"
For a = -3 To 3
s = "" + RSet(Str(a), 2, " ") + "|"
For b = -3 To 3
m = mMin(a, b)
s + RSet(Str(m), 2, " ") + " "
Next b
Debug s
Next a
Re: Absolute Val for Integers?
Posted: Wed Feb 06, 2019 12:14 pm
by #NULL
In some cases the compiler can't evaluate the macro arguments first, because they might make sense only in combination with other macro content like concatenation with # inside the macro body. Avoiding the recursion error if caused by an argument may work but then actual endless recursion might be possible again.