Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Floor and ceiling functions
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Rounding=== For an arbitrary real number <math>x</math>, [[rounding]] <math>x</math> to the nearest integer with [[Rounding#Tie-breaking|tie breaking]] towards positive infinity is given by :<math>\text{rpi}(x)=\left\lfloor x+\tfrac{1}{2}\right\rfloor = \left\lceil \tfrac12\lfloor 2x \rfloor \right\rceil;</math> rounding towards negative infinity is given as :<math>\text{rni}(x)=\left\lceil x-\tfrac{1}{2}\right\rceil = \left\lfloor \tfrac12 \lceil 2x \rceil \right\rfloor.</math> If tie-breaking is away from 0, then the rounding function is :<math>\text{ri}(x) = \sgn(x)\left\lfloor|x|+\tfrac{1}{2}\right\rfloor</math> (where <math>\sgn</math> is the [[sign function]]), and [[Rounding#Rounding half to even|rounding towards even]] can be expressed with the more cumbersome :<math>\lfloor x\rceil=\left\lfloor x+\tfrac{1}{2}\right\rfloor+\left\lceil\tfrac14(2x-1)\right\rceil-\left\lfloor\tfrac14(2x-1)\right\rfloor-1,</math> which is the above expression for rounding towards positive infinity <math>\text{rpi}(x)</math> minus an [[integer|integrality]] [[indicator function|indicator]] for <math>\tfrac14(2x-1)</math>. Rounding a [[real number]] <math>x</math> to the nearest integer value forms a very basic type of [[Quantization (signal processing)|quantizer]] β a ''uniform'' one. A typical (''mid-tread'') uniform quantizer with a quantization ''step size'' equal to some value <math>\Delta</math> can be expressed as :<math>Q(x) = \Delta \cdot \left\lfloor \frac{x}{\Delta} + \frac{1}{2} \right\rfloor</math>,
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)