Re: format-number incorrectly formatting number (fop 0.91beta)
Jeremias Maerki wrote: Right, not a FOP problem, but on the other side, XSL-FO also uses Java's DecimalFormat notation for formatting page numbers. Fortunately, we don't have page numbers that large. :-) Anyway, looks like Java has a problem with these numbers. Xalan probably simply uses the DecimalFormat and relies on Java to do everything right. Look at this: public class DecimalFormatTest extends TestCase { public void testDecimalFormat() throws Exception { DecimalFormat df = new DecimalFormat("###,###.00;###,###.00CR"); //These check out ok: assertEquals("456,787.00CR", df.format(-456787.00)); assertEquals("890,123,456,787.00CR", df.format(-890123456787.00)); assertEquals("7,890,123,456,787.00CR", df.format(-7890123456787.00)); assertEquals("67,890,123,456,787.00CR", df.format(-67890123456787.00)); assertEquals("567,890,123,456,787.00CR", df.format(-567890123456787.00)); assertEquals("4,567,890,123,456,787.00CR", df.format(-4567890123456787.00)); assertEquals("34,567,890,123,456,788.00CR", df.format(-34567890123456788.00)); //The two next checks fail: assertEquals("34,567,890,123,456,786.00CR", df.format(-34567890123456786.00)); assertEquals("34,567,890,123,456,787.00CR", df.format(-34567890123456787.00)); } } To me it looks like Java's double datatype has trouble keeping up with precision with these large numbers. It's a problem with the limit of the precision of doubles, methinks. OP, if you need this level of precision, you can either use java.math.BigDecimal, if you really insist on courting trouble, or do what everyone *should* do with currency - represent it as a long in the smallest unit of the currency; in this case, one hundredth of a rupiah, whatever that is. Using floating point numbers to represent currency is fairly common, but nonetheless ridiculous for being common. Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: format-number incorrectly formatting number (fop 0.91beta)
Right, not a FOP problem, but on the other side, XSL-FO also uses Java's DecimalFormat notation for formatting page numbers. Fortunately, we don't have page numbers that large. :-) Anyway, looks like Java has a problem with these numbers. Xalan probably simply uses the DecimalFormat and relies on Java to do everything right. Look at this: public class DecimalFormatTest extends TestCase { public void testDecimalFormat() throws Exception { DecimalFormat df = new DecimalFormat("###,###.00;###,###.00CR"); //These check out ok: assertEquals("456,787.00CR", df.format(-456787.00)); assertEquals("890,123,456,787.00CR", df.format(-890123456787.00)); assertEquals("7,890,123,456,787.00CR", df.format(-7890123456787.00)); assertEquals("67,890,123,456,787.00CR", df.format(-67890123456787.00)); assertEquals("567,890,123,456,787.00CR", df.format(-567890123456787.00)); assertEquals("4,567,890,123,456,787.00CR", df.format(-4567890123456787.00)); assertEquals("34,567,890,123,456,788.00CR", df.format(-34567890123456788.00)); //The two next checks fail: assertEquals("34,567,890,123,456,786.00CR", df.format(-34567890123456786.00)); assertEquals("34,567,890,123,456,787.00CR", df.format(-34567890123456787.00)); } } To me it looks like Java's double datatype has trouble keeping up with precision with these large numbers. On 18.04.2006 11:02:37 Florent Georges wrote: > Ian & Chris wrote: > > > I am currently trying to format a large number (19v2) in a > > report, the format-number function seems to do incorrect > > formatting when it deals with large numbers, and an example > > follows: > > > > > This is not related to FOP, but to your XSLT processor. I suggest > you to post either to the XSL List (fron Mulberrytech) or to the list > of your XSLT processor. Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: format-number incorrectly formatting number (fop 0.91beta)
Ian & Chris wrote: > I am currently trying to format a large number (19v2) in a > report, the format-number function seems to do incorrect > formatting when it deals with large numbers, and an example > follows: > This is not related to FOP, but to your XSLT processor. I suggest you to post either to the XSL List (fron Mulberrytech) or to the list of your XSLT processor. Regards, --drkm ___ Faites de Yahoo! votre page d'accueil sur le web pour retrouver directement vos services préférés : vérifiez vos nouveaux mails, lancez vos recherches et suivez l'actualité en temps réel. Rendez-vous sur http://fr.yahoo.com/set - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]