POV-Ray : Newsgroups : povray.beta-test : [std include] wrong odd() behaviour Server Time
29 Jul 2024 18:23:01 EDT (-0400)
  [std include] wrong odd() behaviour (Message 1 to 6 of 6)  
From:
Subject: [std include] wrong odd() behaviour
Date: 5 Mar 2002 02:53:56
Message: <jht88u4immdu5nsrbg3t4ijaqoogsk4ito@4ax.com>
POV 3.5 beta 12

I'm surprized that odd doesn't work properly. I have posted my version of
even/odd pair into
http://news.povray.org/p4hv5ugh4prqd2s2fr7nu0o9vabih5k741%404ax.com month ago
and it works properly for _any_ float not only integers.

My version produces following test output:

1 isn't even.
1 is odd.
1.500000 isn't even.
1.500000 isn't odd.
2 is even.
2 isn't odd.

while version attached to beta 12 produces:

1 isn't even.
1 is odd.
1.500000 isn't even.
1.500000 is odd.
2 is even.
2 isn't odd.

Perhaps I wrongly understand term "odd" but if not I suggest to fix this
behaviour for _any_ float with definition:
#local odd=function(N){even(N+1)};

ABX


Post a reply to this message

From: Christoph Hormann
Subject: Re: [std include] wrong odd() behaviour
Date: 5 Mar 2002 05:18:01
Message: <3C849B34.B303B763@gmx.de>

> 
> POV 3.5 beta 12
> 
> I'm surprized that odd doesn't work properly. I have posted my version of
> even/odd pair into
> http://news.povray.org/p4hv5ugh4prqd2s2fr7nu0o9vabih5k741%404ax.com month ago
> and it works properly for _any_ float not only integers.
> 
> [...]

The different implementation was chosen for speed reason, i'm not sure
what would be the mathematically correct behavior, if yours is better the
'even(N+1)' version for 'odd()' is probably not that much slower.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 21 Feb. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From:
Subject: Re: [std include] wrong odd() behaviour
Date: 5 Mar 2002 05:38:20
Message: <tr798ukv458sqg7ec5rurnr496rve29fr9@4ax.com>
On Tue, 05 Mar 2002 11:17:24 +0100, Christoph Hormann <chr### [at] gmxde>
wrote:
> if yours is better 

if not, then at least documentation should be updated to precise integer type
of parameter

ABX


Post a reply to this message

From:
Subject: Re: [std include] wrong odd() behaviour
Date: 5 Mar 2002 06:25:51
Message: <cma98u0o80svd6849li6mcs7bpb9k9rui4@4ax.com>

wrote:
> 1.500000 isn't odd.

versus

> 1.500000 is odd.

http://mathworld.wolfram.com/OddNumber.html

ABX


Post a reply to this message

From: Christopher James Huff
Subject: Re: [std include] wrong odd() behaviour
Date: 5 Mar 2002 09:40:56
Message: <chrishuff-941617.09405505032002@netplex.aussie.org>
1.5 is neither even nor odd. Only integer numbers can be "even" or "odd".

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From:
Subject: Re: [std include] wrong odd() behaviour
Date: 5 Mar 2002 09:42:54
Message: <e8m98u4t53tvnesc5cj7eehgeeflca8f84@4ax.com>
On Tue, 05 Mar 2002 09:40:56 -0500, Christopher James Huff <chr### [at] maccom>
wrote:
> 1.5 is neither even nor odd. Only integer numbers can be "even" or "odd".

That's what I pointed.

ABX


Post a reply to this message

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