Re: problem with euphoria's power()

new topic     » goto parent     » topic index » view thread      » older message » newer message

>If we had the log10 function instead of the natural logs function, we could 
>get any root
>or power by using that function:
>
>atom = 10E(0.3 x log(1728))
>-- atom = 12
>
>Kat

Here's some code I coppied from a math library I wrote a while ago.  It lets 
you get logarighms with any base. (10, 16 and 8 are sped up a little)

-- logarithms --

constant log10 = log(10),
        log16 = log(16),
        log8 = log(8)

global function declog(object x)
    return log(x) / log10
end function

global function hexlog(object x)
    return log(x) / log16
end function

global function octlog(object x)
    return log(x) / log8
end function

global function customlog(object x, object base)
    return log(x) / log(base)
end function


regards,
Daryl van den Brink

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu