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

Home » Public Forums » archive » Yet another bug??
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Yet another bug?? [message #4290] Wed, 17 May 1995 00:00 Go to next message
phil is currently offline  phil
Messages: 15
Registered: April 1995
Junior Member
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
/*********************************************************** ****************/
Re: Yet another bug?? [message #4395 is a reply to message #4290] Wed, 24 May 1995 00:00 Go to previous message
sjt is currently offline  sjt
Messages: 72
Registered: November 1993
Member
Phil (phil@peace.med.ohio-state.edu) wrote:
: 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.

The answers are perfectly correct 0 is in hex 0000 and so (not 0) is ffff
which is -1, and not 1 will be fffe or -2. It's a bitwise operation,
often useful but occasionally infuriating (e.g. if you want to use the
negation of something you've just calculated as a value of a set/unset
keyword) if you want the logical operation then you should and the entire
expression with 1
e.g.

IDL>print, (not 0) and 1
1
IDL>print, (not 1) and 1
0


: --
: /*********************************************************** ****************/
: 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
: /*********************************************************** ****************/

--
+------------------------+---------------------------------- --+---------+
| James Tappin, | School of Physics & Space Research | O__ |
| sjt@star.sr.bham.ac.uk | University of Birmingham | -- \/` |
| Ph: 0121-414-6462. Fax: 0121-414-3722 | |
+----------------------------------------------------------- --+---------+
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Multidimensional curve fitting
Next Topic: Would it be so bad for RSI and VNI to respond to the newsgroup?

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

Current Time: Wed Oct 08 19:16:47 PDT 2025

Total time taken to generate the page: 0.00529 seconds