Page 1 of 1

Some math functions (again and again =)

Posted: Sun Feb 18, 2007 11:45 am
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 :)

Posted: Mon Feb 19, 2007 6:19 pm
by Psychophanta
I second the first request only, just to make the same mod operator '%' to work for floats too.

Posted: Mon Feb 19, 2007 7:25 pm
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

Posted: Mon Feb 19, 2007 7:33 pm
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. :)

Posted: Mon Feb 19, 2007 8:11 pm
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()