comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: DOUBLE precision no precise??
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: DOUBLE precision no precise?? [message #29608 is a reply to message #29605] Tue, 05 March 2002 08:29 Go to previous messageGo to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
Vincent Schut wrote:

> David Williams wrote:
...

>> To try and find where the problem is, we tried the following lines...
>>
>> IDL> a = DOUBLE(42766.080001)
>> IDL> print,a,FORMAT='(F24.17)'
>>
>> 42766.07812500000000000
...

> I'm no expert on math precision, but I think that this is a known
> 'problem', caused by the different possible ways to store floating point
> precision data. (For example, different C++ compilers also give
> different values for a double precision float constant of pi, nice eh?

It's not quite the same problem. The C++ problem is due to the fact that
different implementations of C++ are free to implement double precision
math with different degrees of precision. There's a minimum required
precision, but it's not a very strict requirement. And since the C
standard library isn't even required to provide a value of pi,
implementations are free to provide it with whatever precision they choose.

The IDL problem is due to the fact that the default precision in IDL is
'FLOAT', rather than 'double', which is the default precision for C/C++.
Thus,

IDL C/C++
float
42766.080001 42766.080001F
double
42766.080001D 42766.080001
long double N/A 42766.080001L
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: bad magic number for shared library when using CALL_EXTERNAL
Next Topic: CALL_EXTERNAL using C/Fortran shared library on HPUX11

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 04:26:26 PDT 2025

Total time taken to generate the page: 7.52019 seconds