25.06.2013 Views

Cours et activités en arithmétique pour les classes ... - Robert Rolland

Cours et activités en arithmétique pour les classes ... - Robert Rolland

Cours et activités en arithmétique pour les classes ... - Robert Rolland

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

58 Chapitre 4<br />

4.2.2 Quelques fonctions élém<strong>en</strong>taires liées aux <strong>en</strong>tiers<br />

Il existe quelques fonctions classiques simp<strong>les</strong> définies sur R, qui pr<strong>en</strong>n<strong>en</strong>t<br />

des valeurs <strong>en</strong>tières :<br />

trunc(x) : c<strong>et</strong>te fonction associe à x l’<strong>en</strong>tier situé <strong>en</strong>tre x <strong>et</strong> 0 le plus<br />

proche de x.<br />

trunc(−3.1) = −3,<br />

trunc(2.6) = 2,<br />

trunc(3) = 3.<br />

round(x) : c<strong>et</strong>te fonction associe à x l’<strong>en</strong>tier le plus proche de x. Dans<br />

le cas où on tombe exactem<strong>en</strong>t <strong>en</strong>tre deux <strong>en</strong>tiers on choisit celui de plus<br />

grande valeur absolue.<br />

round(2.1) = 2,<br />

round(−3.8) = −4,<br />

round(5.5) = 6,<br />

round(−3.5) = −4.<br />

frac(x) : c<strong>et</strong>te fonction associe à x sa partie fractionnaire, c’est-à-dire<br />

frac(x) = x − trunc(x).<br />

frac(2.3) = 0.3,<br />

frac(−4.7) = −0.7.<br />

floor(x) : c<strong>et</strong>te fonction associe à x le plus grand <strong>en</strong>tier ≤ x.<br />

floor(4.6) = 4,<br />

floor(5) = 5,<br />

floor(−3.1) = −4.<br />

ceil(x) : c<strong>et</strong>te fonction associe à x le plus p<strong>et</strong>it <strong>en</strong>tier ≥ x.<br />

ceil(4.6) = 5,<br />

ceil(5) = 5,<br />

ceil(−3.1) = −3.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!