Pow returning a double (Documentation update pls)

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Pow returning a double (Documentation update pls)

Post by Tranquil »

As manual says, Pow is returning a float. It would be nice to get a double for lager results as a native command.

Or did I miss something!?

EDIT: Edited the topic in the near right direction.
Last edited by Tranquil on Wed Nov 22, 2006 7:51 am, edited 1 time in total.
Tranquil
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

The doc only means that the type returned is a floating point decimal number. If you choose a double to receive the result, the function will fill it correctly up to the capacity of a double. The doc could be tweaked a bit to show that Result.d = Pow(number.f, power.f) is also valid. The result of this Pow function would not fit in a .f type, yet it works properly:

Code: Select all

dog.d = Pow(30000,3)
cat.q = 30000*30000*30000

Debug dog
Debug cat
BERESHEIT
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Post by Tranquil »

Thanks netmaestro.

I thought so but was confused about the docs.
Tranquil
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

The german documentation also says, that Fred will add a AbsD() function. You now the normal Abs()? It returns the absolute value of a FLOAT number.

The german documentation says explicitly, that a function for Double will follow in one of the next versions.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Post Reply