Re: Floating point: sine, cosine etc.

From: David Roberts <daver21145_at_gmail.com>
Date: Fri, 30 Sep 2022 16:24:48 +0100
Message-ID: <CAC5emFFr0HiNmZZ5PvY0KH5U=YWbPZTeD8us_7=60gzMgi0TQw_at_mail.gmail.com>
I don't disagree. But there are other, faster, ways of doing it using
tables of coefficients (if I again remember correctly from my days of
disassembling BASIC interpreters).

It all depends what the ultimate goal is at the end of the day.

In some instances I still code things from first principles that will work,
and the algorithms are fully documented in plenty of textbooks. If I then
require them to be optimised further, I perform the optimisation - but
leave the original code in (either as commentary as to what the optimised
code should still produce as answers, or conditionally compiled or
assembled so I can switch around for test and comparison purposes).

Dave

On Fri, 30 Sept 2022, 13:04 Michal Pleban, <lists_at_michau.name> wrote:

> David Roberts wrote on 29.09.2022 22:28:
>
> >  From what I remember, any continuous function can be expressed as a
> > power series. This should, therefore, also be possible for LN and LOG as
> > well as the trigonometric and hyperbolic functions etc.
>
> That is true, but the problem is how many steps you may need to
> approximate the function with desired accuracy. For SIN(X), which always
> returns a value from the range [-1; 1] it's around a dozen steps; for
> unbounded functions like LOG(X) you may need dozens or hundreds of steps
> which would render this method unpractical.
> Regards,Michau.
>
>
>
>
>
Received on 2022-09-30 18:00:07

Archive generated by hypermail 2.3.0.