Page 2 of 2
Re: IsOdd() and IsEven()
Posted: Mon Jan 14, 2013 3:38 am
by Little John
MachineCode wrote:Little John wrote:these two functions we can very easily write ourselves
Oh please, that's no argument.
Yes, I wrote that in the beginning of this thread. In the meantime, I've written a little more, but there's no need to repeat it here.
Re: IsOdd() and IsEven()
Posted: Mon Jan 14, 2013 4:50 am
by MachineCode
Yep, I've said my piece anyway. I won't continue the thread after this post.
BTW, you need a command that evaluates 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x].

Re: IsOdd() and IsEven()
Posted: Mon Jan 14, 2013 5:09 am
by STARGÅTE
MachineCode wrote:Code: Select all
Debug Sqr(9) ; Why should Sqr() exist when Pow() can do the job?Debug Pow(9,0.5)
Sqr() is there for our convenience and readability
No ^^, Sqr() uses the special ASM-Code:
FSQRT which is 10 times faster than the function Pow()

So it makes your code faster.
IsOdd() and IsEven() are parts of this list:
IsPositive(), IsNegative(), IsNull(), IsPrime(), IsFibonacci(), IsPowerOfTwo(), ...
Re: IsOdd() and IsEven()
Posted: Mon Jan 14, 2013 5:28 am
by MachineCode
STARGÅTE wrote:No ^^, Sqr() uses the special ASM-Code:
FSQRT which is 10 times faster than the function Pow()

So it makes your code faster.
And likewise, Fred's ASM versions of IsOdd() IsEven() would be way faster than any macro we could write.

Re: IsOdd() and IsEven()
Posted: Mon Jan 14, 2013 8:30 am
by naw
Surely, you only need either IsOdd() - or - IsEven() since IsOdd(11)=true whereas IsOdd(10)=false
- if its neded at all of course
Re: IsOdd() and IsEven()
Posted: Mon Jan 14, 2013 8:57 am
by American Ninja
STARGÅTE wrote:IsPositive(), IsNegative()
The Sign() command does these.

Re: IsOdd() and IsEven()
Posted: Mon Jan 14, 2013 8:57 am
by IdeasVacuum
Tenaja wrote:Since most of them are done in Macros, maybe somebody can start a "standard" PB Macro library for "all of us" to use.
....now that's a good idea.
Re: IsOdd() and IsEven()
Posted: Mon Jan 14, 2013 10:40 am
by davido
Tenaja: Great idea!
Re: IsOdd() and IsEven()
Posted: Mon Jan 14, 2013 11:27 am
by Little John