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 #29619 is a reply to message #29617] Tue, 05 March 2002 05:01 Go to previous messageGo to previous message
Vincent Schut is currently offline  Vincent Schut
Messages: 8
Registered: February 2002
Junior Member
David Williams wrote:
> I've always had heaps of help from the inhabitants of this newsgroup --
> for which I am eternally grateful -- despite my often stupid questions.
> So, when a mate of mine came across this `quirk' yesterday, and I wasn't
> sure how to help him out, I thought I'd ask this group.
>
> He has an array of numbers that he wants to apply a user-defined
> function to, but we're both a little disturbed by the fact that if you
> do the calculations with a pocket calculator, you get different numbers
> than if you perform the same calculation in IDL.
>
> 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
>
> As you see, the number we get out isn't the same as the number we
> entered. I'm guessing it's to do with the way IDL stores numbers in
> memory, but my understanding of low-level computational processes isn't
> great.
>
> Can anybody help me understand what's going on, and/or if there's a way
> around? I'd really appreciate whatever help is on offer, so thanks in
> advance.
>
>
> Dave
>
> ------------------------------------------------------------ ---------
> David R. Williams, | BT7 1NN, Northern Ireland.
> Astrophysics & Planetary Science, | d.williams@qub.ac.uk
> Queen's University, Belfast, | http://star.pst.qub.ac.uk/~drw/
> ============================================================ =========

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 might help to read the idl help section called 'accuracy &
floating point operations', as a start. Maybe others in the group can
give you a more specific answer, though.

cheers,
Vincent.
[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: Wed Oct 08 13:58:42 PDT 2025

Total time taken to generate the page: 0.00451 seconds