in reply to Re^6: Need more precision.
in thread Need more precision.
My current approach is to think about it in two steps: First, if 128-bit ints are not supported natively, one needs routines to handle normal arithmetic operations on those (so you don't need to worry whether they are 2x 64-bit ints or even 4x 32-bit ints). That shouldn't be too difficult (it'd be the same basic idea as doing 16-bit math on an 8-bit uC), plus there seem to be a couple of libraries out there. E.g. Boost apparently has a int128_t and bigger (http://www.boost.org/doc/libs/1_53_0/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/cpp_int.html)... Math::Int128 apparently tries to use the native 128-bit ints, which as far as I understand from what I've read so far are not "officially" supported by MS, which would be my guess as to why the module has some CPAN Testers failures on Windows.
Second, use those routines to implement the fixed-point stuff. Addition and subtraction is pretty trivial; multiplication would either require a temporary 256-bit integer or some rounding; still doing research on the latter... you've piqued my curiosity :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Need more precision. (Updated.)(And again)
by BrowserUk (Patriarch) on Jun 10, 2015 at 00:28 UTC | |
by Anonymous Monk on Jun 10, 2015 at 01:25 UTC | |
by BrowserUk (Patriarch) on Jun 10, 2015 at 01:37 UTC | |
by Anonymous Monk on Jun 10, 2015 at 15:55 UTC | |
by BrowserUk (Patriarch) on Jun 10, 2015 at 20:07 UTC | |
|