Page 1 of 1

Plse implement ALL Math functions to use extended precision

Posted: Thu Oct 23, 2008 4:15 pm
by Kaeru Gaman

Posted: Sat Oct 25, 2008 12:02 pm
by Little John
+ 5 ( + 1 wouldn't really be sufficient. ;-) )

Regards, Little John

Posted: Sat Oct 25, 2008 12:11 pm
by Fred
All math functions comes in single and double precisions. In some case PB use single as it's not explicitely said to use double one.

Posted: Sat Oct 25, 2008 12:14 pm
by Kaeru Gaman
Please look into the discussion and give us a hint how we could force double if we want it.

there are some examples where we would expect the double version to be used but the single applies.

Posted: Sat Oct 25, 2008 12:50 pm
by Trond
Fred wrote:All math functions comes in single and double precisions. In some case PB use single as it's not explicitely said to use double one.

Code: Select all

Define.d
double.d = 10
ten.d = 10
value.d = Pow(ten, Log10(double))
Here Log10() uses single precision, that can't be correct.

Posted: Sat Oct 25, 2008 2:20 pm
by jack
your example gives the correct result in version 4.02 XP but this crashes in OS X x86 with PB 4.30b4
tried it in the IDE ans shell, same crash.

Code: Select all

Define.d 
double.d = 10 
ten.d = 10 
value.d = Pow(ten, Log10(double))
MessageRequester("", StrD(value,15), 0)

Posted: Sat Oct 25, 2008 8:59 pm
by Trond
I don't know what the correct result would be, I just threw some double variables in there and checked whether the float or double version of the function was called (and it was the float version).

Posted: Sun Oct 26, 2008 3:02 am
by jack
Trond you are right, I was only looking at the output which in this case was correct, a beter test value might be Pi.
here's a snippet of the generated asm

Code: Select all

  FLD    qword [v_double] ;load double, OK
  SUB    esp,4                 ;make room on stack for single, not OK
  FSTP   dword [esp]       ;store double as single, not OK
  CALL  _PB_Log10@4     ;call Log10_single
  SUB    esp,8                 
  FSTP   qword [esp]  
  LEA    edx,[v_ten]        
  PUSH   dword [edx+4]
  PUSH   dword [edx]
  CALL  _PB_Pow_DOUBLE@16
it's OK for Pow but not for Log10

Posted: Sun Oct 26, 2008 10:42 am
by blueznl
The problem with the mail Kaeru refers to is different. It not only has to do with the accuracy of the statement / keyword itself, but also with the way how 'upwards typecasting' doesn't function properly.

Which is, I guess, a bug :-)

Posted: Sun Oct 26, 2008 1:18 pm
by Fred
yes, it seems to have a bug here.