Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

Commit

Permalink
fix programma
Browse files Browse the repository at this point in the history
  • Loading branch information
mc-cat-tty committed Nov 9, 2021
1 parent b2fe1ae commit 04e7367
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions esercitazioni/funzioni_reali.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ int main() {
}

double val_assoluto(double n) {
return n < 0 ? -1*n : n;
return n < 0. ? -n : n;
}

double arrotonda_per_eccesso(double n) {
if (val_assoluto(n)-static_cast<int>(val_assoluto(n)) == 0)
return n;

return n > 0 ?
static_cast<int>(n)+1
return n > 0. ?
static_cast<int>(n)+1.
: static_cast<int>(n);
}

double arrotonda_per_difetto(double n) {
if (val_assoluto(n)-static_cast<int>(val_assoluto(n)) == 0)
return n;

return n > 0 ?
return n > 0. ?
static_cast<int>(n)
: static_cast<int>(n)-1;
: static_cast<int>(n)-1.;
}

0 comments on commit 04e7367

Please sign in to comment.