Re: ?floor ?round ?ceiling in 2.3 and 2.4 now:[WAS Re: weird macro params issue]
"Klotz, Leigh" <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <E254B0A7E0268949ABFE5EA97B7D0CF404CD97A8@USA7061MS01.na.xerox.net> |
Daniel,
Thank you! Here are some replies inline:
> I think they rather should be under the numerical built-ins, because
at least ?round is not something that I feel to be an expert stuff.
I'm happy to have left that decision to you.
> Ceiling and floor is certainly a bit esoteric, but whatever... expert
stuff rather meant to be stuff for IT/programming "experts", like ?byte
or even ?interpret. So I have moved these over.
The request for ceiling came from a UI designer, not a programmer.
Here's the use case for ceiling and floor. Round was there just because
it's part of the set. Here's some quickly-typed code that shows how
they're used, so you can see why ?round isn't correct for either case:
<#assign pageCount=(itemCount / itemsPerPage)?ceiling />
<#assign pageNumber=(itemNumber-1 / itemsPerPage)?floor />
<p>Page ${pageNumber} of ${pageCount} | <a
href="view?itemNumber=${itemNumber+itemsPerPage}">${pageNumber}</a></p>
While it's generally considered cheaper to use the floor version of
divide, the savings would be in the noise in FM.
> > I couldn't find the documentation for the 2.4 but maybe I overlooked
> > it. docgen is there, but there is no content.
>
> It has a lot of content; something went wrong on your side. BUT, don't
suffer with that... I will forward port it, with the other changes I
made.
I see now with the svn update that in the svn head the documentation is
all in one big XML file whereas in the 2.3 branch it's in multiple
files.
>
> I wonder why is this called ?ceiling instead of ?ceil, when the other
one is ?floor, not ?flooring.
Being born in an English speaking country has its advantages and its
disadvantages. One of the disadvantages is that I can't tell you why
it's ceiling and floor. "ceil" just isn't a word. If you're in a room,
the room has a ceiling and a floor, not a ceiling and a flooring.
I can't tell you why. (I don't speak Hungarian, but I do speak
Japanese...)
Mathematica sensibly calls their function "ceiling":
http://mathworld.wolfram.com/CeilingFunction.html
You may be alluding to Java, which calls it "ceil":
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Math.html#ceil(double)
I think the Java version dates from a time when they liked abbreviations
(cf. pow, rint).
Leigh.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone