Pow() and Abs() for integers

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

could any Moderator please split this thread and move the Pow() subtopic into T&T?

;---------------------------------------------------------

@Topic

there is still no Abs() for Integer, yet, though it was announced in the Help for Version 3.30 and older.

is it really too difficult to implement?
oh... and have a nice day.
User avatar
Frabbing
User
User
Posts: 10
Joined: Mon May 09, 2011 7:59 pm
Contact:

Re: Pow() and Abs() for integers

Post by Frabbing »

3 years after and no Abs() for Integer? :cry:

I think, it's an very elementar thing for a progam-language and easy to build in. Possible solution in Asm, 32 bit:

Code: Select all

Abs proc uses edx dwNum:DWORD
mov eax, dwNum
mov edx, eax
and eax, 0F0000000h
cmp eax, edx
je @F
xor edx, 0F0000000h
xchg eax, edx
@@:
ret
Abs endp
Best regards,
Frank
Post Reply