Plse implement ALL Math functions to use extended precision
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
Plse implement ALL Math functions to use extended precision
Please implement ALL Math functions to use extended precision.
... would be handy.
http://www.purebasic.fr/english/viewtop ... 697#264697
http://www.purebasic.fr/english/viewtopic.php?t=34238
http://www.purebasic.fr/english/viewtop ... 619#259619
... would be handy.
http://www.purebasic.fr/english/viewtop ... 697#264697
http://www.purebasic.fr/english/viewtopic.php?t=34238
http://www.purebasic.fr/english/viewtop ... 619#259619
oh... and have a nice day.
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
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))
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.
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)
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
it's OK for Pow but not for Log10
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
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
Which is, I guess, a bug

( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )