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

Home » Public Forums » archive » Bug in IDL or, may be in my head ?
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
Bug in IDL or, may be in my head ? [message #88645] Fri, 23 May 2014 01:01 Go to next message
franciscoaiglesias is currently offline  franciscoaiglesias
Messages: 2
Registered: May 2014
Junior Member
Hi all,

Any clue what's going on here ?

a = randomn(seed, 248, 256, 9972) * 100. + 4.e3

print, total(a) ; gives 1.42030e+12
print, total(a, /double) ;gives 2.5324144e+12
print, total(total(total(a, 1),1));gives 2.53250e+12

Thanks !
Re: Bug in IDL or, may be in my head ? [message #88650 is a reply to message #88645] Fri, 23 May 2014 15:39 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 5/23/14, 2:01 AM, franciscoaiglesias@gmail.com wrote:
> Hi all,
>
> Any clue what's going on here ?
>
> a = randomn(seed, 248, 256, 9972) * 100. + 4.e3
>
> print, total(a) ; gives 1.42030e+12
> print, total(a, /double) ;gives 2.5324144e+12
> print, total(total(total(a, 1),1));gives 2.53250e+12
>
> Thanks !
>

Check out Kahan summation:

http://en.wikipedia.org/wiki/Kahan_summation_algorithm

I have an implementation in mglib:

IDL> print, mg_total(a)
% Loaded DLM: MG_ANALYSIS.
2.53241e+12

Get mglib at:

github.com/mgalloy/mglib

-Mike
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Another version of "The sky is falling" problem ??
Next Topic: Having READ ingest the input without waiting for return key to be hit?

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

Current Time: Wed Oct 08 11:45:31 PDT 2025

Total time taken to generate the page: 0.00532 seconds