On 10/2/07, Enno Gottox Boland <[EMAIL PROTECTED]> wrote: > > ...but it works... > It calculates as well as Excel :)
Oooooops! Still, it's faster :-) > ceil n.0 gives n+1 > e.g. ceil 0.0 gives 1 > if your system has /usr/bin/printf (not the bash builtin):: $ ceil () { /usr/bin/printf '%.0f' "$1"; } othwerwise:: $ ceil () { floor="$(floor "$1")"; if expr match "$1" '[0-9][0-9]*\.00*' >/dev/null; then echo $floor; else expr $floor + 1; fi; } $ ceil 0.0 0 $ ceil 0.000 0 $ ceil 0.1 1 Riccardo