Floor: Difference between revisions

From The K Language Wiki
Content added Content deleted
(add floor page)
 
mNo edit summary
Line 6: Line 6:
The floor primitive is [[Atomicity|right atomic]].
The floor primitive is [[Atomicity|right atomic]].


A ceiling function (round up) can be made with floor as well: <code>(1+_)</code>
A ceiling function (round up) can be made with floor using a [[tacit]] definition: <code>(1+_)</code>


<pre>
<pre>

Revision as of 11:42, 11 July 2021

Floor
_x

The floor function is used to round numbers down in K.

Flooring is a no-op on integers and characters, meaning that they remain the same.

The floor primitive is right atomic.

A ceiling function (round up) can be made with floor using a tacit definition: (1+_)

 _3
3

 _-3.7 4.789 80 0n
-4 4 80 0N