Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Math expression evaluation error?
On 2015-01-15 14:34:21 +0100, Vincent Lefevre wrote:
> > > But POSIX doesn't specify the arithmetic evaluation on expressions
> > > other than signed long integer arithmetic. An implementation that
> > > decides that $((1.0/2)) gives 17 "as an extension" could still be
> > > conforming.
> >
> > Nope, it cannot ever be conforming. POSIX does this by saying that
> > semantic of operation is the same as in C,
>
> Only for what it specifies.
BTW, note also that the ISO C standard doesn't specify the accuracy,
unless Annex F (IEEE 754) is supported (which is not required by
POSIX). So, even if the shell claims to implement floating-point
arithmetic, any floating-point number as the result of $((1.0/2))
would be conforming.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author