POV-Ray : Newsgroups : povray.advanced-users : Max-value with function int() : Re: Max-value with function int() Server Time
29 Jul 2024 00:35:58 EDT (-0400)
  Re: Max-value with function int()  
From: Christopher James Huff
Date: 14 May 2003 17:29:50
Message: <cjameshuff-59FA63.17301314052003@netplex.aussie.org>
In article <3ec23a4f@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

>   Rounding would change its behaviour, which might not be good (eg. int(0.6)
> would now give 1 instead of 0).
> 
>   If the different behaviour of floor() with regard to negative values is
> a problem, then the solution is easy: x<0 ? -floor(-x) : floor(x)

You're right, rint() doesn't do what I thought it did. Your expression 
should do the right thing without stomping on the precision. Perhaps 
adding a separate round() or rint() built-in function would be useful as 
well.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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