Page 1 of 1
PowD() ?
Posted: Tue Oct 16, 2007 8:27 pm
by kenmo
Not mandatory, but has anyone on the PB team looked into a Pow function that returns double precision? I only ask because I'm writing a simple customized calculator program, that uses mostly PB's own functions, and double precision is wasted when Pow is used in a formula.
Thanks
Posted: Tue Oct 16, 2007 8:34 pm
by Trond
Pow() is already overloaded and returns a double value when used with doubles.
Posted: Wed Oct 17, 2007 2:42 pm
by kenmo
Ah, thats good to know. Just wondering, why not overload the Str() functions then, instead of Str() StrF() StrD() StrQ()?
One more question while I'm here, why does StrD() return less precision than the double actually has?
Code: Select all
Pi.d = #PI
Debug Pi
Debug StrD(Pi)
Posted: Wed Oct 17, 2007 2:59 pm
by #NULL
you can avoid it by specifying a higher nbDecimals parameter.
Posted: Wed Oct 17, 2007 3:42 pm
by Trond
kenmo wrote:Ah, thats good to know. Just wondering, why not overload the Str() functions then, instead of Str() StrF() StrD() StrQ()?
It works like this:
Code: Select all
A.d = Pow(2, 3) ; Double version of Pow()
B.f = Pow(2, 3) ; Single version of Pow()
C.s = Str(2) ; StrD() or StrF()???
Posted: Thu Oct 18, 2007 1:10 am
by kenmo
#NULL, thanks, I don't know why I didn't think to try that!
Trond, I thought overloading meant slightly different functions with the same name that depended on the type of the input, not the type of the output?
Posted: Thu Oct 18, 2007 8:24 am
by DoubleDutch
Trond, I thought overloading meant slightly different functions with the same name that depended on the type of the input, not the type of the output?
It does, and it would be very useful.
Posted: Thu Oct 18, 2007 10:28 am
by Trond
kenmo wrote:#NULL, thanks, I don't know why I didn't think to try that!
Trond, I thought overloading meant slightly different functions with the same name that depended on the type of the input, not the type of the output?
Well, it depends on the output here.