Wenn ich einen Boden (10000000 * 1.1158) mache, ist die Ausgabe 11157999 statt 11158000. Aber wenn ich einen Boden (11158000) versuche, gibt es mir den guten Wert zurück.XSLT - Floor falscher Wert
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
format-number(floor(10000000 * 1.1158) div 10000000, '#.0000000') = <br/>
<xsl:value-of select="format-number(floor(10000000 * 1.1158) div 10000000, '#.0000000')"/>
<br/><br/>
floor(10000000 * 1.1158) div 10000000 = <br/>
<xsl:value-of select="floor(10000000 * 1.1158) div 10000000"/>
<br/><br/>
floor(10000000 * 1.1158) =<br/>
<xsl:value-of select="floor(10000000 * 1.1158)"/>
<br/><br/>
10000000 * 1.1158 = <br/>
<xsl:value-of select="10000000 * 1.1158"/>
<br/><br/>
floor(11158000 =
<br/>
<xsl:value-of select="floor(11158000)"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Ausgang:
format-number(floor(10000000 * 1.1158) div 10000000, '#.0000000') =
1.1157999
floor(10000000 * 1.1158) div 10000000 =
1.1157999
floor(10000000 * 1.1158) =
11157999
10000000 * 1.1158 =
11158000
floor(11158000 =
11158000
Siehe http://stackoverflow.com/questions/12746624/number-rounding-and-precision-problems-in-xslt-1-0 und http://stackoverflow.com/questions/3805248/xsl-rounding- Format-Nummer-Problem –