It looks like if the last digit in the pad is a zero it is dropped:

Note:I added another zero in the number

Examples:
fn:format-number(43.702402, "#,##0.000")
=> 43.702

fn:format-number(43.702402, "#,##0.0000")
=> 43.7024

fn:format-number(43.702402, "#,##0.00000")
=> 43.7024

fn:format-number(43.702402, "#,##0.000000")
=> 43.702402



> From: d...@epocrates.com
> To: general@developer.marklogic.com
> Date: Fri, 2 Sep 2011 19:49:01 +0000
> Subject: Re: [MarkLogic Dev General] fn:format-number with fixed trailing 0's 
> padded
> 
> Will do.
> Unfortunately the spec documents are so complicated I cant tell for  *sure* 
> whats supposed to happen.\
> Or maybe its my caveman brain :)
> 
> 
> ----------------------------------------
> David A. Lee
> Senior Principal Software Engineer
> Epocrates, Inc.
> d...@epocrates.com
> 812-482-5224
> 
> 
> -----Original Message-----
> From: general-boun...@developer.marklogic.com 
> [mailto:general-boun...@developer.marklogic.com] On Behalf Of John Snelson
> Sent: Friday, September 02, 2011 3:46 PM
> To: General MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] fn:format-number with fixed trailing 0's 
> padded
> 
> Yes, me too. I think there's a bug in there somewhere. Can you get in contact 
> with support about this?
> 
> John
> 
> On 2 Sep 2011, at 20:04, Lee, David wrote:
> 
> > Try this in ML ... I dont get it but I'm sure its burried in the rules 
> > somewhere
> > 
> > 
> > fn:format-number(43.70242, "#,##0.00")
> > 
> > I get
> > 
> > 43.7
> > 
> > 
> > 
> > 
> > ----------------------------------------
> > David A. Lee
> > Senior Principal Software Engineer
> > Epocrates, Inc.
> > d...@epocrates.com
> > 812-482-5224
> > 
> > 
> > -----Original Message-----
> > From: general-boun...@developer.marklogic.com 
> > [mailto:general-boun...@developer.marklogic.com] On Behalf Of John Snelson
> > Sent: Friday, September 02, 2011 2:51 PM
> > To: general@developer.marklogic.com
> > Subject: Re: [MarkLogic Dev General] fn:format-number with fixed trailing 
> > 0's padded
> > 
> > My understanding of the spec is that the picture string "#,##0.00" 
> > should give you a minimum of two digits after the decimal point. It 
> > certainly works that way for me in MarkLogic.
> > 
> > fn:format-number(5.6, "#,##0.00")
> > 
> > gives
> > 
> > "5.60"
> > 
> > Are you using a recent version of 4.2?
> > 
> > John
> > 
> > On 02/09/11 18:31, Lee, David wrote:
> >> I'm trying to figure out fn:format-number
> >> 
> >> The specs are about the most confusing thing I've ever read
> >> 
> >> http://www.w3.org/TR/xpath-functions-30/#syntax-of-picture-string
> >> 
> >> Could someone give me an example that would format a decimal with a
> >> fixed number of 0 padded fraction digits ?
> >> 
> >> For example
> >> 
> >> format with 2 0 digits padded
> >> 
> >> 1 as 1.00
> >> 
> >> 1.4 as 1.40
> >> 
> >> 1.414 as 1.41
> >> 
> >> 0 as 0.00
> >> 
> >> 100.1 as 100.10
> >> 
> >> I've tried both
> >> 
> >> "#,##0.##"
> >> 
> >> and
> >> 
> >> "#,##0.00"
> >> 
> >> and both seem to omit the trailing 0
> >> 
> >> Any suggestions ?
> >> 
> >> ----------------------------------------
> >> 
> >> David A. Lee
> >> 
> >> Senior Principal Software Engineer
> >> 
> >> Epocrates, Inc.
> >> 
> >> d...@epocrates.com <mailto:d...@epocrates.com>
> >> 
> >> 812-482-5224
> >> 
> > 
> > 
> > -- 
> > John Snelson, Senior Engineer                  http://twitter.com/jpcs
> > MarkLogic Corporation                         http://www.marklogic.com
> > _______________________________________________
> > General mailing list
> > General@developer.marklogic.com
> > http://developer.marklogic.com/mailman/listinfo/general
> > _______________________________________________
> > General mailing list
> > General@developer.marklogic.com
> > http://developer.marklogic.com/mailman/listinfo/general
> 
> _______________________________________________
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
                                          
_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to