Re: BUG in IDL 4.0a PowerMac [message #6038] |
Fri, 05 April 1996 00:00  |
rivers
Messages: 228 Registered: March 1991
|
Senior Member |
|
|
In article <4k3mro$72p@newsreader.wustl.edu>, Paritosh Dhawale <paritosh> writes:
> Hello,
>
> I get this dangerous bug rather randomly running
> IDL 4.0a on a PowerMac 7500. Any one with similar
> problems? IDL fails to return the correct answer
> in statement 4.
>
> IDL> help,yy
> YY FLOAT = 35.0000
> IDL> help,last_row
> LAST_ROW FLOAT = 89.0000
> IDL> print,last_row-yy
> 54.0000
> IDL> print,fix(last_row-yy)
> 53
> IDL> print,fix(last_row)-fix(yy)
> 54
You have really not provided sufficient information. If you created YY and
LAST_ROW by direct assignment, i.e.
YY = 35.0
LAST_ROW = 89.0
then I agree that there is a bug. All machines which I know of represent small
floating point integers exactly, and there should be no roundoff error on
subtraction. However, if YY or LAST_ROW are computed, then they might be
slightly different than the values they appear to have, and you are just seeing
normal roundoff problems. Whenever you are trying to convert a float which
might have some slight roundoff error to an integer like this you should use a
function which returns the nearest integer, not the integer value after
discarding fractional parts.
____________________________________________________________
Mark Rivers (312) 702-2279 (office)
CARS (312) 702-9951 (secretary)
Univ. of Chicago (312) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars3.uchicago.edu (Internet)
|
|
|