Obtain the highest integer value which is not higher to the argument (rounding down). Optionally, allows to specify a rounding precision at decimals level.

1 math.floor

<math.floor>
    <arg /> !
    <decimal /> *
</math.floor>

Exceptions

too many arguments for floor function

too many arguments for floor function

Example
Copy
<xsql-script name='floor_sample1'>
    <body>
        <println>
            <math.floor>0.7</math.floor>
        </println>                             --> floor (0.7) = 0
    </body>
</xsql-script>

Rounding down the number 0.7, is 0.

Example
Copy
<xsql-script name='floor_sample2'>
	<body>
		<set name='a'>0.819</set>
		<println>
			<math.floor><a/></math.floor>
		</println>                             --> floor (a) = floor (0.819) = 0
	</body>
</xsql-script>

Rounding down the content of the variable a, which is the number 0.819, is 0.

Example
Copy
<xsql-script name='floor_sample3'>
   <body>
       <set name='a'>0.819</set>
       <println>
           <math.floor>
               <a/>
               2
           </math.floor>
       </println>
   </body>                                --> floor (a, 2) = floor (0.819, 2) = 0.81
</xsql-script>

Rounding down the content of the variable a, with a precision of 2 decimals,is 0.81.

Example
Copy
<xsql-script name='floor_sample4'>
   <body>
       <set name='a'>0.819</set>
       <println>
           <math.floor>
               <a/>
               4
           </math.floor>
       </println>                         --> floor (a, 4) = floor (0.819, 4) = 0.8190
   </body>
</xsql-script>

Rounding down the content of the variable a, with a precision of 4 decimals, is 0.8190.

Example
Copy
<xsql-script name='floor_sample5'>
   <body>
       <set name='a'>0.819</set>
       <println>
           <math.floor>
               <a/>
               0
           </math.floor>
       </println>                         --> floor (a, 0) = floor (0.819, 0) = 0
   </body>
</xsql-script>

Rounding down the content of the variable a, with a precision of 0 decimals, is 0.