Hi, I put all the number patches together and installed it on our dev server so my colleagues could try out the new system. They were excited.
One comment I got back was that percentages should work: #if($Value.Result == 75%) Although not standard Java syntax, many numerical programs (such as Excel, our own simulation language, and even a hand calculator) accept a percentage as part of a number. Anyone mind if I add this to the floating point literal spec? There's a bit of a conflict with the modulo operator. However, the unary negative "-" is implemented as part of the literal, despite the conflict with the subtract operator "-" so I see this as similar. WILL ----- Original Message ----- From: "Will Glass-Husain" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, June 27, 2003 3:41 PM Subject: Re: Velocity Numerics: Floating Point Literals > Hi, > > Here's some code that implements floating point literals. It's getting > confusing; patches on top of patches. So I just captured the relevant files > verbatim and zipped them up. Peter, I assume you're integrating all this. > If you'd like a patch, let me know. > > Download the patch from: > http://www.forio.com/velocity/floatingpointcode.zip > (the mailer rejected it as too big). > > To install, > > -- install Peter's numerics patch > http://www.mail-archive.com/[EMAIL PROTECTED]/msg06642.html > > -- delete the file ASTNumberLiteral.java > -- copy in the source files > -- copy in the tests > > If you run "ant test" and "ant jar" everything should work. See the test > template "math.vm" for more details on capabilities > > A couple of quick notes on implementation: > * I had to separate out integers from floating points, as integers can be > used in ranges (but not floating points). > > * Integers are returned as type Integer, Long, or BigInteger. (the minimum > size possible). So you can now use those gigavalues with confidence! > > * Floating points are returned as type Double or BigDecimal. > > * All the following are legit floating point values > 4.5 > 4. > .4 > 4e-3 > 4e+3 > 4e3 > > Let me know if there are any comments. > > WILL > > P.S. Thanks to John Allison for the regular expressions. I had a little > more work with look aheads and disambiguation, but that was a good start. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
