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

Home » Public Forums » archive » Re: Patch to userlib/deriv.pro to add MAX_VALUE keyword
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: Patch to userlib/deriv.pro to add MAX_VALUE keyword [message #1553] Mon, 27 December 1993 15:23 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
schmitt@ccfsun.nrl.navy.mil (Andrew Schmitt) writes:

> This is somewhat besides the point of the original posting, but it has to do
> with a (granted, nitpicking) bug in the userlib routine deriv.pro.
> You might as well fix it when you make the posted patch.

> Basically, here's a use of "float(...)" in deriv.pro that is unneeded,
> and makes the resulting answer wrong and/or inaccurate if any other type
> of data (complex, double, ...&c) is passed as the Y value.
> The unneeded usage of float occurs about here:

>> d = float(shift(y,-1) - shift(y,1))/(shift(x,-1) - shift(x,1))
> ^^^^^
> remove the "float", and the applicability of the routine improves.

Not having looked at the original source code, I'm not sure if this is the
case, but one can imagine that problems could occur if the call to FLOAT is
removed and SHIFT is one of the integer types. Another way to get around this,
without leading to errors if SHIFT is double-precision or complex, is to insert
a multiplication by 1.0 somewhere, e.g.

d = (1.0*shift(y,-1) - shift(y,1))/(shift(x,-1) - shift(x,1))

Of course, this does lead to some inefficiencies.

Bill Thompson
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: FORTRAN Sbrs. to Read .xdr Formatted Files?
Next Topic: JHU/APL IDL library update notice

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

Current Time: Fri Oct 10 05:05:22 PDT 2025

Total time taken to generate the page: 0.32406 seconds