logoalt Hacker News

nick238today at 3:50 AM2 repliesview on HN

Don't know adding, but multiplication has diagram on the last page of the PDF.

xy = eml(eml(1, eml(eml(eml(eml(1, eml(eml(1, eml(1, x)), 1)), eml(1, eml(eml(1, eml(y, 1)), 1))), 1), 1)), 1)

From Table 4, I think addition is slightly more complicated?


Replies

simplesighmantoday at 4:28 AM

Thanks for posting that. You had a transcribing typo which was corrected in the ECMAScript below. Here's the calculation for 5 x 7:

    const eml = (x,y) => Math.exp(x) - Math.log(y);
    const mul = (x,y) => eml(eml(1,eml(eml(eml(1,eml(eml(1,eml(1,x)),1)),eml(1,eml(eml(1,eml(y,1)),1))),1)),1);
    console.log(mul(5,7));
> 35.00000000000001

For larger or negative inputs you get a NaN because ECMAScript has limited precision and doesn't handle imaginary numbers.

Charon77today at 4:17 AM

x+y = ln(exp(x) * exp(y))

exp(a) = eml(a, 1) ln(a)=eml(1,eml(eml(1,a),1))

Plugging those in is an excercise to the reader

show 1 reply