jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Francois Beausoleil" <f...@users.sourceforge.net>
Subject Re: standard-1.0 converts BigDecimal to Long
Date Sat, 27 Dec 2003 19:20:53 GMT
Thanks for the info.  In the mean time, I use c:out to render to text,
and then use that to do my calculations.

Bye !
Francois

On Sat, 27 Dec 2003 12:01:44 -0500, "Matt Pangaro" <mattp@lokitech.com>
said:
> Francois Beausoleil wrote:
> > Hi,
> > 
> > One of my custom tags returns two BigDecimal objects to the page context,
> > in an array.  I would then like to use EL to calculate the difference
> > between the two.  The two objects are a gross amount and a fee amount.  I
> > would like to get the net amount (gross - fee).
> 
> <SNIP />
> 
> > I traced the code manually, and I believe that isFloatingType() should
> > receive a line with "|| pClass == BigDecimal.class", and isIntegerType()
> > should receive "|| pClass == BigInteger.class".
> > 
> > What do you guys think ?  Maybe there is some interaction I am not
> > seeing.  More code would need to change, as the BigDecimal/BigInteger
> > classes use methods instead of the regular arithmetic operators to do
> > their operations.
> > 
> > Should I file a bug, a patch or do something else ?
> 
> This is an issue with the specification. A.3.5.1 (Binary operators - A 
> {+, -, *} B) states:
> "* If A or B is Float, Double, or a String containing ".", "e", or "E", 
> coerce both A and B to Double and apply operator
> * Otherwise coerce both A and B to Long and apply operator"
> 
> Since a BigDecimal Object doesn't meet the criteria for the first case, 
> it's coerced to Long and the operator is applied. BigDecimal and 
> BigInteger (BigDec in particular) have a couple of known issues in the 
> spec. There has been some discussion as to whether this can be addressed 
> with an amended 1.0 spec, but it is addressed (IIRC) in the 2.0 JSP 
> spec, which includes the future of JSTL.
> 
> Matthew Pangaro
> Lokitech >> software . strategy . design
> http://www.lokitech.com
> p. 1.301.656.5504
> m. 1.301.728.6906
> e. mpangaro@lokitech.com
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


Mime
View raw message