in reply to Need more precision.

Min and max?

Just a few digits more, or even more than that?

Which compiler?

Replies are listed 'Best First'.
Re^2: Need more precision.
by BrowserUk (Patriarch) on Jun 09, 2015 at 20:45 UTC

    MIn & max: +-4.0

    At least 80-bits/18 digits, 128-bits/34 digits. would be perfect.

    MSVC.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
    In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked

      How about fixed point arithmetic? If 18 digits really is "good enough", then a signed 64 bit int will give you 18 digits (int part plus 17 decimal places). If you need more, does the compiler have a 128 bit int type? If not, you could code routines that cascade a signed 64 with an unsigned 64 to give you a signed 128.

        This is what is tickling the back of my brain; but I'm stuck as to how to implement it?

        As an example of when I run out of precision: I have the value: 0.0000000045 that I have to multiply by itself: 0.00000000000000002025 which becomes 0.0000000000000000 with doubles.

        I'm thinking about something along the lines of storing that as: [-10, 45]; multiply it by itself and I get [-20, 2025].

        Using a single byte for the fixed point will get me down to +-1e-127 which is probably more than enough to be going on with.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
        In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked