I think it was a sort of Newton-Raphson approach for sqrt(). Was OK. Not
that I need it, once I have big logs.

Performance WAS abysmal for logs, until I got sneaky. I prototyped in Rexx,
naturally :-)

I can't remember which one I chose, but one promising idea was to store a
table of logs, then divide down while totting up. Division is slow, but I
remember it was much better than any series I had heard of.

So think of loge(314.15926535897932)
~ 5.7499

Divide by 100, tot up loge(100) (already stored to ludicrous precision)

3.1415...
Divide by 3 and tot up loge(3)

1.04719...
divide by 1.03 and tot up.

I just checked and in 3 steps that's correct to 2 sig fig already, and
homing in on the 3rd, much tighter than all the series I tried, and quick
enough for interactive work and scripting up to 100 digits. Enough for
observable universe scale, so I stopped there :-)

Now I'm pretty sure I stuck with that approach.

>From memory I tried storing tables of data for loge() in each number base
(dec and bin) I wanted to work with. I must dig it out and see if it runs
in ooRexx. I jut found a note I e-mailed myself that says it passed in
Regina and matched 300 digit results from Wolfram, so I'm hopeful.

Roops

On Sat, 21 Jun 2025, 00:01 Paul Gilmartin, <
[email protected]> wrote:

> On Fri, 20 Jun 2025 23:14:38 +0100, Rupert Reynolds  wrote:
> >
> >MegaMathics in decimal I'd already done years ago, including trig, logs,
> >etc.
> >
> I'd imagine it would be a challenge to support Rexx's unlimited
> precision.  Truncated Taylor series would work, but performance
> would be abysmal.  I suspect that's the reason Rexx lacks an
> elementary functions library.
>
> >This all started because I wanted typed Rexx with (what I call)
> >conventional scoping. My middle name is Underestimator :-)
> >
> PROCEDURE EXPOSE does some of that, but statically nested
> functions are missing.  what I miss most are ITERATE and
> LEAVE naming a variable exposed from a calling function.
>
> --
> gil
>
>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to