POV-Ray : Newsgroups : povray.beta-test : Are '&' and '|' switched? Server Time
4 Nov 2024 21:25:43 EST (-0500)
  Are '&' and '|' switched? (Message 1 to 3 of 3)  
From: ingo
Subject: Are '&' and '|' switched?
Date: 26 Sep 2001 09:52:39
Message: <Xns9128A184570B3seed7@povray.org>
Expected the outcome of the scene below to be te other way around.

---%<------%<---
#declare F=function(a){a>-1 | a<1}  //returns  0 0 1 0 0
                                    //expected 1 1 1 1 1

//#declare F=function(a){a>-1 & a<1}  //returns 1 1 1 1 1
                                    //expected 0 0 1 0 0

#debug concat(str(F(-2), 2, 0), "\n")
#debug concat(str(F(-1), 2, 0), "\n")
#debug concat(str(F( 0), 2, 0), "\n")
#debug concat(str(F( 1), 2, 0), "\n")
#debug concat(str(F( 2), 2, 0), "\n\n")
---%<------%<---

PII 233 192MB NT4 SP6 POV-Ray-beta.4

Ingo

-- 
Photography: http://members.home.nl/ingoogni/
Pov-Ray    : http://members.home.nl/seed7/


Post a reply to this message

From: ingo
Subject: Re: Are '&' and '|' switched?
Date: 26 Sep 2001 10:13:48
Message: <Xns9128A519E6F15seed7@povray.org>
in news:Xns### [at] povrayorg ingo wrote:

> Expected the outcome of the scene below to be te other way around.
> 

Also '<=' does not seem to behave as one would expect.

                                           //a=  -2 -1  0  1  1
                                           //------------------
//#declare F=function(a){a>=0}       //returns    0  0  1  1  1

  #declare F=function(a){a<=0}       //returns    1  1  0  0  0 
                                     //expected   1  1  1  0  0


Ingo

-- 
Photography: http://members.home.nl/ingoogni/
Pov-Ray    : http://members.home.nl/seed7/


Post a reply to this message

From: Francois Labreque
Subject: Re: Are '&' and '|' switched?
Date: 26 Sep 2001 17:03:34
Message: <3BB2426F.8060805@videotron.ca>
ingo wrote:

> Expected the outcome of the scene below to be te other way around.
> 
> ---%<------%<---
> #declare F=function(a){a>-1 | a<1}  //returns  0 0 1 0 0
>                                     //expected 1 1 1 1 1
> 
> //#declare F=function(a){a>-1 & a<1}  //returns 1 1 1 1 1
>                                     //expected 0 0 1 0 0

Confirmed.

Athlon 650MHz. Win98 2nd Ed.  PoV 3.5.beta4

-- 
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/*    flabreque    */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/*        @        */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/*   videotron.ca  */}camera{location<6,1.25,-6>look_at a orthographic}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.