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

Home » Public Forums » archive » Re: Recognizing double precision?
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: Recognizing double precision? [message #56145] Sat, 06 October 2007 15:21 Go to previous message
Bringfried Stecklum is currently offline  Bringfried Stecklum
Messages: 75
Registered: January 1996
Member
wlandsman wrote:
> About once a year I receive a complaint about my code because someone
> inputs a Julian date like this
>
> IDL> jd = 2441636.1
>
> and then gets mysterious results because the value of jd is
> "truncated"
>
> IDL> print, jd, f='(f10.2)'
> 2441636.00
>
> So it would it be reasonable to request that the IDL compiler
> recognize a number as double precision, if it has too many digits to
> be stored as a floating point number? After all, IDL does do
> something like this (in default mode) for short and long integers:
>
> IDL> a = 32767 & help,a
> A INT = 32767
> IDL> a = 32768 & help,a
> A LONG = 32768
>
> I can't imagine how adding this capability would break existing code.
>
> Does anyone know if other interpreted languages can recognize a double
> precision number when they encounter one? Thanks, --Wayne
>
Dear Wayne,

although I think that in principle the compiler could be able to make an
automatic type declaration based on the number of digits of the string
representing the numerical value, for the time being it might be easier
to check whether the input is indeed double precision or not. For
instance, I noticed that an earlier version of DAYCONV had the following
line at the beginning

sz = size(xjd)

However the information on the size of the argument xjd was never used.
Perhaps somebody had in mind the following?

if sz[1] ne 5 then message,'DAYCONV requires double precision!'

It would be hard to overlook a statement like this.

with kind regards,

Bringfried Stecklum
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: running my procedure in VM
Next Topic: Re: stippling or cross hatching in contour plot

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

Current Time: Fri Oct 10 04:37:44 PDT 2025

Total time taken to generate the page: 1.11378 seconds