From: Oliver Kleinke <oliver.kleinke@c-01a.de>
Subject: Re: A curiosity about decimal fixed point types...
Date: Mon, 11 Nov 2013 19:54:05 +0100
Date: 2013-11-11T19:54:05+01:00 [thread overview]
Message-ID: <20131111195405.30842cb7@PC-8N-L> (raw)
In-Reply-To: 7d4f2e0c-0aed-4ba3-aa5a-0c2bc0c2c5a0@googlegroups.com
Am Mon, 11 Nov 2013 07:04:12 -0800 (PST)
schrieb mockturtle <framefritti@gmail.com>:
> Dear all,
> just a silly curiosity about decimal fixed point types, e.g.,
>
> type Euro is delta 0.01 digits 20;
> -- Would be 20 enough? :-)
>
> Are they currently used? Where? Since most of the examples are about
> money (mine and RM's) included, I guess that they were thought for
> financial applications, but I am unsure if nowadays financial
> software uses this type of types or just floating point.
>
> Best regards
>
> Riccardo
>
Hi Riccardo,
The type definition that you provided is a good example for using fixed
point types for accurate representation. With a fixed-point type you
can avoid the occasional precision problems that floating-point types
suffer from. (For example if I type "0.1 + 0.2" in my
Python-interpreter it yields 0.30000000000000004.)
This can be very important if you sum up/integrate a range of
measurement data obtained from a sensor -- for example a gyro.
Also, on some machines fixed-point arithmetic 'might' be faster than
floating-point arithmetic -- e.g. machines without FPU -- but I guess
that also very much depends on the operations and the compiler, &c.
next prev parent reply other threads:[~2013-11-11 18:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-11 15:04 A curiosity about decimal fixed point types mockturtle
2013-11-11 17:06 ` Mike H
2013-11-11 18:54 ` Oliver Kleinke [this message]
2013-11-11 19:58 ` AdaMagica
2013-11-12 12:31 ` Jacob Sparre Andersen
2013-11-14 13:12 ` Marius Amado-Alves
2013-11-14 14:20 ` gautier_niouzes
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox