Could it be my algorithm is inefficient? I’ve read that it’s better to put your whole calculation into a single [expr] (as I have in this patch) rather than use a chain of math objects (which, by the way, produces the same inaccuracies).

I’d be grateful if you could try the patch on your machine and tell me if you experience the same inaccuracies, and also suggest how I might eliminate them. Thanks.