Re: [CLN-list] CLN-list Digest, Vol 91, Issue 2
Thanks, it works for me! Po-Hsun Tseng (Rocky) On Mon, Feb 10, 2020 at 7:00 PM <cln-list-request@ginac.de> wrote:
Send CLN-list mailing list submissions to cln-list@ginac.de
To subscribe or unsubscribe via the World Wide Web, visit https://www.ginac.de/mailman/listinfo/cln-list or, via email, send a message with subject or body 'help' to cln-list-request@ginac.de
You can reach the person managing the list at cln-list-owner@ginac.de
When replying, please edit your Subject line so it is more specific than "Re: Contents of CLN-list digest..."
Today's Topics:
1. Re: adding two different precision number (Po-Hsun Tseng) 2. print multi-precision floating number in scientific notation (Po-Hsun Tseng) 3. Re: print multi-precision floating number in scientific notation (Richard B. Kreckel)
----------------------------------------------------------------------
Message: 1 Date: Sun, 9 Feb 2020 21:35:30 +0800 From: Po-Hsun Tseng <zengbs@gmail.com> To: Bruno Haible <bruno@clisp.org> Cc: cln-list@ginac.de Subject: Re: [CLN-list] adding two different precision number Message-ID: < CA+HRcQvs_sxgtgZU7z4qR_1shrhTo2YWmNPfee2Lx9gDpdQkPg@mail.gmail.com> Content-Type: text/plain; charset="utf-8"
Dear Bruno,
Thank you for your quick and detailed reply.
Po-Hsun Tseng (Rocky)
On Sun, Feb 9, 2020 at 6:37 PM Bruno Haible <bruno@clisp.org> wrote:
Hi,
1. Does CLN support performing two different precision number with basic overloading operators (+,-,*, and /)?
Yes.
2. If yes, how does CLN treat that? eg. zero padding on the precision-less number before doing operation?
It does zero-padding on the operand with the smaller precision, then the operation on the then equal-size operands, and finally rounding (round-to-even) to the smallest precision among the operands.
Example (using decimal numbers for illustrative purposes):
3.14149265358979323 + 2.718282 --------------------- 3.14149265358979323 + 2.71828200000000000 --------------------- 5.85969465358979323 --------------------- 5.859695
Therefore, when some computation returns a result, usually a few decimal places at the end can be wrong, but CLN will never give you a 50-digit result when in fact the accurary is only 10 digits - UNLESS you use conversion functions [1] explicitly.
Bruno
participants (1)
-
Po-Hsun Tseng