lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi Doug,
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 <doug.currie@gmail.com> wrote:
>
> On Oct 18, 2021 at 9:15:53 AM, Flyer31 Test <flyer31@googlemail.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.
>
> e
>