|
Boost : |
Subject: Re: [boost] New numeric data type proposal
From: John Maddock (boost.regex_at_[hidden])
Date: 2014-03-24 04:28:52
> I work in a simulation tools' research group and we developed a basic data type for handling time representation that we want to share.
> The data type is kind of a mix between MultiPresicionFloatingPoint and Rational.
>
> We are using this kind of data type in concrete simulator implementations because of a theoretic problem with the formalisms we implement, in which the floating point error can not be bounded.
>
> We published a paper in Simutools14 a few days ago explaining how this unbound errors are reached under a specific formalism (DEVS) and why they are not easy to detect. I can share the paper if someone interested in the details, or provide some toy examples to discuss. And we are working in showing same kind of errors in other formalisms.
>
> A simplified version of the proposed data type is:
> Number<N, D, M, E> where in the common case the four are some integer-like type.
> The number can be interpreted as N/D * M * 2^E where N and D are never modified unless required for operation of compatibility.
> Compatibility operation is called when an operation between 2 numbers having different N/D happens.
> It can also be thought as a variable radix MPFP.
> We choose this implementation because when used as replacement of integer or float, it doesnt decrease significantly the performance. It only decrease significantly when operating with values that were not representable in any of those (if we simplify N/D).
>
> I will love to discuss implementation details, alternative ideas to handle the problem (this one worked for us, but sure there is other options too that may be more generic or performant in generic scenarios).
> Also, Im up to code the whole thing, and to share the naive implementation we got in our simulator so far to start the discussion.
This sounds interesting, though I'm not sure I understand the
rationale/functionality just yet. Are you aware of Boost.Multiprecision
(http://www.boost.org/doc/libs/1_55_0/libs/multiprecision/doc/html/index.html)
and would this fit within that framework? The answer probably depends
on whether you want/need the expression-template framework that that
library provides.
Regards, John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk