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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.135.139 with SMTP id r11mr248712ioi.73.1482256913604; Tue, 20 Dec 2016 10:01:53 -0800 (PST) X-Received: by 10.157.56.132 with SMTP id p4mr85439otc.20.1482256913578; Tue, 20 Dec 2016 10:01:53 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!b123no2104679itb.0!news-out.google.com!u18ni1779ita.0!nntp.google.com!75no2097391ite.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 20 Dec 2016 10:01:53 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=199.203.251.52; posting-account=ow8VOgoAAAAfiGNvoH__Y4ADRwQF1hZW NNTP-Posting-Host: 199.203.251.52 References: <8d0f7f03-9324-4702-9100-d6b8a1f16fc5@googlegroups.com> <18af86db-21fd-4fa0-90a3-c87b6486b439@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Trigonometric operations on x86 and x64 CPUs From: already5chosen@yahoo.com Injection-Date: Tue, 20 Dec 2016 18:01:53 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:32926 Date: 2016-12-20T10:01:53-08:00 List-Id: On Tuesday, December 20, 2016 at 7:27:32 AM UTC+2, Niklas Holsti wrote: > On 16-12-20 01:49 , already5chosen@yahoo.com wrote: > > On Tuesday, December 20, 2016 at 1:11:26 AM UTC+2, Randy Brukardt wrote= : > >> ... > >> There's also the little matter of meeting the Ada language requirement= s. The > >> people who put accuracy requirements on Ada numeric libraries might ha= ve > >> been "sensationalists"", but those of us implementing Ada have to abid= e by > >> those requirements. > > > > Unfortunately, I don't know where to look for Ada language requirement. > > Can you tell me what are requirements for sin/cos in Ada numeric librar= y? >=20 > RM section G.2.4, Accuracy Requirements for the Elementary Functions. >=20 > --=20 > Niklas Holsti > Tidorum Ltd > niklas holsti tidorum fi > . @ . Thank you. At first glance it seems that Randy Brukardt is correct. Assuming IEEE binary64, for any x in range [-2**26.5..2**26.5] requirements= want Sin(x) to return the number in range [exact_sin(x)*(1-d*2**53)..exact= _sin(x)*(1+d*2**(-53))] where d=3D2. x87 SIN instruction by itself achieves specified precision in smaller range= (~ up to abs(x) < 2^14). It means that conforming implementations of Ada libraries forced to spends= a significant effort doing reduction of stupidly big arguments of sin/cos/= tan. On the other hand The Requirements allow rather poor precision for sma= ll arguments (d=3D2) where better precision (d=3D1.25 or d=3D1.125) is both= desirable and not especially hard to achieve. There is a consolation, too - the range reduction in the minimal range requ= ired by the standard can be done without big tables. And it can be implemen= ted relatively quickly if the hardware features fused multiply-add. On somewhat related note,=20 It seems to me that forward trigonometric functions with 'Cycle' argument a= re underspecified. I'd like the requirements for extremely useful special c= ases of 'Cycle' =3D=3D exact power of 2 to be more pronounced.