3 ms·
How does one actually add with this?
by BobbyTables2 6mo ago
How does one actually add with this?
- bzax 6mo agoWell, once you've derived unary exp and ln you can get subtraction, which then gets you unary negation and you have addition.
- freehorse 6mo agoAnd then by using the fact that the exponential turns addition into multiplication, you get multiplication (and subtraction gives division).
- nick238 6mo agoDon'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?
- Charon77 6mo agox+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
- simplesighman 6mo agoThanks 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.
- xigoi 6mo ago> For larger or negative inputs you get a NaN because ECMAScript has limited precision and doesn't handle imaginary numbers. This also shows why EML is not practical for computation.
- curtisf 6mo agoIt's basically using the "-" embedded in the definition of the eml operator. Table 4 shows the "size" of the operators when fully expanded to "eml" applications, which is quite large for +, -, ×, and /. Here's one approach which agrees with the minimum sizes they present: eml(x, y ) = exp(x) − ln(y) # 1 + x + y eml(x, 1 ) = exp(x) # 2 + x eml(1, y ) = e - ln(y) # 2 + y eml(1, exp(e - ln(y))) = ln(y) # 6 + y; construction from eq (5) ln(1) = 0 # 7 After you have ln and exp, you can invert their applications in the eml function eml(ln x, exp y) = x - y # 9 + x + y Using a subtraction-of-subtraction to get addition leads to the cost of "27" in Table 4; I'm not sure what formula leads to 19 but I'm guessing it avoids the expensive construction of 0 by using something simpler that cancels: x - (0 - y) = x + y # 25 + {x} + {y}
- deleted 6mo ago[deleted]