POV-Ray : Newsgroups : povray.newusers : rounding : Re: rounding Server Time
28 Jul 2024 22:16:13 EDT (-0400)
  Re: rounding  
From: andrel
Date: 29 Jun 2008 18:31:28
Message: <48680D75.9030509@hotmail.com>
Warp wrote:
> andrel <a_l### [at] hotmailcom> 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

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