Jump to content
Wikimedia Meta-Wiki

Template:Floor

From Meta, a Wikimedia project coordination wiki

This template is being considered for deletion at requests for deletion. Please see the discussion there.

If this page matches one of the criteria for speedy deletion, use {{delete|reason}} instead.
Please consider notifying the author and/or the principal contributors of this template using {{subst:RfD notice|Template:Floor}} --~~~~ on their talk pages.
You may use {{subst:RFD2|Template:Floor|Reasons here. --~~~~}} under the appropriate section of Meta:Requests for deletion to start the deletion discussion.

This template produces an expression for the value of a given expression, rounded down to an integer. If the value is in the range of integer-type numbers, the resulting expression is of type integer.

Thus, when applying #expr, if the value is in the range of integer-type numbers the exact result is produced. The reason for not applying #expr in this template is:

  • for integer-type numbers: in subsequent use in another expression the value would be rounded to float
  • for floats: they would be rounded to 14 digits

Examples:

  • {{floor|123.45}} → floor((123.45))
  • {{floor|10/7}} → floor((10/7))
  • {{floor|123.45e20}} → (123.45e20)

Advantage compared with the function floor:

  • for integer-type numbers with an absolute value between 2^53 and 2^63 the function rounds to float (not necessarily downward), while the template gives the integer-type expression for the exact result

AltStyle によって変換されたページ (->オリジナル) /