Some math functions (again and again =)

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Dr. Dri
Enthusiast
Enthusiast
Posts: 243
Joined: Sat Aug 23, 2003 6:45 pm

Some math functions (again and again =)

Post by Dr. Dri »

Here is my math wishlist
  • modulus operator for floats
    I've written a Mod function for floats and if it was managed by the compiler (like cos sin...) it would be even faster... I know people will say "modulus operator is for integers" but the FPU instruction exists.
  • WrapValue(Angle)
    This function exists in DarkBasic (except that it uses degrees) and returns an angle from 0 to 2Pi
  • ATan2(y, x)
    It has been discussed a lot but if it were native it would be managed by the compiler (like cos sin...)
  • ATanFull(y, x)
    Another function taken from DarkBasic, it is the equivalent of WrapValue(ATan2(y, x))
  • Exp(Value)
    It has been requested a very lot too, but the PB Math lib looks a bit naked without it
You can find all the functions here :
http://www.purebasic.fr/french/viewtopic.php?p=61363

Dri :)
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

I second the first request only, just to make the same mod operator '%' to work for floats too.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Dr. Dri
Enthusiast
Enthusiast
Posts: 243
Joined: Sat Aug 23, 2003 6:45 pm

Post by Dr. Dri »

Psychophanta wrote:I second the first request only
I can understand you don't agree with the 2nd and the 4th requests but ATan2 and Exp are important functions, aren't they ?
(and it's weird to have a Log function without the reciprocal)

Dri
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Dr. Dri wrote:(and it's weird to have a Log function without the reciprocal)
Dri
Oh yes, Exp() i second it too, mainly to get the 'e' number, which is a very used constant in maths and for nature (physics) calculations. (else at least i request for the #e constant).

(Sorry but i believed that with 'Exp()' you meant Exp(n) is 1*10^(n) ).

So, i think i second 1st and last of all your request. :)
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

I can't imagine what ATan2 should be...
(but I surely know it and want it, if you'll tell me what it is)

Modulo for float: strongly requested.
It's a nuisance to do any rotation-arithmetics without it.

> WrapValue(Angle)
its's only a cleaned up and speeded up %2PI, isn't it?
maybe helpful, yo.

Exp()
> the PB Math lib looks a bit naked without it
indeed.
didn't need it lately, but it sure is a base-function if you have a Log()
oh... and have a nice day.
Post Reply