Math mooduli floor meetod

Mooduli math meetod floor ümardab arvu alati täisarvuks allapoole.

Süntaks

pythonimport math

math.floor(arv)

Näide

Ümardame arvu 25.78 allapoole:

pythonimport math

print(math.floor(25.78))

Koodi täitmise tulemus:

python25

Näide

Rakendame nüüd meetodit floor arvule -4.88:

pythonimport math

print(math.floor(-4.88))

Koodi täitmise tulemus:

python-5

Vaata ka

  • funktsioon round,
    mis ümardab arvu
  • mooduli math meetod ceil,
    mis ümardab arvu ülespoole