From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15864 invoked by alias); 9 Jan 2015 23:07:01 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34196 Received: (qmail 20690 invoked from network); 9 Jan 2015 23:06:58 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=larryv.me; h= x-sasl-enc:content-type:mime-version:subject:from:in-reply-to :date:cc:content-transfer-encoding:message-id:references:to; s= mesmtp; bh=pp20zOwSm0UQFiT93xuu35NR+y8=; b=T1w3a2ouJPwRuDRhsckTV lgOhDr3DATmO8Za8WWOYjrmgq83+CyUrq/8dQtXn+cKY2FYBD1hut9eHyYU2ZPpW UNmfx4bQyQSMay5YC7b5NbxJLOQ49gHyorv7y4G2LmSvVLc7hj61vFBYNGTZFSgU DHlBxoDrGGIV5Kt+dZnnQ4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:content-type:mime-version :subject:from:in-reply-to:date:cc:content-transfer-encoding :message-id:references:to; s=smtpout; bh=pp20zOwSm0UQFiT93xuu35N R+y8=; b=VbZJYuXShJzxPgFNB/tLUhHAXgReJH1dlmZ/ksfauFTvk3x5JRav/te igZU4mCDc2HZ0FmMDc9ZeDSyvU9WR7RW03UV5SelkbXKQpsqL+9S6g32gBOFIzJW w0B6L4fj6wvILROBTj2N4DplWMsn8bczIVC7LZ0wNqe0aG788mGE= X-Sasl-enc: Ty8j9YSaPyRbBHZKZl2m45Xr4YoHqySK4lGFFU7t0wzT 1420844816 Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Subject: Re: Math expression evaluation error? From: =?windows-1252?Q?Lawrence_Vel=E1zquez?= In-Reply-To: <54B05407.7090303@eastlink.ca> Date: Fri, 9 Jan 2015 18:06:56 -0500 Cc: zsh-workers@zsh.org Content-Transfer-Encoding: quoted-printable Message-Id: <775A96D9-12A6-499B-8AAB-B2431F13701D@larryv.me> References: <54B03024.1030309@gmail.com> <20150109201552.1304eafe@ntlworld.com> <54B04ADA.9050102@gmail.com> <54B05407.7090303@eastlink.ca> To: Ray Andrews X-Mailer: Apple Mail (2.1993) On Jan 9, 2015, at 5:19 PM, Ray Andrews wrote: > I wonder tho why anyone would ever want the first set of results. = Who/why/when > do we want bad math? Mathematics restricted to the set of integers is not "bad math", no = matter how much you assert that it is. > Wouldn't we prefer accurate results as the default with the option to = have broken math for people who like broken math? Stop calling it "broken". It's the way C does math. % clang -Wno-format -o c-integer-div -x c - < #include heredoc> int main(void) { heredoc> printf("integer division is not 'bad math': 3 / 8 =3D = %f\n", 3 / 8); heredoc> return 0; heredoc> } heredoc> EOF % ./c-integer-div integer division is not 'bad math': 3 / 8 =3D 0.000000 At this point, this is what a lot of programmers expect, especially = since the rest of zsh's arithmetic is quite C-like. > Why not have it work properly and that's that--nothing to explain, it = just works as you'd expect it to work? It'd work as YOU expect it to work. Plenty of other people expect it to = work like C, and we'd have to explain to them why it doesn't. (We = already have to do so for operator precedence and hexadecimal literals, = among other things.) > 6 + 3/8 + 10 + 5/8 ... > what sane calculator is going to give me '16' for that? zsh is not a calculator. vq=