xforms - Currency field constraint check done before rounding off -


hi unit testing currency field , found issue can considered bug.

<xforms:bind id="amount" nodeset="instance('form')/data/amount" constraint="if(.!='') number(.) >0 , string-length(.)&lt;20 else ."/> ... <fr:currency bind="amount" xxforms:maxlength="50" incremental="true">    <xforms:alert>value should below $ 9,999,999,999,999,999,999.99</xforms:alert> </fr:currency> 

the condition trying achieve in above case is, put max value check < "9999999,999999999.99" has 19 characters total. (i had tried constraint="if(.='') true() else number(.)<10000000000000000" instead of length check, later seeing bug in number check switched string-length check)

now issue in case of string length if enter "9,999,999,999,999,999.991" following happens 1. constraint check performed. returns 'false' "9999999999999999.991" = 20 length 2. currency amount rounded off.

so constraint check fails. if click field , click outside field, constraint check returns true

can suggest better way or how solve above issue.

a few things note:

xxforms:maxlength not work on fr:currency or other fr: control

numbers evaluated against other numbers double-precision 64-bit floating point type. take account when numbers being evaluated. means large numbers rounded. possible problems experience large number evaluations not bug rather math.

  • for example, numbers between 9999999999999998976.00 , 10000000000000001023.99 evaluate 1.0e19

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -