Math: n-th root, logarithm with arbitrary base

Axel Rauschmayer axel at rauschma.de
Mon Dec 19 03:00:42 PST 2011


But wouldn’t that rather be a reason for making these functions part of the core language?

On Dec 19, 2011, at 8:48 , Erik Corry wrote:

> Both the proposed implementations do fp rounding twice, and so produce
> an inaccurate answer.  I think we should probably leave it to the user
> to define incorrect math functions, rather than bake them into the
> language.
> 
>> I haven’t seen these two functions among the proposed additions for Math (should these be in a math module?):
>> 
>>    function nthRoot(n, x) {
>>        return Math.pow(x, 1/n);
>>    }
>> 
>>    function log_b(b, x) {
>>        return Math.log(x) / Math.log(b);
>>    }
>> 
>> Have they been considered and rejected?

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111219/614e158e/attachment-0001.html>


More information about the es-discuss mailing list