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

Home » Public Forums » archive » Re: BUG in IDL 4.0a PowerMac
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: BUG in IDL 4.0a PowerMac [message #6039 is a reply to message #6038] Fri, 05 April 1996 00:00 Go to previous messageGo to previous message
Tim Patterson is currently offline  Tim Patterson
Messages: 65
Registered: October 1995
Member
Paritosh Dhawale wrote:
>
> 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
>
> Would appreciate any insight.
>
> Paritosh


It may be because FIX truncates rather than rounds
to get an integer, so FIX(4.9) returns 4 and not 5.

So, as an example, if yy is actually 35.0000000001 and
last_row is 89.0000000000, when you subtract
them and then FIX you get FIX( 53.9999999999) which
is 53. If you FIX them first, you get 89 - 53 which
gives 54.

So the answer may differ depending on how accurately
your machine stores float variables. I think this
is a problem in other languages besides IDL. Try
using ROUND instead of FIX, as this rounds to the nearest
integer, and it should solve the problem.

Tim
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: IDL V4 and Windows 95
Next Topic: BUG in IDL 4.0a PowerMac

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

Current Time: Sat Oct 11 06:51:46 PDT 2025

Total time taken to generate the page: 0.48302 seconds