# NavList:

## A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding

**Re: Calculators, cosines, and floating point computation**

**From:**Brad Morris

**Date:**2019 Jun 10, 14:39 -0400

Brad, you wrote:

"I like the trick of a computation compared to the define. Clever."Haven't seen that one, eh? It's right out of the Mesozoic! Representing pi as 4·atan(1) used to be quite standard coding practice ...in the before time ...when code came on cards.

You wrote:

"I was tasked at GE with finding anbug. "indideousI think I found the source of your bug. :)

Back to π... calculating tricks, like using the atan or the acos were common even two decades ago, but most languages and computation tools now provide a "safe" internal pi. You can search on "math.pi" for examples of these. You'll find some variant of that constant in the "math" object in javascript, lua, python, java... the list goes on. And in most spreadsheets, you get a system-precision limited value for pi using a standard math function =pi(). For everything you might ever do in navigation, these built-in values are the way to go. There are still rare cases where you may want more digits for some exercise in pure mathematics, and this is a nice application of

Wolfram Alpha. Want pi to fifty digits? Then query with that exact text: https://www.wolframalpha.com/input/?i=pi+to+50+digits.Frank Reed

PS: A reminder: the radius of the Earth is 3438 nautical miles... 'cause there's pi inside...