3 ms·
The default calculator on Android since Marshmallow apparently uses arbitrary precision arithmetic: https://m-cacm.acm.org/magazines/2017/8/219594-small-data-co
by jwmerrill 7y ago
The default calculator on Android since Marshmallow apparently uses arbitrary precision arithmetic: https://m-cacm.acm.org/magazines/2017/8/219594-small-data-computing/fulltext https://m-cacm.acm.org/magazines/2017/8/219594-small-data-co...
- thaumasiotes 7y agoThat was a great read. The purity of the approach is tainted (in a helpful way, not a bad way) by a note at the end: > The most recent versions of our calculator explicitly track rational multiples of π and some other common irrational constants. This allows us to compute a rational result for sin(π/6) in radian mode, as we already did for sin(30°). When I mentioned arcsines above, that wasn't a coincidence -- radians are convenient, but they're also impossible to measure exactly, and when your computation goes through a trig function, you may unavoidably lose the ability to state your results exactly (except by invoking a function name like "arcsine"). That isn't as much of a theoretical obstacle as it might sound like -- you can't state square roots exactly either, except by referring to the concept "square root". But they can be a little more conceptually direct -- trig functions are inextricably bound up with pi, and it's hard -- impossible -- to recognize pi when it appears in your input, unless it appears as the symbol π.