Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: why do ceil/floor give the decimal dot?



On Wed, 13 May 2015 23:53:53 -0400
Lawrence Velázquez <vq@xxxxxxxxx> wrote:
> - "ceil(log(30)/log(2))" returns floating-point "5."

... as noted, this is down to the C math library function returning
floating point.   It has to do this because it doesn't know the result
fits in an integer --- ceil(5e30) is a perfectly valid calculation.  See
the manual page.

So if you're happy it does fit, just convert to integer yourself.

pws



Messages sorted by: Reverse Date, Date, Thread, Author