# Tag Info

0

05AB1E (legacy), 32 bytes bD€¨©C^s€θ·<P®€S.sR‚ζOÆ.±!P*¨ì Input as two integers where the trailing bit of its binary representation represents the negative (0) or positive (1) (i.e. input 24 is -12/-1100 and input 25 is 12/1100). Try it online or verify some more test cases. Explanation: b # Convert both integers in the (implicit) ...

1

Ruby, 98 ... 62 bytes ->c,w,d,x{[c^d,w*x*(~k=0)**((0..c+d).sum{|x|c[x]*k+=d[x-1]})]} Try it online! Input: [abs(a),sign(a),abs(b),sign(b)] Output: [abs,sign] Thanks Arnauld for the idea of splitting input and for shaving a couple of bytes. How it works: The sign is determined by the number of hops: example: e3*(e1e2) = -e1e3*(e2) = (-e1)*(-e2e3) = ...

0

JavaScript (ES6),  73  65 bytes Expects (a)(b), two integers where the least significant bit holds the sign ($0$ for positive, $1$ for negative) and all other bits are used to store the absolute value. Returns the product $c$ in the same format. a=>b=>a^b^(g=a=>(b/=2)&&(h=n=>b&!!n&&!h(n&~-n))(a)^g(a>>1))(a>&...

Top 50 recent answers are included