[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Exchange pow/frexp/ldexp (Lua power calculation)
- From: Flyer31 Test <flyer31@...>
- Date: Mon, 18 Oct 2021 15:47:47 +0200
thank you for fast answer - sorry for misunderstanding.
I do not want to change this in Lua code.
I want to change the C machine of Lua to use my own frexp (some new
function, which I write by myself, e. g. myfrexp).
On Mon, Oct 18, 2021 at 3:29 PM Doug Currie <firstname.lastname@example.org> wrote:
> On Oct 18, 2021 at 9:15:53 AM, Flyer31 Test <email@example.com> wrote:
>> do you possibly some "most easy way" proposal, if I want to replace
>> the exponentiation by some "own calculation"?
>> (my STM32G473 controller has a so-called CORDIC interface for
>> high-speed calculation of sin, cos, tan, exp, log, sqrt on board, so I
>> want to use this for my Lua.
> Using logarithmic identities, you can change b ^ x to K ^ (x * logK(b))
> It looks more complicated, but if K is a convenient value, such as 2 or 10 or e, it becomes much easier.
> For example, if K is e, then b ^ x = exp(x * ln(b))
> If you have exp and ln in your library, you’re in luck, though you may need to deal with some edge cases.