Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Rational numbers operation
- X-seq: zsh-users 14397
- From: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxxxxx>
- Subject: Re: Rational numbers operation
- Date: Wed, 16 Sep 2009 04:46:14 -0400 (EDT)
- In-reply-to: <20090916101212.40dc7009.tartifola@xxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20090916101212.40dc7009.tartifola@xxxxxxxxx>
On Wed, 16 Sep 2009, tartifola@xxxxxxxxx wrote:
>
>
> Hi,
> a newbie question on operations with rational numbers with the zshell.
> If I try from the shell
>
> >echo $((100.5 * 0.001 ))
>
> I got the correct result without any error. On the contrary if I try the same thing in script I get this error
>
> syntax error: invalid arithmetic operator (error token is ".5 * 0.001 ")
>
> I'm sure I'm missing something very basic, any hints?
> Thanks
Perhaps you're not using the shell you think you are:
$ zsh -c 'echo $((100.5 * 0.001))'
0.10050000000000001
$ sh -c 'echo $((100.5 * 0.001))'
sh: 100.5 * 0.001: syntax error: invalid arithmetic operator (error token
is ".5 * 0.001")
Best,
Ben
Messages sorted by:
Reverse Date,
Date,
Thread,
Author