|
|
(for 3.5)
Just two simple and trivial functions but added to math.inc are very usefull
(and probably faster in parsing and executing then whole expression or macro):
#local even=function(N){select(int(N/2)-N/2,0,1,0)};
#local odd=function(N){even(N+1)};
and small example to test it:
#macro Test(T)
#local S=str(T,0,(int(T)=T?0:-1));
#if(even(T))
#debug concat( S , " is even.\n")
#end
#if(!even(T))
#debug concat( S , " isn't even.\n")
#end
#if(odd(T))
#debug concat( S , " is odd.\n")
#end
#if(!odd(T))
#debug concat( S , " isn't odd.\n")
#end
#end
Test(1)
Test(1.5)
Test(2)
ABX
Post a reply to this message
|
|