Skip to main content

Thread: correctly round in bash


10 divided 6 1.67, should rounded 2, bash rounds numbers down.
example:
php code:
echo $((10/6)) 
will output 1.

how solved?

appreciated.

so there implicit floor() in (10/6)? in case: $((10/6) + 0.5) ought do.


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk correctly round in bash


Ubuntu

Comments

Popular posts from this blog

DHT11 Time out error using v0.4.1library

Sketch upload fails with Java error (___REMOVE___/bin/avrdude)!

Arduino Uno + KTY81/210 temperature sensor