|
Boost : |
Subject: [boost] New numeric data type proposal
From: Damian Alberto Vicino (damian.vicino_at_[hidden])
Date: 2014-03-23 14:11:16
Hi,
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.
Best regards,
Damian Vicino
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk