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]

Reply via email to