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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: GNAT for AVR - Mathematical Functions Date: Mon, 17 Sep 2018 13:22:05 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="cf00840df14550e52ca040f5ce19eb38"; logging-data="12526"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18f0Q0Nj3in5IOm/AdGR/CLR2gvhLECDag=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (darwin) Cancel-Lock: sha1:ofelPbZbp3lrEI7L7Pe/llRyTpk= sha1:g8t1XItYwYxi1j/oFtl7c8tfWiU= Xref: reader02.eternal-september.org comp.lang.ada:54339 Date: 2018-09-17T13:22:05+01:00 List-Id: ada.newcomer@gmail.com writes: > I'm programming an ATmega328P with the GNAT compiler for AVR. > > I need to use the Sqrt, Arctan and Atan2 functions. But maybe in the > future I will need to use some more. > > I don't have access to the regular Ada.Numerics package. > > By now, I wrote the Sqrt using the Newton's method and Arctan using > Taylor series. > > I would like to know if there is a better way to use/implement > mathematical functions (maybe import them from C?). > > I really appreciate any help. For what it's worth, the FSF GCC arm-eabi compiler/runtime that I built imports the basic maths functions from the C library. This may be because I built the C library (newlib) first? The GNAT CE arm-eabi compiler goes to basics with very deep-looking code; possibly because it's "the Ada Cert Math specific version" (from s-libsin.ads), i.e. one with which AdaCore will support customers with certification requirements.