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

Home » Public Forums » archive » Re: Yet another bug??
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: Yet another bug?? [message #4253] Fri, 19 May 1995 00:00 Go to previous message
lmudge is currently offline  lmudge
Messages: 9
Registered: October 1994
Junior Member
In article 95May17132737@peace.med.ohio-state.edu, phil@peace.med.ohio-state.edu (Phil) writes:
> Sorry to keep posting but I've just started developing some useful
> tools in IDL and it seems I run across a new 'bug' every day. Could
> someone tell me the sense behind the following:
>
> IDL> print, not 0
> -1
> IDL> print, not 1
> -2
>
> Shouldn't (not 0) = 1 and (not 1) = 0 or am i just missing something?
> Is there somehting in the manuals that describes this logic?
>
> Just wondering.
>
>
> --
> /*********************************************************** ****************/
> Phil Williams
> Postdoctoral Researcher "One man gathers what
> MRI Facility another man spills..."
> The Ohio State University -The Grateful Dead
> email: phil@peace.med.ohio-state.edu
> URL: http://justice.med.ohio-state.edu:1525
> /*********************************************************** ****************/

One must thing in binary terms to understand what is happening here.
Integer variables in IDL uses twos complement binary arithmetic thus the
binary representation of 0 is 0000000000000001. When we perform a not on this
we get 1111111111111110 which is the twos complement representation for -1.
Try doing this:

not float(1)

and

not float(2)

and see what you get.

Regards,

Leith Mudge

------------------------------------------------------------ --------------------
Leith Mudge
lmudge@awadi.com.au
AWA Defence Industries
PO Box 161
Elizabeth SA 5112
Australia
Phone: +61 8 256 0952
Fax: +61 8 255 9117

Microsoft Network is prohibited from redistributing this work in any form,
in whole or in part. Copyright, Leith Mudge, 1995
License to distribute this post is available to Microsoft for $1000.
Posting without permission constitutes an agreement to these terms.
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Delay in printing to screen
Next Topic: Delay in printing to screen

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

Current Time: Wed Oct 08 17:27:16 PDT 2025

Total time taken to generate the page: 0.00389 seconds