![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Warp
Subject: Re: Why & has higher precedence than + or - in isosurface functions?
Date: 2 Aug 2000 11:12:16
Message: <39883a4f@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
pk <thi### [at] videotron ca> wrote:
: You've never made any programmation before, have you?
I have been programming for about 10 years.
: In most programming languages, they assign a value to TRUE, and another
: to FALSE(in the case above, FALSE=0, and TRUE=NOT(FALSE) )
: In other languages, fe, C(for which i dont't really remember the
: standard), it's something like TRUE = -1 (binary 11111111) and FALSE
: would be 0(binary 00000000)...
Nope. In C a true value is 1 (for example the result of the sentence a==b
is 1 if a is equal to b, else 0). When testing a conditional, any value
other than 0 is considered true, and 0 is considered false.
In this context (0.5 AND -2.8) would be true because none of them is 0.
This, however, has no mathematical meaning whatsoever. It hasn't any meaning
in isosurface functions either (what would a 'true' or 'false' value mean
in a function, may I ask?).
: And, for your trivia, it depends: most languages will do logical
: operations bit by bit, but i suppose that others have a Boolean
: type(Java, fe i think), and will undercast it before doing the
: LOGICAL_AND
The point is that the & operator in isosurface functions is not even close
to the logical AND-operator of programming languages.
: And, yes, doing Logical operations bit by bit can be useful, and anyway,
: you can just add a comparison operator before doing the boolean
: operation...
Firstly, there's no bitwise AND-operator anywhere in the povray language,
and secondly, the &-operator in isosurface functions is neither a logical
nor a bitwise AND-operator.
It would make no sense in having a logical operator in a function anyways.
Which function is 'true' or 'false'? How do you draw the function { true } ?
(No, I'm not talking about the povray keyword 'true' here.)
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Dick Balaska
Subject: Re: Why & has higher precedence than + or - in isosurface functions?
Date: 2 Aug 2000 11:51:38
Message: <39884355.DCB5F320@buckosoft.com>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Warp wrote:
> Nope. In C a true value is 1 (for example the result of the sentence a==b
> is 1 if a is equal to b, else 0). When testing a conditional, any value
> other than 0 is considered true, and 0 is considered false.
Your definition is wrong, but your example is correct. :)
False is 0. True is not false.
1 is a true value, as is 2, as is -1.
I have seen #define TRUE 1
I have also seen #define TRUE ~FALSE
dik
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Whoa! sorry! 8)
Warp wrote:
> Nope. In C a true value is 1 (for example the result of the sentence a==b
> is 1 if a is equal to b, else 0). When testing a conditional, any value
> other than 0 is considered true, and 0 is considered false.
Well, I said i wasn't sure... -1 and 0 must be for Basic, then...
> In this context (0.5 AND -2.8) would be true because none of them is 0.
> This, however, has no mathematical meaning whatsoever. It hasn't any meaning
> in isosurface functions either (what would a 'true' or 'false' value mean
> in a function, may I ask?).
TRUE and FALSE having been declared before as constants, TRUE and FLASE
will have values...
> It would make no sense in having a logical operator in a function anyways.
> Which function is 'true' or 'false'? How do you draw the function { true } ?
> (No, I'm not talking about the povray keyword 'true' here.)
What do you mean? Isosurfaces are booleans for me: at location <x, y,
z>, there's a point(true, or 1), or there isn't any(false or 0)... So,
you have a function that draw a plane, and another one that draws a
sphere...
You AND them... the result? a circle... You & them... the result? a
circle...
In theory, it might not be the same, but let's ask the person who did
the patch about it...
Anyway, it's getting pretty hot in this thread...
I'm sorry if i offended you by assuming you had no programming
background... it just sounded like you only saw it from the
mathematician pt of view...
Paul
--
AKA paul_virak_khuong at yahoo.com, pkhuong at deja.com, pkhuong at
crosswinds.net and pkhuong at technologist.com(list not complete)...
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Wed, 02 Aug 2000 11:50:45 -0400, Dick Balaska wrote:
>Warp wrote:
>
>> Nope. In C a true value is 1 (for example the result of the sentence a==b
>> is 1 if a is equal to b, else 0). When testing a conditional, any value
>> other than 0 is considered true, and 0 is considered false.
>
>Your definition is wrong, but your example is correct. :)
>
>False is 0. True is not false.
>1 is a true value, as is 2, as is -1.
>
>I have seen #define TRUE 1
>I have also seen #define TRUE ~FALSE
I prefer #define TRUE (1==1) and #define FALSE (1==0)
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Wed, 02 Aug 2000 11:58:08 -0400, pk wrote:
>What do you mean? Isosurfaces are booleans for me: at location <x, y,
>z>, there's a point(true, or 1), or there isn't any(false or 0)... So,
>you have a function that draw a plane, and another one that draws a
>sphere...
More specifically, a point is either inside or outside the isosurface.
>You AND them... the result? a circle... You & them... the result? a
>circle...
>In theory, it might not be the same, but let's ask the person who did
>the patch about it...
Well, in the code, the function that performs that operation is called
"and," but it doesn't use a logical operator to do what it does (it uses
min or max) Personally, I always think of intersection/union as and/or
anyway, preferring to use CS methods to decompose complex CSG operations.
They're pretty interchangeable at this level, but it's not a mistake
you'd want to make in a higher-level math or CS course.
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Thorsten Froehlich
Subject: Re: Why & has higher precedence than + or - in isosurface functions?
Date: 2 Aug 2000 14:32:53
Message: <39886955@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <39884355.DCB5F320@buckosoft.com> , Dick Balaska
<dic### [at] buckosoft com> wrote:
>> Nope. In C a true value is 1 (for example the result of the sentence a==b
>> is 1 if a is equal to b, else 0). When testing a conditional, any value
>> other than 0 is considered true, and 0 is considered false.
>
> Your definition is wrong, but your example is correct. :)
>
> False is 0. True is not false.
> 1 is a true value, as is 2, as is -1.
>
> I have seen #define TRUE 1
> I have also seen #define TRUE ~FALSE
In C++ he would be nearly right :-) Except that there is no definition of
the internal representation of the type "bool" which is left to the
compiler/platform (i.e. some RISC platforms like PowerPC have several
condition-code registers and instructions to work with them).
Only conversions from and to "bool" are defined in C++, and in case of the
conversion of bool to anything, true will be "1".
Thorsten
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trf de
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 2 Aug 2000 11:12:16 -0400, Warp <war### [at] tag povray org> wrote:
> Nope. In C a true value is 1 (for example the result of the sentence a==b
>is 1 if a is equal to b, else 0). When testing a conditional, any value
>other than 0 is considered true, and 0 is considered false.
Why am I thinking that this issue has not been standardised yet?
Because I am wrong again? :)
> The point is that the & operator in isosurface functions is not even close
>to the logical AND-operator of programming languages.
Ah, so *that* is the point I've been missing all this time!
Can I have a sign?
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] usa net
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Peter Popov wrote:
> Ah, so *that* is the point I've been missing all this time!
>
> Can I have a sign?
Ron Popov, please give Peter Parker a sign.
--
Ken Tyler - 1400+ POV-Ray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Wed, 02 Aug 2000 15:08:02 -0700, Ken wrote:
>Ron Popov, please give Peter Parker a sign.
He has one. It has that cool spider on it.
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Mark Gordon
Subject: Re: Why & has higher precedence than + or - in isosurface functions?
Date: 3 Aug 2000 20:22:50
Message: <398A0D84.245410EE@mailbag.com>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
pk wrote:
> In most programming languages, they assign a value to TRUE, and another
> to FALSE(in the case above, FALSE=0, and TRUE=NOT(FALSE) )
> In other languages, fe, C(for which i dont't really remember the
> standard), it's something like TRUE = -1 (binary 11111111) and FALSE
> would be 0(binary 00000000)...
And then there are the Unix shells...
$ true
$ echo $?
0
$ false
$ echo $?
1
Just to keep everyone confused. ;-)
-Mark Gordon
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |