new file: Files/flashplayer_32_sa.exe new file: favicon.ico new file: globe.gif new file: imgs/download.png new file: imgs/zuck.jpg new file: index.html new file: other.ico new file: script.js new file: site.webmanifest new file: sitemap.html new file: styles/backround.css new file: styles/border.css new file: styles/fonts/Titillium_Web/OFL.txt new file: styles/fonts/Titillium_Web/TitilliumWeb-Black.ttf new file: styles/fonts/Titillium_Web/TitilliumWeb-Bold.ttf new file: styles/fonts/Titillium_Web/TitilliumWeb-BoldItalic.ttf new file: styles/fonts/Titillium_Web/TitilliumWeb-ExtraLight.ttf new file: styles/fonts/Titillium_Web/TitilliumWeb-ExtraLightItalic.ttf new file: styles/fonts/Titillium_Web/TitilliumWeb-Italic.ttf new file: styles/fonts/Titillium_Web/TitilliumWeb-Light.ttf new file: styles/fonts/Titillium_Web/TitilliumWeb-LightItalic.ttf new file: styles/fonts/Titillium_Web/TitilliumWeb-Regular.ttf new file: styles/fonts/Titillium_Web/TitilliumWeb-SemiBold.ttf new file: styles/fonts/Titillium_Web/TitilliumWeb-SemiBoldItalic.ttf new file: styles/fonts/webfontkit-20221027-163353/generator_config.txt new file: styles/fonts/webfontkit-20221027-163353/specimen_files/grid_12-825-55-15.css new file: styles/fonts/webfontkit-20221027-163353/specimen_files/specimen_stylesheet.css new file: styles/fonts/webfontkit-20221027-163353/stylesheet.css new file: styles/fonts/webfontkit-20221027-163353/titilliumweb-extralight-demo.html new file: styles/fonts/webfontkit-20221027-163353/titilliumweb-extralight-webfont.woff new file: styles/fonts/webfontkit-20221027-163353/titilliumweb-extralight-webfont.woff2 new file: styles/fonts/webfontkit-20221027-165950/generator_config.txt new file: styles/fonts/webfontkit-20221027-165950/specimen_files/grid_12-825-55-15.css new file: styles/fonts/webfontkit-20221027-165950/specimen_files/specimen_stylesheet.css new file: styles/fonts/webfontkit-20221027-165950/stylesheet.css new file: styles/fonts/webfontkit-20221027-165950/titilliumweb-bold-demo.html new file: styles/fonts/webfontkit-20221027-165950/titilliumweb-bold-webfont.woff new file: styles/fonts/webfontkit-20221027-165950/titilliumweb-bold-webfont.woff2 new file: styles/style.css new file: tools/2048/.gitignore new file: tools/2048/.jshintrc new file: tools/2048/CONTRIBUTING.md new file: tools/2048/LICENSE.txt new file: tools/2048/README.md new file: tools/2048/Rakefile new file: tools/2048/favicon.ico new file: tools/2048/index.html new file: tools/2048/js/animframe_polyfill.js new file: tools/2048/js/application.js new file: tools/2048/js/bind_polyfill.js new file: tools/2048/js/classlist_polyfill.js new file: tools/2048/js/game_manager.js new file: tools/2048/js/grid.js new file: tools/2048/js/html_actuator.js new file: tools/2048/js/keyboard_input_manager.js new file: tools/2048/js/local_storage_manager.js new file: tools/2048/js/tile.js new file: tools/2048/meta/apple-touch-icon.png new file: tools/webretro/cores/neocd_libretro.js new file: tools/webretro/cores/neocd_libretro.wasm new file: tools/webretro/cores/nestopia_libretro.js new file: tools/webretro/cores/nestopia_libretro.wasm new file: tools/webretro/cores/o2em_libretro.js new file: tools/webretro/cores/o2em_libretro.wasm new file: tools/webretro/cores/opera_libretro.js new file: tools/webretro/cores/opera_libretro.wasm
203 lines
9.5 KiB
HTML
203 lines
9.5 KiB
HTML
<!doctype html>
|
|
<html lang="en"><!-- #BeginTemplate "../Templates/Advanced.dwt" --><!-- DW6 -->
|
|
|
|
<!-- Mirrored from www.mathsisfun.com/sets/function-floor-ceiling.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 29 Oct 2022 00:35:49 GMT -->
|
|
<head>
|
|
<!-- #BeginEditable "doctitle" -->
|
|
<title>Floor and Ceiling Functions</title>
|
|
<meta name="Description" content="Math explained in easy language, plus puzzles, games, quizzes, worksheets and a forum. For K-12 kids, teachers and parents." />
|
|
<!-- #EndEditable -->
|
|
<meta name="keywords" content="math, maths, mathematics, school, homework, education" />
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
<meta name="viewport" content="width=device-width; initial-scale=1.0; user-scalable=true;" />
|
|
<meta name="HandheldFriendly" content="true"/>
|
|
<meta http-equiv="pics-label" content='(PICS-1.1 "http://www.classify.org/safesurf/" L gen true for "http://www.mathsisfun.com" r (SS~~000 1))' />
|
|
<link rel="stylesheet" type="text/css" href="../style3.css" />
|
|
<script src="../main3.js" type="text/javascript"></script>
|
|
</head>
|
|
|
|
<body id="bodybg" class="adv">
|
|
<div class="bg">
|
|
<div id="stt"></div>
|
|
<div id="hdr"></div>
|
|
<div id="logo"><a href="../index.html"><img src="../images/style/logo.svg" alt="Math is Fun" /></a></div>
|
|
<div id="advText">Advanced</div>
|
|
<div id="gtran"><script type="text/javascript">document.write(getTrans());</script></div>
|
|
<div id="gplus"><script type="text/javascript">document.write(getGPlus());</script></div>
|
|
<div id="adTopOuter" class="centerfull noprint">
|
|
<div id="adTop">
|
|
<script type="text/javascript">document.write(getAdTop());</script>
|
|
</div>
|
|
</div>
|
|
<div id="adHide">
|
|
<div id="showAds1"><a href="javascript:showAds()">Show Ads</a></div>
|
|
<div id="hideAds1"><a href="javascript:hideAds()">Hide Ads</a><br>
|
|
<a href="../about-ads.html">About Ads</a></div>
|
|
</div>
|
|
<div id="menuWide" class="menu">
|
|
<script type="text/javascript">document.write(getMenu(0));</script>
|
|
</div>
|
|
<div id="linkto">
|
|
<div id="linktort"><script type="text/javascript">document.write(getLinks());</script></div>
|
|
</div>
|
|
<div id="search" role="search"><script type="text/javascript">document.write(getSearch());</script></div>
|
|
<div id="menuSlim" class="menu">
|
|
<script type="text/javascript">document.write(getMenu(1));</script>
|
|
</div>
|
|
<div id="menuTiny" class="menu">
|
|
<script type="text/javascript">document.write(getMenu(2));</script>
|
|
</div>
|
|
<div id="extra"></div>
|
|
</div>
|
|
<div id="content" role="main"><!-- #BeginEditable "Body" -->
|
|
|
|
<h1 align="center">Floor and Ceiling Functions</h1>
|
|
<p>The floor and ceiling functions give us the <b>nearest <a href="../whole-numbers.html">integer</a></b> up or down.</p>
|
|
<div class="example">
|
|
<h3>Example: What is the floor and ceiling of 2.31?</h3>
|
|
<p align="center"><img src="images/function-floor-ceiling.svg" alt="Floor and Ceiling function" /></p>
|
|
<p align="center" class="larger">The Floor of 2.31 is <b>2</b> <br />
|
|
The Ceiling of 2.31 is <b>3</b></p>
|
|
</div>
|
|
<h3>Floor and Ceiling of Integers</h3>
|
|
<p>What if we want the floor or ceiling of a number that is already an integer?</p>
|
|
<p align="center" class="larger">That's easy: no change!</p>
|
|
<div class="example">
|
|
<h3>Example: What is the floor and ceiling of 5?</h3>
|
|
<p align="center" class="larger">The Floor of 5 is <b>5</b> <br />
|
|
The Ceiling of 5 is <b>5</b></p>
|
|
</div>
|
|
<p>Here are some example values for you:</p>
|
|
<table border="1" align="center">
|
|
<tr>
|
|
<th width="60" align="center">x</th>
|
|
<th width="80" align="center">Floor</th>
|
|
<th width="80" align="center">Ceiling</th>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td width="50" align="center">−1.1</td>
|
|
<td width="80" align="center">−2</td>
|
|
<td width="80" align="center">−1</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="50" align="center">0</td>
|
|
<td width="80" align="center">0</td>
|
|
<td width="80" align="center">0</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="50" align="center">1.01</td>
|
|
<td width="80" align="center">1</td>
|
|
<td width="80" align="center">2</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="50" align="center">2.9</td>
|
|
<td width="80" align="center">2</td>
|
|
<td width="80" align="center">3</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="50" align="center">3</td>
|
|
<td width="80" align="center">3</td>
|
|
<td width="80" align="center">3</td>
|
|
</tr>
|
|
</table>
|
|
<h2>Symbols</h2>
|
|
<p>The symbols for floor and ceiling are like the square brackets <span class="large">[ ]</span> with the top or bottom part missing:</p>
|
|
<p align="center"><img src="images/function-floor-ceiling-symbol.svg" alt="Floor and Ceiling function symbols" /></p>
|
|
<p>But I prefer to use the word form: <b>floor</b>(x) and <b>ceil</b>(x)</p>
|
|
<h2> Definitions</h2>
|
|
<p>How do we give this a formal definition? </p>
|
|
<div class="example">
|
|
<h3>Example: How do we define the floor of 2.31?</h3>
|
|
<p>Well, it has to be an integer ...</p>
|
|
<p align="center">... and it has to be <b>less than</b> (or maybe equal to) 2.31, right?</p>
|
|
<ul>
|
|
<li><b>2</b> is less than 2.31 ... </li>
|
|
<li>but <b>1</b> is also less than 2.31, </li>
|
|
<li>and so is <b>0</b>, and <b>-1, -2, -3, etc. </b></li>
|
|
</ul>
|
|
<p align="center" class="larger">Oh no! There are lots of integers less than 2.31.</p>
|
|
<p> </p>
|
|
<p>So which one do we choose? </p>
|
|
<p align="center">Choose the <b>greatest</b> one (which is <b>2</b> in this case)</p>
|
|
<p>So we get:</p>
|
|
<p align="center" class="larger">The <b>greatest</b> integer that is <b>less than</b> (or equal to) 2.31 is <b>2</b></p>
|
|
</div>
|
|
<p>Which leads to our definition: </p>
|
|
<div class="def">
|
|
<p>Floor Function: the greatest integer that is less than or equal to <b>x</b></p>
|
|
</div>
|
|
<p>Likewise for Ceiling:</p>
|
|
<div class="def">
|
|
<p>Ceiling Function: the least integer that is greater than or equal to <b>x</b></p>
|
|
</div>
|
|
<h2>As A Graph</h2>
|
|
<p>The Floor Function is this curious "step" function (like an infinite staircase):</p>
|
|
<p align="center"><img src="images/function-floor-graph.svg" alt="Floor function graph" /></p>
|
|
<p align="center" class="larger">The Floor Function</p>
|
|
|
|
<p>A solid dot means "including" and an open dot means "not including". </p>
|
|
<div class="example">
|
|
<h3>Example: at <b>x=2</b> we meet:</h3>
|
|
<ul>
|
|
<li> an <b>open dot</b> at y=1 (so it does not include x=2), </li>
|
|
<li>and a <b>solid dot</b> at y=2 (which <i>does</i> include x=2) </li>
|
|
</ul>
|
|
<p>so the answer is <b>y=2</b></p>
|
|
</div>
|
|
<p>And this is the Ceiling Function:</p>
|
|
<p align="center"><img src="images/function-ceiling-graph.svg" alt="Ceiling function graph" /></p>
|
|
<p align="center"><span class="larger">The Ceiling Function</span></p>
|
|
<h2> The "Int" Function</h2>
|
|
<p>The "Int" function (short for "integer") is like the "Floor" function, BUT some calculators and computer programs show different results when given negative numbers:</p>
|
|
<ul>
|
|
<li>Some say <span class="larger">int(−3.65) = <b>−4</b></span> (the same as the Floor function)</li>
|
|
<li>Others say <span class="larger">int(−3.65) = <b>−3</b></span> (the neighbouring integer <b>closest to zero, </b>or "just throw away the .65")</li>
|
|
</ul>
|
|
<p>So be careful with this function!</p>
|
|
<h2>The "Frac" Function</h2>
|
|
<p> With the Floor Function, we "throw away" the fractional part. That part is called the "frac" or "fractional part" function: </p>
|
|
<p align="center" class="large">frac(x) = x − floor(x)</p>
|
|
<p>It looks like a sawtooth:</p>
|
|
<p align="center"><img src="images/function-frac.svg" alt="Frac function graph" /></p>
|
|
<p align="center"><span class="larger">The Frac Function</span></p>
|
|
<div class="example">
|
|
<h3>Example: what is frac(3.65)?</h3>
|
|
<p><b> frac(x) = x − floor(x) </b></p>
|
|
<p>So: frac(3.65) = 3.65 − floor(3.65) = 3.65 − 3 = <b>0.65</b></p>
|
|
</div>
|
|
<div class="example">
|
|
<h3>Example: what is frac(−3.65)?</h3>
|
|
<p><b>frac(x) = x − floor(x) </b></p>
|
|
<p>So: frac(−3.65) = (−3.65) − floor(−3.65) = (−3.65) − (−4) = −3.65 + 4 = <b>0.35</b></p>
|
|
<p align="center" class="larger"> </p>
|
|
<p><b>BUT</b> many calculators and computer programs use <b>frac(x) = x − int(x)</b>, and so their result depends on how they calculate <b>int(x)</b>:</p>
|
|
<ul>
|
|
<li>Some say frac(−3.65) = <b>0.35</b> i.e −3.65 − (−4)</li>
|
|
<li>Others say frac(−3.65) = <b>−0.65</b> i.e. −3.65 − (−3)</li>
|
|
</ul>
|
|
<p>So be careful using this function with negative values.</p>
|
|
</div>
|
|
<p> </p>
|
|
<div class="questions">
|
|
<script type="text/javascript">getQ(2434, 2435, 2436, 2437, 2438, 2439);</script>
|
|
</div>
|
|
|
|
<div class="related"><a href="functions-common.html">Common Functions Reference</a><a href="index.html">Sets Index</a></div>
|
|
<!-- #EndEditable --></div>
|
|
<div id="adend" class="centerfull noprint">
|
|
<script type="text/javascript">document.write(getAdEnd());</script>
|
|
</div>
|
|
<div id="footer" class="centerfull noprint">
|
|
<script type="text/javascript">document.write(getFooter());</script>
|
|
</div>
|
|
<div id="copyrt">
|
|
Copyright © 2017 MathsIsFun.com
|
|
</div>
|
|
|
|
<script type="text/javascript">document.write(getBodyEnd());</script>
|
|
</body>
|
|
<!-- #EndTemplate -->
|
|
<!-- Mirrored from www.mathsisfun.com/sets/function-floor-ceiling.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 29 Oct 2022 00:35:50 GMT -->
|
|
</html>
|