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

Home » Public Forums » archive » Re: MEDIAN and double?
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: MEDIAN and double? [message #30772] Fri, 17 May 2002 19:49 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"Pavel A. Romashkin" <pavel_romashkin@hotmail.com> writes:

> I always thought that MEDIAN in Double is just
>
> print, (the_data[sort(the_data)])[n_elements(the_data)/2]

That works for a single number, but the nice part about MEDIAN is that
it can be applied with a sliding window, as in,

ysmooth = median(y, window)

But, if your data have double precision then YSMOOTH is not always
high enough precision to respect the original data. Or, at least,
mine didn't.

For example, consider:

IDL> print, median(1d + 2.4d-9 + [0,0]) - 1
0.00000

Whoops!

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: sample mean and parametric mean?
Next Topic: Seg. Fault in IDL 5.5 (Linux)

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

Current Time: Wed Oct 08 19:55:37 PDT 2025

Total time taken to generate the page: 0.00198 seconds