This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Loosing Precision after Transformation


Micheal than you very much for your reply.

cheers
Garvin


>From: "Michael Kay" <michael.h.kay@ntlworld.com>
>Reply-To: xsl-list@lists.mulberrytech.com
>To: <xsl-list@lists.mulberrytech.com>
>Subject: RE: [xsl] Loosing Precision after Transformation
>Date: Thu, 18 Apr 2002 09:49:20 +0100
>
>It's the arithmetic that causes the loss of precision, so you should avoid
>the multiplication. Perhaps you might get the required result with
>
><xsl:value-of select="translate(
>                       format-number(number,'00000.00000'),
>                       '.', '')"/>
>
>Michael Kay
>Software AG
>home: Michael.H.Kay@ntlworld.com
>work: Michael.Kay@softwareag.com
>
> > -----Original Message-----
> > From: owner-xsl-list@lists.mulberrytech.com
> > [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of
> > Garvin Franco
> > Sent: 18 April 2002 05:45
> > To: XSL-List@lists.mulberrytech.com
> > Subject: [xsl] Loosing Precision after Transformation
> >
> >
> > Has anyone had problems loosing precision after transforming
> > a message using
> > Xalan??
> >
> > Problem:
> > I have content stored in an element as follows
> > <aNumber>12345.12345</aNumber>
> >
> > I format the content in this element for output as follows
>
> > note: length 10
> > with 0 padding )
> >
> > <xsl:value-of select="format-number(number*100000,'0000000000')"/>
> >
> > On the ouput I get 1234512344, which is off by .00001. I need
> > the exact
> > value on the source document.  I tried a substring-before and
> > substring-after the the decimal separator '.', then
> > concatenated the total
> > and fractional parts, then formatted as I have shown above,
> > and I got the
> > same thing. I know its loosing precision when the string is
> > changed to a
> > number, but the funny thing is, if a string less than the
> > full length ( 10
> > in this case ) of the field is passed, all is well.
> > Example
> > <number>1234.12345</number> ----> 01234.12345 ( which makes me happy )
> >
> > Does anyone know what approach I can use here to solve this problem?
> >
> > Thanking you in advance
> > Garvin
> >
> > _________________________________________________________________
> > Send and receive Hotmail on your mobile device: http://mobile.msn.com
> >
> >
> >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]