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

Home » Public Forums » archive » Re: decimal numbers
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: decimal numbers [message #70913] Tue, 11 May 2010 16:45
fgg is currently offline  fgg
Messages: 67
Registered: April 2010
Member
> Just use
>
> a=358983d-6
>
> 10^6 overflows integers (16 bit by default):
>
> IDL> print,10^6
>    16960
>
> If you want to use 10^6, use either 1d6, 1e6, or if you want integers,
> some larger integer type, such as 10L^6.
>
> See
>
> http://groups.google.com/group/comp.lang.idl-pvwave/browse_t hread/thr...

Great! Thanks a lot!
Re: decimal numbers [message #70914 is a reply to message #70913] Tue, 11 May 2010 16:30 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On May 11, 8:15 pm, fgg <fabioguimaraesgoncal...@gmail.com> wrote:
> Hello,
>
> If
>
> IDL> a=358983
>
> how can I get a "b" = 0.358983? (that is, b = a/10^6)?... Why do I get
> the weird result below when I change "a" to double and divide it by
> 10^6?
>
> IDL> b=double(a)/10^6
> IDL> print, b
>        21.166450

Just use

a=358983d-6

10^6 overflows integers (16 bit by default):

IDL> print,10^6
16960

If you want to use 10^6, use either 1d6, 1e6, or if you want integers,
some larger integer type, such as 10L^6.

See

http://groups.google.com/group/comp.lang.idl-pvwave/browse_t hread/thread/775f355afcfa0b8a
Re: decimal numbers [message #70915 is a reply to message #70914] Tue, 11 May 2010 16:25 Go to previous message
R.G.Stockwell is currently offline  R.G.Stockwell
Messages: 163
Registered: October 2004
Senior Member
"fgg" <fabioguimaraesgoncalves@gmail.com> wrote in message
news:a43a5251-e8a0-45d2-a283-29388766de37@a2g2000prd.googleg roups.com...
> Hello,
>
> If
>
> IDL> a=358983
>
> how can I get a "b" = 0.358983? (that is, b = a/10^6)?... Why do I get
> the weird result below when I change "a" to double and divide it by
> 10^6?
>
> IDL> b=double(a)/10^6
> IDL> print, b
> 21.166450
>
> Thank you!

try this.

IDL> print,10^6
16960
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: decimal numbers
Next Topic: Re: SST data

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

Current Time: Wed Oct 08 17:05:51 PDT 2025

Total time taken to generate the page: 0.00579 seconds