With a Microsoft Office InfoPath form template, if you add an expression box that evaluates a mathematical expression that involves decimal numbers, you
may receive incorrect results.
This problem occurs because of a known issue when floating-point numbers are represented in the base-2 (binary) number system.
For more information about floating-point errors, click the following article number to view the article in the Microsoft Knowledge Base:
(Complete) Tutorial to understand IEEE floating-point errors
To resolve this problem, use the round
function in the InfoPath form. For example, modify the XPath expression that is mentioned in the "More Information" section as follows:
Steps to reproduce the problem
- In InfoPath, design a new, blank form.
- In the Design Tasks pane, click Layout to open the Layout task pane.
- In the Layout task pane, click Table with Title.
- In the table, click the text Click to add a title, and then type Accounting Example.
- Right-click the text Click to add form content, and then click Split Cells.
- In the Split Cells dialog box, set Number of columns to 3, set Number of rows to 3, and then click OK.
- Add data to the cells as follows:
- Add the following text to the table:
Collapse this tableExpand this table
- In the task pane, click Controls to open the Controls task pane.
- Click inside the cell on the second row and the second column, and then click Text Box in the task pane to add a text box.
- Right-click the text box, and then click Text Box Properties.
- In the Text Box Properties dialog box, set Data type to Decimal (double), set Default value to 1.225, and then click OK.
- Repeat steps c through e for the cell in the second row and the third column, but set Default value to 1.225.
- Repeat steps c through e for the cell in the third row and the second column, but set Default value to1.333.
- Repeat steps c through e for the cell in the third row and the third column, but set Default value to 1.333.
- Click outside the table, and then press the ENTER key. Type the following:
Does account reconcile?
- Switch to the Controls task pane, and then click Expression Box.
- In the Insert Expression Box dialog box, set XPath to the following, and then click OK:
Notice that the value of the expression box is set to false
after you follow these steps.
Article ID: 822024 - Last Review: September 22, 2011 - Revision: 5.0
- Microsoft Office InfoPath 2007
- Microsoft Office InfoPath 2003