Welcome to the NavList Message Boards.

NavList:

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

Compose Your Message

Message:αβγ
Message:abc
Add Images & Files
    Name or NavList Code:
    Email:
       
    Reply
    Re: Calculators, cosines, and floating point computation
    From: Brad Morris
    Date: 2019 Jun 10, 14:39 -0400
    Frank

    Sometimes, I misspell a word.  It happens.  Whoops!

    I somehow missed that calculation and comparison trick.  Not the calculation part.  The comparison of the calculated value with the define as a way to guard against sneaky errors.

    #defines were plenty good enough for me.  Define more digits than you need for floating point implementation. Diff the code against the prior version, prior to placing code into version control.  Fairly well eliminates keystroke errors (except the initial case).

    I'd say we have drifted well away from CN by this point.  Call this thread a wrap?

    Brad 

    On Mon, Jun 10, 2019, 1:33 PM Frank Reed <NoReply_FrankReed@navlist.net> wrote:

    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 an indideous bug. "

    I 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...

    File:


       
    Reply
    Browse Files

    Drop Files

    NavList

    What is NavList?

    NavList is a community devoted to the preservation and practice of celestial navigation and other methods of traditional position-finding. We're a group of navigators, navigation enthusiasts and hobbyists, mathematicians and physicists, and historians interested in all aspects of navigation but primarily those techniques which are non-electronic.

    To post a message, if you are already signed up as a NavList member, start a new discussion or reply to any posted message and use your posting code (this is a simple low-security password assigned when you join). You may also join by posting. Your first on-topic messsage automatically makes you a member, and a posting code will be assigned and emailed to you for future posts.

    Uniquely, the NavList message boards also permit full interaction entirely by email. You can optionally receive individual posts or daily digests by email, and any member can post messages by email (bypassing the web site) by sending to our posting address which is "NavList@NavList.net". This functionality is similar to a traditional Internet mailing list: post by email, read by email, reply by email. Most members will prefer the web interface here for posting and replying to messages.

    NavList is more than an online community... more about that another day.

    © Copyright notice: please note that the rights to all messages and posts in this discussion group are held by their respective authors. No messages or text or images extracted from messages may be reproduced without the explicit consent of the message author. Email me, Frank Reed, if you have any questions.

    Join / Get NavList ID Code

    Name:
    (please, no nicknames or handles)
    Email:
    Do you want to receive all group messages by email?
    Yes No

    A NavList ID Code guarantees your identity in NavList posts and allows faster posting of messages.

    Retrieve a NavList ID Code

    Enter the email address associated with your NavList messages. Your NavList code will be emailed to you immediately.
    Email:

    Email Settings

    NavList ID Code:

    Custom Index

    Subject:
    Author:
    Start date: (yyyymm dd)
    End date: (yyyymm dd)

    Visit this site
    Visit this site
    Visit this site
    Visit this site
    Visit this site
    Visit this site