Skip to content
ExamplesOpen editor ↗

atametsaGodimo

→ ceil()

Rounds a number up to the next whole number.

atametsaGodimo(palo)

The difference between atametsaGodimo and atametsa is that atametsaGodimo does not care about being near. However small the step above a whole number, it goes on to the next one:

  • atametsaGodimo(9.03) is 10
  • atametsaGodimo(9.97) is 10
  • atametsaGodimo(9) is 9 — already whole

Below zero, “up” means toward 0: atametsaGodimo(-4.2) is -4.

Use it when a thing cannot be split: if you need enough rows to hold everything, atametsaGodimo gives you the number of rows.

NameTypeDescription
palopaloThe number to round up.
Enough rows to hold everything
tiro setaLoeto() {
  thalaKanefase(400, 400);
  bokamorago(242);
  tlogelaMothalo();

  metlha dilo = 23;
  metlha moMoleng = 6;

  // 23 / 6 ke 3.83 — mme go tlhokega mela e le 4
  metlha mela = atametsaGodimo(dilo / moMoleng);
  kwala(mela);

  diri eThadilweng = 0;

  gopheta (diri m = 0; m < mela; m = m + 1) {
    gopheta (diri k = 0; k < moMoleng; k = k + 1) {
      fa (eThadilweng < dilo) {
        tlatsaMmala(60, 140 + m * 20, 210);
        thalaSediko(70 + k * 52, 90 + m * 70, 34);
        eThadilweng = eThadilweng + 1;
      }
    }
  }
}
Steps — every number goes up
tiro setaLoeto() {
  thalaKanefase(400, 400);
  bokamorago(22, 26, 36);
  tlogelaMothalo();

  gopheta (diri x = 0; x < 400; x = x + 4) {
    // 0..400 go ya go 0..5, e bo e ya kwa godimo
    metlha tepisi = atametsaGodimo(x / 80);

    tlatsaMmala(70 + tepisi * 30, 150, 220 - tepisi * 20);
    thalaKhutlonne(x, 360 - tepisi * 60, 4, tepisi * 60);
  }
}

atametsa, atametsaTlase, sesala, palotlalo