[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Saxon Div Issue


Subject: Re: [xsl] Saxon Div Issue
From: "G. Ken Holman g.ken.holman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 19 Jan 2015 16:27:32 -0000

Dak, in the response below you are misunderstanding our use of the terminology. We are talking about the representation of the number internally in memory, we are not talking about whether the element or the attribute is a number or not a number. We are not talking about radix. We are talking about internal representation.

As Martin says, the numeric value of an element or an attribute is represented in memory as a double-length binary value unless you tell it differently. If you are using XSLT 2.0 you can tell the processor to treat it differently in memory by casting the element or attribute value into a decimal representation internally.

Then, when you do arithmetic with decimal representations of values, the result is a clean decimal result. There is no loss of detail as when happens when
using binary.


So, in your pseudo code below, you do know that it will be a double-length binary value because you have not cast it to be anything else. Radix has nothing to do with this discussion.

I hope this helps.

. . . . . Ken

At 2015-01-19 16:06 +0000, Mailing Lists Mail daktapaal@xxxxxxxxx wrote:
>I wouldn't know if it will be a double that I will be a decimal.
Ignore the above inebriated statement.. All I meant was, I wouldnt
know if it will be a decimal.


On Mon, Jan 19, 2015 at 11:03 AM, Mailing Lists Mail daktapaal@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > THe problem is , I dont know what will come in the $num. It is an > xpath. It comes from an XML element. > > SO sometimes, the element contains 988, and sometimes it contains 98.8 > .. so my pseudo code actually is :" > > $num = /xpath/num > var result = $num div 100 > > I wouldn't know if it will be a double that I will be a decimal. > > Dak



-- Check our site for free XML, XSLT, XSL-FO and UBL developer resources | Free 5-hour lecture: http://www.CraneSoftwrights.com/links/video.htm | Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ | G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx | Google+ profile: http://plus.google.com/+GKenHolman-Crane/about | Legal business disclaimers: http://www.CraneSoftwrights.com/legal |


--- This email has been checked for viruses by Avast antivirus software. http://www.avast.com


Current Thread
Keywords