The difference here is that 2.5 is a xs:decimal not an xs:float or xs:double according to XQuery http://www.w3.org/TR/xquery/#prod-xquery-DecimalLiteral
Decimal types are different precision from float or double and are not floating point. Neither of which is infinite precision. So math sometimes doesn't produce an exact mathematically correct result. Yes I know that doesn't make the answer any more pleasant ----------------------------------------------------------------------------- David Lee Lead Engineer MarkLogic Corporation [email protected] Phone: +1 812-482-5224 Cell: +1 812-630-7622 www.marklogic.com -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of David Sewell Sent: Wednesday, March 20, 2013 9:36 AM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Simple Math Issue I get the same results as Alex running version 6.0-2.1 under Linux. On Wed, 20 Mar 2013, Geert Josten wrote: > Which version of MarkLogic are you running exactly? I am running 6.0-1.1 on > win7 and get (72, 72, 72) as response.. > > > > Kind regards, > > Geert > > > > *Van:* [email protected] [mailto: > [email protected]] *Namens *Alex Milowski > *Verzonden:* dinsdag 19 maart 2013 23:09 > *Aan:* General Mark Logic Developer Discussion > *Onderwerp:* [MarkLogic Dev General] Simple Math Issue > > > > In my Mathematical mind, the following expression: > > > > (180 div 2.5, 180 div xs:float(2.5), 180 div xs:double(2.5)) > > > > should yeild: > > > > (72, 72, 72) > > > > as the correct answer, mathematically speaking, is 72. > > > > MarkLogic 6 seems to think it is: > > > > (71.99999999999999601, 72, 72) > > > > which leads me to believe this is a xs:decimal issue. > > > > > -- David Sewell, Editorial and Technical Manager ROTUNDA, The University of Virginia Press PO Box 400314, Charlottesville, VA 22904-4314 USA Email: [email protected] Tel: +1 434 924 9973 Web: http://rotunda.upress.virginia.edu/ _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
