Floor: Difference between revisions

From The K Language Wiki
Content added Content deleted
(add floor page)
 
("Better category ordering, add redirects to categories, fix pseudo-adverb categories")
 
(7 intermediate revisions by 3 users not shown)
Line 1:
{{primitive|_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 [[Atomicity|right atomic]].
 
A ceiling function (round up) can be made with floor as well:using <code>(1+-_)-</code>.
 
<pre>
Line 15 ⟶ 16:
-4 4 80 0N
</pre>
 
[[Category:Verbs]]
[[Category:Operator verbs]]
[[Category:Primitives]]

Latest revision as of 06:41, 9 July 2022

Floor
_x

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

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

The floor primitive is right atomic.

A ceiling function (round up) can be made with floor using -_-.

 _3
3

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