Nov 8, 2006 #1 Recon1775 Aerospace Joined Jul 24, 2002 Messages 137 Location US Does anyone know of a way to type an IF statement that checks if the input is odd or even? Such as it outputs a 0 if it's even and a 1 if it's odd Something like that? THANKS!
Does anyone know of a way to type an IF statement that checks if the input is odd or even? Such as it outputs a 0 if it's even and a 1 if it's odd Something like that? THANKS!
Nov 8, 2006 Thread starter #2 Recon1775 Aerospace Joined Jul 24, 2002 Messages 137 Location US I think I came up with a solution... Not sure if there is an easier way, but... test = if( (-1)^n, 1, even, odd) If n is even it sends out a 1 if it's odd it sends out a -1. Upvote 0 Downvote
I think I came up with a solution... Not sure if there is an easier way, but... test = if( (-1)^n, 1, even, odd) If n is even it sends out a 1 if it's odd it sends out a -1.
Nov 8, 2006 #3 GregLocock Automotive Joined Apr 10, 2001 Messages 23,888 Location Orbiting a small yellow star That says that (2^54)-1 is even, in v5. I imagine that is a precision limit. Cheers Greg Locock Please see FAQ731-376 for tips on how to make the best use of Eng-Tips. Upvote 0 Downvote
That says that (2^54)-1 is even, in v5. I imagine that is a precision limit. Cheers Greg Locock Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
Nov 8, 2006 1 #4 davidbeach Electrical Joined Mar 13, 2003 Messages 9,548 Location US modulo 2 Upvote 0 Downvote