From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e55245590c829bef X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!t35g2000yqj.googlegroups.com!not-for-mail From: Shark8 Newsgroups: comp.lang.ada Subject: Re: _Type vs no _Type Date: Sat, 6 Nov 2010 19:57:33 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <86wroy58ff.fsf@gareth.avalon.lan> <86pqup5xfy.fsf@gareth.avalon.lan> <86y69d3rec.fsf@gareth.avalon.lan> <82lj5c5ecm.fsf@stephe-leake.org> <82zktq4n9b.fsf_-_@stephe-leake.org> <4cd53555$0$7665$9b4e6d93@newsspool1.arcor-online.net> <2eff1732-3608-493b-bb80-114313e50b88@u10g2000yqk.googlegroups.com> NNTP-Posting-Host: 174.28.219.200 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1289098653 22735 127.0.0.1 (7 Nov 2010 02:57:33 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 7 Nov 2010 02:57:33 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: t35g2000yqj.googlegroups.com; posting-host=174.28.219.200; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 ( .NET CLR 3.5.30729; .NET4.0E),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:15362 Date: 2010-11-06T19:57:33-07:00 List-Id: On Nov 6, 3:58=A0pm, Yannick Duch=EAne (Hibou57) wrote: > > Excepting floating point numbers; addition is commutative, isn't it? > > I would welcome an example here. Does not mean I do not believe that (I = =A0 > know floating points easily leads to trouble), just that I would like to = =A0 > understand, as I always though even with floating points, the addition is= =A0 > commutative. The general way to show the non-commutativity of floating-point would be something like the initialization of the number to something large, say a hundred-million, and some repetitive additions of some small number say a hundred-thousand hundred-thousandths, so that what you would expect mathematically would be a hundred-million and one would actually have the value one hundred million. The reason for this is that the "largeness" of the floating point number at the start causes all the small values to be dropped so that after the addition you are left with the large number itself. Whereas if you were to reverse the order of the additions; initialize to zero and do the repeated additions of the smaller number followed by the large number you are likely to get the correct result. I've heard someone tell a story where they had to disable optimization on their compiler because it was changing the order of operations for a floating-point number and giving results as described. > > What kind of addition algorithm can end into a none-commutative addition = ? > http://en.wikipedia.org/wiki/Quaternion These are non-communative on multipclation and are, basically, to the complex-numbers what the complex-numbers are to real numbers.