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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,263be80a3187b906 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news4.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: Jeffrey Carter Organization: jrcarter commercial-at acm [period | full stop] org User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.3) Gecko/20040910 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Differances in Ada and C++ on Sin and Cos References: <1113393007.545506.191160@l41g2000cwc.googlegroups.com> In-Reply-To: <1113393007.545506.191160@l41g2000cwc.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: Date: Wed, 13 Apr 2005 19:42:36 GMT NNTP-Posting-Host: 4.240.33.96 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.pas.earthlink.net 1113421356 4.240.33.96 (Wed, 13 Apr 2005 12:42:36 PDT) NNTP-Posting-Date: Wed, 13 Apr 2005 12:42:36 PDT Xref: g2news1.google.com comp.lang.ada:10437 Date: 2005-04-13T19:42:36+00:00 List-Id: ich_bin_elvis@hotmail.com wrote: > Does ada and C++ treat Cos and Sin functions different? I know arctan > and atan behaves different. But it seams like there is an different > behavior on the same program code written in ada and C++ on cos and sin > also. is there other functions that behaves deifferent that I should > be aware of? Ada generally requires greater accuracy from the elementary functions than other languages. ARM A.5.1 says "The results of the Sin, Cos, Tan, and Cot functions with specified cycle are exact when the mathematical result is zero; those of the first two are also exact when the mathematical result is � 1.0." A compiler that implements the Numerics Annex will also abide by the accuracy requirements of ARM G.2.4 (at least in strict mode, which may be the default mode; see ARM G.2). These can be difficult to read sometimes. I find "The maximum relative error exhibited by each function is as follows: 2.0 � EF.Float_Type'Model_Epsilon, in the case of the Sqrt, Sin, and Cos functions" "The absolute value of the result of the Sin, Cos, and Tanh functions never exceeds one." specific to Sin and Cos. Note that for GNAT 3.15p, which completely implements the Numerics Annex, strict mode is the default and only mode for the elementary functions. This is probably true for later versions of GNAT as well. -- Jeff Carter "Apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, the fresh water system, and public health, what have the Romans ever done for us?" Monty Python's Life of Brian 80