in reply to Re^2: Need more precision.
in thread Need more precision.

Got that, but Fixed-point arithmetic "is essentially an integer that is scaled by an implicit specific factor determined by the type. For example, the value 1.23 can be represented as 1230 in a fixed-point data type with scaling factor of 1/1000". This should work since you said your min/max is -4.0 to 4.0, which could be represented in a 128-bit integer as, for example, 0 to 80000000000000000000000000000000000000.

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

    Okay. I'll bite.

    Are you suggesting that I use 2 of salva's 128-bit integers to implement my own fixed-point math?

    Or are you suggesting that there is some way to use single 128-bit integers to store both a 64-bit precision and the fixed point mantissa; and have the existing 128-bit integer operations sort out he fixed-point stuff for me?


    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

      I was initially thinking the former... I'm a little confused about the latter suggestion, since I'm not sure integer operations would "sort out" floating point stuff, one would still have to implement some of the operations oneself, so it sounds like implementing a custom 128-bit floating point type...?

      Still doing a bit of research myself out of curiosity, so no perfect answers yet, but what about something like https://software.intel.com/en-us/articles/intel-decimal-floating-point-math-library - apparently up to 34 decimal digits in 128 bits?

        I'm a little confused about the latter suggestion, since I'm not sure integer operations would "sort out" floating point stuff,

        That's my understanding also; but I was hoping ... :)

        I have native 64-bit ints; so combining two of those to give me fixed point would give huge precision; no need to move to two 128-bit integers.

        But I'm fuzzy on the implementation of fixed point floats using two ints. If you come across any pointers/notes/implementations I'd love to hear of it.


        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