egg changed the topic of #principia to: Logs: https://esper.irclog.whitequark.org/principia | <scott_manley> anyone that doubts the wisdom of retrograde bop needs to get the hell out | https://xkcd.com/323/ | <egg> calculating the influence of lamont on Pluto is a bit silly…
_whitenotifier-9439 has quit [Ping timeout: 198 seconds]
<queqiao-->
<Qazerowl> Does it really matter that the returned result is mathematically correct as long as it's the same result across all platforms?
<queqiao-->
<sichelgaita> Yes, otherwise you can never change your implementation. If you think of a smart optimization, you cannot do it because you will change the results.
<queqiao-->
<Qazerowl> But if you demanded perfect accuracy, you wouldn't be able to use that performant optimization anyway unless it happened to be perfectly accurate. And I assume exciting new perfectly-accurate optimizations for sin/cos don't pop up too often.
<queqiao-->
<egg> That really isn’t how any of this works.
<queqiao-->
<egg> A correctly rounded (that is a technical term, not « perfectly accurate ») implementation of a function is typically a pretty normal implementation of that function (still a good one, faithfully rounded, and correctly rounded for most inputs) paired with a test for a risk of misrounding and a slow path.
<queqiao-->
<egg> The performance of the slow path essentially doesn’t matter because it is a once-in-a-million thing. And the fast path is ordinary enough that the implementation tradeoffs change as they do for other implementations (between large or small tables, divisions vs. other operations, etc.).
<queqiao-->
<egg> So, e.g., Principia has 2 different implementations of a correctly-rounded cube root, depending on whether we can use FMA in the faithful fast path. And there are plenty of other options we have considered for that fast path; some of them might become more performant than the ones we currently use as architectures change.
<queqiao-->
<sichelgaita> "... as architectures change" is really important because architectures actually change all the time. Over the course of my career I have seen "don't use floating-point, do everything in integer" and then in sequence "use the x87 instructions they are pretty fast and pretty accurate", "don't use x87, use the native fp and use tables if they can save fp operations", "don't use tables, memory is slow and you have
<queqiao-->
multiple fp units anyway", and at the moment the trade-off is "caches are so big that your table will be in the cache all the time, so tables are good again". I fully expect that the trade-offs will be different 5 years from now. (@egg also points out "division bad", "division good", "division bad", "division good".)