Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
pbsd
on June 5, 2016
|
parent
|
context
|
favorite
| on:
Mean of two floating point numbers can be dangerou...
There's this well-known identity [1] a + b = (a ^ b) + ((a & b) << 1). This is essentially how a parallel ripple carry adder works. So (a + b) / 2 = (a + b) >> 1 = ((a ^ b) >> 1) + (a & b).
[1]
http://www.inwap.com/pdp10/hbaker/hakmem/boolean.html#item23
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
[1] http://www.inwap.com/pdp10/hbaker/hakmem/boolean.html#item23