4,494
edits
m (Text replacement - "<source" to "<syntaxhighlight") |
m (Text replacement - "</source>" to "</syntaxhighlight>") Tags: Mobile edit Mobile web edit |
||
Line 1: | Line 1: | ||
{{Built-in|Floor|⌊}} is a [[monadic]] [[scalar function]] that gives the [[wikipedia:floor and ceiling functions|floor]] of a real number, that is, the greatest integer [[Comparison tolerance|tolerantly]] [[less than or equal to]] the given value. This operation is also known as '''integral part''', '''entier''', and '''round down'''. Floor shares the [[glyph]] <syntaxhighlight lang=apl inline>⌊</ | {{Built-in|Floor|⌊}} is a [[monadic]] [[scalar function]] that gives the [[wikipedia:floor and ceiling functions|floor]] of a real number, that is, the greatest integer [[Comparison tolerance|tolerantly]] [[less than or equal to]] the given value. This operation is also known as '''integral part''', '''entier''', and '''round down'''. Floor shares the [[glyph]] <syntaxhighlight lang=apl inline>⌊</syntaxhighlight> with the dyadic arithmetic function [[Minimum]]. [[Comparison_with_traditional_mathematics#Prefix|Traditional mathematics]] derives [[Ken_Iverson#Floor_and_Ceiling|its notation]] and name for floor from APL. | ||
== Examples == | == Examples == | ||
Line 8: | Line 8: | ||
⌊2 2.8 ¯2 ¯2.8 | ⌊2 2.8 ¯2 ¯2.8 | ||
2 2 ¯2 ¯3 | 2 2 ¯2 ¯3 | ||
</ | </syntaxhighlight> | ||
Rounding to the ''nearest'' integer (rounding up on half) can be achieved by [[add|adding]] 0.5 before applying Floor. | Rounding to the ''nearest'' integer (rounding up on half) can be achieved by [[add|adding]] 0.5 before applying Floor. | ||
Line 15: | Line 15: | ||
⌊0.5+2 2.3 2.5 2.8 | ⌊0.5+2 2.3 2.5 2.8 | ||
2 2 3 3 | 2 2 3 3 | ||
</ | </syntaxhighlight> | ||
Integral quotient of division can be found with [[divide|division]] followed by Floor. | Integral quotient of division can be found with [[divide|division]] followed by Floor. | ||
Line 22: | Line 22: | ||
⌊10 20 30÷3 | ⌊10 20 30÷3 | ||
3 6 10 | 3 6 10 | ||
</ | </syntaxhighlight> | ||
== Properties == | == Properties == | ||
Line 36: | Line 36: | ||
⌊v | ⌊v | ||
0 1 1 | 0 1 1 | ||
</ | </syntaxhighlight> | ||
=== Complex floor === | === Complex floor === | ||
Line 50: | Line 50: | ||
1>|v-⌊v | 1>|v-⌊v | ||
1 1 1 1 | 1 1 1 1 | ||
</ | </syntaxhighlight>{{Works in|[[Dyalog APL]]}} | ||
== External links == | == External links == |