954 views

Uploaded by Chandan Jha

save

You are on page 1of 12

Floor and ceiling functions

**- Floor function - Ceiling function
**

In mathematics and computer science, the floor and ceiling functions map a real number to the largest previous or

the smallest following integer, respectively. More precisely, floor(x) = is the largest integer not greater than x

and ceiling(x) = is the smallest integer not less than x.[1]

Notation

Gauss introduced the square bracket notation [x] for the floor function in his third proof of quadratic reciprocity

(1808).[2] This remained the standard[3] in mathematics until Iverson introduced the names "floor" and "ceiling" and

the corresponding notations x and x in his 1962 book A Programming Language.[4] [5] Both notations are

now used in mathematics; this article follows Iverson.[6]

The floor function is also called the greatest integer or entier (French for "integer") function, and its value at x is

called the integral part or integer part of x; for negative values of x the latter terms are sometimes instead taken to

be the value of the ceiling function, i.e., the value of x rounded to an integer towards 0. The language APL

(programming language) uses ⌊x; other computer languages commonly use notations like entier(x) (Algol), INT(x)

(BASIC), or floor(x)(C and C++).[7] In mathematics, it can also be written with boldface or double brackets .[8]

The ceiling function is usually denoted by ceil(x) or ceiling(x) in non-APL computer languages that have a notation

for this function. In mathematics, there is another notation with reversed boldface or double brackets or just

using normal reversed brackets ]x[.[9]

The fractional part sawtooth function, denoted by for real x, is defined by the formula[10]

For all x,

Examples

3 −2 −2 −2 0 See below for the definition of the fractional part function. that is. part of a Galois connection: it is the upper adjoint of the function that embeds the integers into the reals.[11] In the language of order theory. and n are integers. negative. Definition and properties In the following formulas. and zero).4 2.7 −2. k. however: . m. Floor and ceiling may be defined by the set equations Since there is exactly one integer in a half-open interval of length one. Equivalences These formulas can be used to simplify expressions involving floors and ceilings. the floor function is a residuated mapping.7 −3 −2 0. These formulas show how adding integers to the arguments affect the functions: The above are not necessarily true if n is not an integer. x and y are real numbers.Floor and ceiling functions 2 Sample value Floor Ceiling Fractional part 12/5 = 2. for any real x there are unique integers m and n satisfying Then and may also be taken as the definition of floor and ceiling.4 2 3 2/5 = 0.7 2 3 0. and is the set of integers (positive.

and fractional part functions are idempotent: The result of nested floor or ceiling functions is the innermost function: For fixed y. Quotients If m and n are integers and n ≠ 0. If n is positive[12] . In fact. since for integers n: Negating the argument switches floor and ceiling and changes the sign: i. ceiling.e. from the definitions.Floor and ceiling functions 3 Relations among the functions It is clear from the definitions that with equality if and only if x is an integer. Negating the argument complements the fractional part: The floor. x mod y is idempotent: Also.e. i.

[14] for positive m The following can be used to convert floors to ceilings and vice-versa (m positive)[15] If m and n are positive and coprime. then Since the right-hand side is symmetrical in m and n.[16] Nested divisions For positive integers m.n.Floor and ceiling functions 4 If m is positive[13] For m = 2 these imply More generally. this implies that More generally. This is sometimes called a reciprocity law. if m and n are positive. and arbitrary real number x: .

x mod y is lower semicontinuous for positive y and upper semi-continuous for negative y. floor(x) = x − {x} gives Applications mod operator The mod operator. denoted by x mod y for real x and y. and are piecewise constant functions.Floor and ceiling functions 5 Continuity None of the functions discussed in this article are continuous. unlike the floor. Since floor and ceiling are not periodic. .e. i. and if y is negative. x mod y for fixed y has the Fourier series expansion[17] in particular {x} = x mod 1 is given by At points of discontinuity. a Fourier series converges to a value that is the average of its limits on the left and the right. is defined by the formula x mod y is always between 0 and y. with discontinuites at the integers. if y is positive. rather than to x mod y = 0. Using the formula {x} = x − floor(x). they do not have Fourier series expansions. and as a function of x for fixed y is discontinuous at multiples of y. is upper semi-continuous and and are lower semi-continuous. none of them have a power series expansion. Series expansions Since none of the functions discussed in this article are continuous. y ≠ 0. but all are piecewise linear. also has discontinuites at the integers. At points of continuity the series converges to the true value. If x is an integer and y is a positive integer. ceiling and fractional part functions: for y fixed and x a multiple of y the Fourier series given converges to y/2. x mod y for a fixed y is a sawtooth function.

[18] [19] Let p and q be distinct positive odd prime numbers. Number of digits The number of digits in base b of a positive integer k is . The truncation of any real number can be given by: . and let First. where sgn(x) is the sign function.Floor and ceiling functions 6 Quadratic reciprocity Gauss's third proof of quadratic reciprocity. Gauss's lemma is used to show that the Legendre symbols are given by and The second step is to use a geometric argument to show that Combining these formulas gives quadratic reciprocity in the form There are formulas that use floor to express the quadratic character of small numbers mod odd primes p:[20] Rounding The ordinary rounding of the positive number x to the nearest integer can be expressed as The ordinary rounding of the negative number x to the nearest integer can be expressed as Truncation The truncation of a nonnegative number is given by The truncation of a nonpositive number is given by . as modified by Eisenstein. has two basic steps.

where there is a pole) and combined with the Fourier expansion for {x} can be used to extend the zeta function to the entire complex plane and to prove its functional equation.. In 1947 van der Pol used this representation to construct an analogue computer for finding roots of the zeta function. 0 < σ < 1). The exponent of the highest power of p that divides n! is given by the formula[21] Note that this is a finite sum. Beatty sequence The Beatty sequence shows how every positive irrational number gives rise to a partition of the natural numbers into two sequences via the floor function. since the floors are zero when pk > n.g. It is straightforward to prove (using integration by parts)[24] that if φ(x) is any function with a continuous derivative in the closed interval [a. (except s = 1. and letting b approach infinity gives This formula is valid for all s with real part greater than −1.Floor and ceiling functions 7 Factors of factorials Let n be a positive integer and p a positive prime number.[22] Euler's constant (γ) There are formulas for Euler's constant γ = 0. that involve the floor and ceiling.57721 56649 . e.[25] For s = σ + i t in the critical strip (i..e. b]. Letting φ(n) = n−s for real part of s greater than 1 and letting a and b be integers.[26] .[23] and Riemann function (ζ) The fractional part function also shows up in integral representations of the Riemann zeta function.

Floor and ceiling functions 8 Formulas for prime numbers n is a prime if and only if[27] Let r > 1 be an integer.. if n ≥ 2. (Mill's constant) with the property that are all prime. prove that (i) (ii) (iii) . It is a straightforward deduction from Wilson's theorem that[30] Also.[29] π(x) is the number of primes less than or equal to x. and define Then[28] There is a number θ = 1. pn be the nth prime..9287800.3064.[32] If n is a positive integer.[29] There is also a number ω = 1.[31] None of the formulas in this section is of any practical use... Solved problem Ramanujan submitted this problem to the Journal of the Indian Mathematical Society. with the property that are all prime.

Although the details differ between programs.5) returns −5. Microsoft Excel's ceiling function does not follow the mathematical definition. As a typical example. For example.5) returns −4. CEILING(-4.[39] Int function from floating-point conversion Spreadsheet software Most spreadsheet programs support some form of a ceiling function. A mathematical ceiling function can be emulated in Excel by using the formula "-INT(-value)" (please note that this is not a general rule. most implementations support a second parameter—a multiple of which the given number is to be rounded to.[36] In these languages. differs from program to program. and for x < 0 it returns ceiling(x). CEILING(-4.floor and ceil function. giving a result heading towards negative infinity in all cases. conversion of floating point values to integers using type casting syntax truncates toward zero. and related programming languages have standard functions floor() [35] and ceil(). it is a mixture of the floor and ceiling function: for x ≥ 0 it returns floor(x). but rather as with (int) operator in C. with an optional parameter for Excel compatibility.[37] Python Python follows the standard mathematical definition with integer division and its math.org and others.0 doesn't have integer division. however. The OpenDocument file format. so the floor and ceil functions would have to be used with that version. Computer implementations C and C++ The C. 3) would round 2 up to the nearest multiple of 3.[38] Python 3. The definition of what "round up" means. ceiling(2. as it depends on Excel's INT function. so this would return 3. none are known. as used by OpenOffice.Floor and ceiling functions 9 Unsolved problem The study of Waring's problem has led to an unsolved problem: Are there any positive integers k. For example. follows the mathematical definition of ceiling for its ceiling function. . k ≥ 6. This has followed through to the Office Open XML file format. such that[33] Mahler[34] has proved there can only be a finite number of such k. which behaves differently than most programming languages). C++.

Knuth. p. Knuth. K.1. 3. 85 [14] Graham. Ex. [37] ISO standard for C. & Patashnik.3.Floor and ceiling functions 10 Typesetting The floor and ceiling function are usually typeset with left and right square brackets where the upper (for floor function) or lower (for ceiling function) horizontal bars are missing. [4] Iverson. Ex. & Patashnik. p. & Patashnik. mathwords. [38] http:/ / docs. [8] Mathwords: Floor Function (http:/ / www. 46 [28] Hardy & Wright. pages 122-124 [35] "C++ reference of floor function" (http:/ / cppreference. e. §§ 6. com/ wiki/ numeric/ c/ ceil). 1. [24] Titchmarsh. 25 [21] Hardy & Wright. com/ f/ floor_function.15 [15] Graham. Th. Knuth & Patashnik. Knuth. Notes [1] Graham. . . \rfloor. On the fractional parts of the powers of a rational number II.33 [19] Hardy & Wright. Retrieved 5 December 2010. Knuth.. 86. p. Graham.g. org/ library/ math. 1957. Knuth.11–6. 10. 70. p.4. 13 [25] Titchmarsh. htm) [10] Graham. Ch.12 [16] Graham. pp. [7] Sullivan.1 [2] Lemmermeyer.g. 15. & Patashnik. p.4. 3. HTML 4. 1. 23. [3] e.32–1. [11] Graham. & Patashink. 416 [22] Graham. & Patashnik. p. Ex. python. Eq. 337 [34] Mahler. Knuth. & Patashnik. 186 [30] Ribenboim. Cassels.1. ceil [39] http:/ / www. and Crandall & Pomerance use Iverson's.3 [29] Ribenboim. Hardy & Wright.. and Ribenboim use Gauss's notation. python. 181 [31] Crandall & Pomerance. pp.7 [18] Lemmermeyer. Ch. &lceil. pp. 3 [12] Graham. Knuth. p. & Patashnik. com/ c/ ceiling_function. Retrieved 5 December 2010.0 uses the same names: &lfloor. p. [6] See the Wolfram MathWorld article.. [36] "C++ reference of ceil function" (http:/ / cppreference. p. Mathematika. 25. p. p. [9] Mathwords: Ceiling Function (http:/ / www. ⌊x⌋. 72 [13] Graham. 391 [27] Crandall & Pomerance. in the LaTeX typesetting system these symbols can be specified with the \lfloor. Unicode contains codepoints for these symbols at U+2308–U+230B: ⌈x⌉. \lceil and \rceil commands in math mode. 2. p.3. htm). Ex. p. Papers p. § 1. 46 [32] Ramanujan. [5] Higham. 77–78 [23] These formulas are from the Wikipedia article Euler's constant. and &rceil. p. org/ dev/ peps/ pep-0238/ . and. 85 and Ex. p. html?highlight=ceil#math.4. Knuth. p. 12.14–15 [26] Crandall & Pomerance. Question 723. 1. mathwords. which has many more. com/ wiki/ numeric/ c/ floor).. § 22. &rfloor. 332 [33] Hardy & Wright.13 [20] Lemmermeyer. Knuth. & Patashnik. 43. 94 [17] Titchmarsh.. 3. 4. p. p. § 6.

S. "Integer rounding functions" (http://www. ISBN 0-387-04777-9 • Graham. retrieved 24 October 2008 • Weisstein. Prague. New York: Springer.html)" from MathWorld. M.cz/portal/AlgoMath/NumberTheory/ ArithmeticFunctions/IntegerRoundingFunctions. ISO/IEC 9899::1999(E): Programming languages — C (2nd ed).4. Cambridge University Press • Crandall. G.. • Weisstein. Oxford: Oxford University Press. 1999.com/CeilingFunction. 43. Cassels (1957). " Ceiling Function (http://mathworld. Reciprocity Laws: from Euler to Eisenstein. Concrete Mathematics. The New Book of Prime Number Records. Donald E. p. Srinivasa (2000). Heath-Brown. Carl (2001). Cambridge Tracts in Mathematics and Mathematical Physics.. Wright. Czech Republic.). Edward Charles. Paulo (1996). Pomeramce. Collected Papers.wolfram.com/FloorFunction. Knuth. • Iverson. Kenneth E.html)" from MathWorld. New York: Springer. David Rodney ("Roger") (1986). H.cas. ISBN 0898714206. ISBN 3-540-66967-4 • Ramanujan. 45. ISBN 0-19-853369-1 External links • Štefan Porubský. An Introduction to the Theory of Numbers (Fifth edition). A Programming Language. Providence RI: AMS / Chelsea. Wiley • Lemmermeyer. Eric W. " Floor Function (http://mathworld. Section 6. Ronald L. Higham. 86 • Titchmarsh. (1962). Precalculus.: Addison-Wesley.1. ISBN 0-387-94457-5 • Michael Sullivan. Berlin: Springer. ISBN 0-201-55802-5 • Hardy..htm). E.Floor and ceiling functions 11 References • J. . Oren (1994). Patashnik. An introduction to Diophantine approximation. Handbook of writing for the mathematical sciences. ISBN 978-0198531715 • Nicholas J. 25 • ISO/IEC.3. Eric W. P.W. Institute of Computer Science of the Czech Academy of Sciences. Oxford: Oxford U.. p. Prime Numbers: A Computational Perspective. The Theory of the Riemann Zeta-function (2nd ed. p.cs. Franz (2000). Richard.wolfram... (1980). SIAM. Interactive Information Portal for Algorithmic Mathematics. Reading Ma. ISBN 978-0821820766 • Ribenboim. 8th edition.

Omegatron License Creative Commons Attribution-Share Alike 3. Omegatron. Sabbut. FvdP.org/w/index. El C. Murtasa. Shagriz. DePiep.php?title=File:Int_function. Ideyal. Mohamed Al-Dabbagh. Thincat. Henrygb. Duja. Verin Sedai. Clark Kimberling. Johnflux. KyleP.org/w/index. LilHelpa. Wich. Dysprosia. Mav. Davzier.php?title=File:Ceiling_function. Wj32. ABF. Charles Matthews.0 Unported http:/ / creativecommons. Wimmerm. Eirik. Abdull.svg License: unknown Contributors: Darapti. VKokielov. Mgccl.svg Source: http://en. Pieter Kuiper. Licenses and Contributors Image:Floor function. Gavia immer. DRE. Oliphaunt. 1 anonymous edits File:Int function. Maltelauridsbrigge. org/ licenses/ by-sa/ 3. Gesslein. Maksim-e.chiu.svg Source: http://en. Vanish2. Myblackmouse. 146 anonymous edits Image Sources.svg License: unknown Contributors: Darapti. SvNH. Snoyes. Fnielsen. Omegatron. Virginia-American. Dbenbenn. RexNL. Mrand. Tjdw. Patrick. Omegatron. Michael Hardy.Article Sources and Contributors 12 Article Sources and Contributors Floor and ceiling functions Source: http://en. Looxix. Spoon!. 0/ . Beland. Skorpionek. Alexander Iwaschkin. Piano non troppo. Super Rad!. Takwan. Usien6. Weihao. Macrakis.wikipedia. EdC. Sagie.wikipedia. Anonymous Dissident.org/w/index. Mwtoews. Timmyp320. Octahedron80. Chris857. Keka. Jkl. BiT.wikipedia. Wisling. Mat cross. Robprain. Tinctorius. Oleg Alexandrov. BenFrantzDale. Enochlau. Faradayplank. Fredrik. 0rrAvenger. Rbj. Elassint. Darapti. Quantling. Rifleman 82. LOL. Tosha.wikipedia. Paepaok. WDavis1911. Linas. Marc van Leeuwen. Lester. Pieter Kuiper Image:Ceiling function. Reyk. McKay.svg License: unknown Contributors: Cwbm (commons). Giftlite. Firespade. Rich Farmbrough.php?oldid=408024624 Contributors: 08glasgow08.org/w/index. XJamRastafire. FStHilaire. Archelon. Lambiam. Schutz. AxelBoldt. Zrs 12. Nk. Jstaniek.svg Source: http://en. Kieff. Martnym. Ocolon. Aaron Rotenberg. Julendra. Da Joe. The Thing That Should Not Be. Peterl. 1exec1. KnowledgeOfSelf.php?title=File:Floor_function. CanadianLinuxUser. Reg Holmes. RDBury. Dhollm. Arvindn. Hvn0413. Smalljim. Mandarax.

- Neural Network Package for Octave Developers GuideUploaded byGean Kleber
- final_csi4107_2006Uploaded byheroriss
- Math Prelims SolnUploaded byChristopher Thong
- Number Theory(2)Uploaded bySkartoulis Michael
- Array Based Stack Text TutorialUploaded byShivaniChopra
- Algorithm(3)Uploaded bylashiya
- Conversion WorksheetUploaded byJorge Colunga
- Automatic search for wheel position in flute grinding of cutting toolsUploaded byGustavo Ferronatto
- multi-step inequalitiesUploaded byapi-237271221
- Maths Ext1 Hsc Sa 2010Uploaded byi_luvv_music
- Week 6 LessonUploaded byKamal Lohia
- Value and ambiguity index based ranking method of single-valued trapezoidal neutrosophic numbers and its application to multi-attribute decision makingUploaded byMia Amalia
- Algebra 2 Honors PBAUploaded byJulie
- Chinese Postman Problem - Causeway BayUploaded byEugeneWong
- 6.pdfUploaded byGhandhy Campus Stories
- Begin 1Uploaded byThai Dao
- g8m1 study guide mid module assessmentUploaded byapi-276774049

- kindergarten-matching-antonyms-unscramble-word-6.pdfUploaded byChandan Jha
- kindergarten-matching-draw-line-antonyms-2.pdfUploaded byChandan Jha
- kindergarten-matching-draw-line-antonyms-2.pdfUploaded byChandan Jha
- kindergarten-matching-draw-line-antonyms-1.pdfUploaded byChandan Jha
- Kindergarten Matching Antonyms Unscramble Word 5Uploaded byChandan Jha
- dd4dUploaded byEsraa Elnageeb
- cUploaded byNaveen Kumar
- Equalized-FEXT Method for Upstream Power Backoff (UPBOUploaded byChandan Jha
- Lte Air Interface WhitepaperUploaded bymlg01

- PROGRAMA Principios de Economia 2017-2 GERMANUploaded byjose omar
- 2.Mech - IJMPERD - Linear Static - P.v.KUploaded byiaset123
- Determinacion de celulosa, holocelulosa y lignina.pdfUploaded byDavid Catagua
- TSO_2012Uploaded byDaniel Marcel Hevesi
- Llavero.perfumeUploaded byAnonymous bzABASP
- Agencias de Publicidad y Medios de Comunicacion.Uploaded byGinaCevallos
- Decreto de Alcaldia 017 SemaforoUploaded byNelson Ortiz Gonzales
- Aya_Manual de Plantiu CEBUDV_UBAUploaded byJoão Cláudio Rocha Lima Melo
- Historia Del Transporte MineroUploaded byKevin Astt
- bisel m pico paperUploaded byapi-259796113
- 289963105-A-Guideline-to-Translation-1.pdfUploaded byAnonymous q2FiC8lh
- amazon projectUploaded byapi-338252487
- Get StartUploaded bybidonex
- Crashing en La Gestión de Proyectos - Reducir La Duración de Un Proyecto a Través de CrashingUploaded byAna Sofia Vilchez Llanos
- 01 Características regionais da AF brasileira 4Uploaded byRafaelly Santos
- Sika Backing FillerUploaded bythepilot2
- 0-Anexo 1. Guia Para El Desarrollo Del Componente Practico- Laboratorio Virtual (Fase 7) (1)Uploaded byNorwin Cifuentes Agudelo
- Teoria de NumerosUploaded bydaniels
- INFORME CENTRAL HIDROELECTRICA PLATANALUploaded byJeiner Guerrero Martinez
- Estudio de Caso CuritibaUploaded byJhona Gmz Rok
- Combined 4.06.10Uploaded byAngel Mayal
- Prp prmUploaded byJuan Humberto Cruz Mandiola
- caracterização de proteinas.docxUploaded byAgatha Ísis Benke
- Pembahasan TO Online 2.pdfUploaded byLian Anggina Pinayungan
- MONOGRAFIA Aisladores y Disipadores Sismicos 1Uploaded byGustavo Bazán
- Transpo Reviewer - Damages & Public Service ActUploaded bySotelo Vincent Cabrera
- Catalogo2014.pdfUploaded byjc
- Articulo El Arte de FondearUploaded byFranciscoChamorroLobos
- nmx-b-230-1970Uploaded byCarlos Alberto Quispe Huaroto
- Anti Bélier KSBUploaded bytallef001