Turtleflight BBS

Software for Active Worlds
It is currently Wed Sep 08, 2010 12:13 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: @ceiling and @floor functions
PostPosted: Sat Jan 31, 2009 7:04 am 
Offline

Joined: Thu Mar 06, 2008 11:04 pm
Posts: 3
My big wish at the moment is for the addition of @ceiling and @floor functions.

For those who don't know what these are:

@ceiling rounds up to the nearest whole integer and @floor rounds down to the nearest whole number.

Examples:

@ceiling[12.4] would return 13
@floor[91.56] would return 91


Top
 Profile  
 
 Post subject: Re: @ceiling and @floor functions
PostPosted: Tue Feb 03, 2009 9:17 am 
Offline
Site Admin

Joined: Fri Jan 24, 2003 9:30 pm
Posts: 371
Location: far out there
You could write macros for these in the userdefs.udf file.

Consider the existing @frac and @round macros:

@frac[@]=~1-@int[~1]
@round[@]=@int[~1]+(@frac[~1]>=.5)


So you could add your own:

@ceiling[@]=@int[~1]+(@frac[~1]<>0)

Actually the @int function already does what the @floor function does by just removing the fractional part.

@floor[@]=@int[~1]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group