![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
alphaQuad wrote:
> didnt read it.
read what?
> I've seen less complex functions work and not work neagtive-wise,
> depending on the sytem. handle negs, int() instead of floor() in POV should
> solve the neg issue
There is no "neg issue". People have different expectation on what e.g.
floor() should do for negative numbers. It is more or less arbitrary,
but it has to be defined. I agree that round() could be added as a
function in POV4. Preferably not as a macro. Macro's tend to be written
again and again. That is a waste of time and possibly dangerous as well
if someone implements it subtly different from somebody else.
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) |
andrel <a_l### [at] hotmail com> wrote:
> People have different expectation on what e.g.
> floor() should do for negative numbers.
AFAIK the floor() function is universally defined to round downwards,
as the name implies. In other words, the return value is always smaller
or equal to the parameter.
> I agree that round() could be added as a function in POV4.
Why? floor(value+.5) does the same thing.
--
- Warp
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) |
Warp wrote:
> andrel <a_l### [at] hotmail com> wrote:
>> People have different expectation on what e.g.
>> floor() should do for negative numbers.
>
> AFAIK the floor() function is universally defined to round downwards,
> as the name implies. In other words, the return value is always smaller
> or equal to the parameter.
yes (except perhaps on very old equipment that had a sign bit and not
2s-complement), but that does not stop people from expecting that
floor(-x+.5)==-floor(x+.5) everywhere.
I was talking about expectations not definitions. (ok, 'would' in stead
of 'should' would (should?) have been better)
>
>> I agree that round() could be added as a function in POV4.
>
> Why? floor(value+.5) does the same thing.
>
no it doesn't, that was the whole point. In some cases people want a
function that round halves away from zero. round(-3.5)=-4
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) |
andrel <a_l### [at] hotmail com> wrote:
> > Why? floor(value+.5) does the same thing.
> >
> no it doesn't, that was the whole point. In some cases people want a
> function that round halves away from zero. round(-3.5)=-4
Why would anyone want to round halves away from zero? And if someone
*really* wants that, he can make his own function which does that. The
rest can use either floor(value+.5) or ceil(value-.5), whichever they
prefer.
--
- Warp
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) |
andrel nous illumina en ce 2008-06-29 18:32 -->
> yes (except perhaps on very old equipment that had a sign bit and not
> 2s-complement), but that does not stop people from expecting that
> floor(-x+.5)==-floor(x+.5) everywhere.
That expectation come from the fact that many peoples considere 0 to be smaler
than -1, whitch is false. Many peoples have the tendency of ignoring the sign
when quickly comparing values, only concidering the absolute value instead of
the real one.
--
Alain
-------------------------------------------------
A short cut is the longest distance between two points.
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) |
Alain wrote:
> andrel nous illumina en ce 2008-06-29 18:32 -->
>
>> yes (except perhaps on very old equipment that had a sign bit and not
>> 2s-complement), but that does not stop people from expecting that
>> floor(-x+.5)==-floor(x+.5) everywhere.
>
> That expectation come from the fact that many peoples considere 0 to be
> smaler than -1, whitch is false. Many peoples have the tendency of
> ignoring the sign when quickly comparing values, only concidering the
> absolute value instead of the real one.
>
I don't think so. Anyway, this example did not express what I meant :(
BTW one reason for thinking that there may be a reason why people expect
round(-3.5) to be -4 is that Matlab thinks so too.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |