|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Is there any way to round a float to the nearest whole number. It may seem
like a stupid question but i have been trying with int() and failing
dismally.
Thanks
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Is there any way to round a float to the nearest whole number.
I'm not sure why there's no round() function, but here, this should work:
#macro round(x)
floor(x+0.5)
#end
(floor() is like int() except that it always rounds towards negative
infinity, whereas int() rounds towards zero. The + 0.5 causes the transition
from one integer to another to occur when x passes by something-and-a-half.)
- Slime
[ http://www.slimeland.com/ ]
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Tue, 22 Jun 2004 14:22:07 -0400, "Slime" <fak### [at] emailaddress> wrote:
> > Is there any way to round a float to the nearest whole number.
>
> I'm not sure why there's no round() function, but here, this should work:
>
> #macro round(x)
> floor(x+0.5)
> #end
IMO
#declare round=function(x){floor(x+0.5)};
would be better.
ABX
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
ABX <abx### [at] abxartpl> wrote:
> IMO
> #declare round=function(x){floor(x+0.5)};
> would be better.
Don't know about better, but at least it's much faster. :)
--
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |