velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <nat...@esha.com>
Subject Re: DECIMAL POINTS (once more with feeling)
Date Mon, 06 May 2002 17:06:00 GMT
Doug said:
> > lloyd said:
> > > and, actually, i'm thinking the exact same thing:  "you
> > mean i have to
> > > program a special object every time he wants to know if a
> > f*cken number
> > > is zero or not?"
> >
> > #set( $foo = $someFloatingPointNumberIFoundInTheContext )
> > #if( $foo.intValue() == 0 )
> >     look ma! no tool was used!
> > #end
>
> Unless I'm missing something, this only works if the absolute value of
$foo
> is greater than or equal to 1.

Ah.  'tis true.  my mistake.  Well, how's this:

#set( $foo = "$someFloatingPointNumber" )
#if (  $foo == "0.0" )
    look ma! no tool was used!
#end

yeah, i know.  it's not a clean solution.  my point is simply that a tool is
not necessary for the problem described.  i can certainly design situations
where a tool is necessary.  heck, i even designed a tool for those
situations. :-)  i'm fairly ambivalent about the whole floats in velocity
issue.  i can see reasons both for and against.  i get along just fine with
a tool in the few situations i need to use floats in templates, but i have
no strenous objections to adding support for them.

Nathan Bubna
nathan@esha.com


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message