> Programmers:
>
> Anyone have tips on how to ensure high precision in mathematical
> operations dealing with floats and doubles in C? These numbers will
> typically be dollars, and I don't want a lot of imprecise results when
> doing math on them. (Because floats and doubles represent decimal
> numbers as binary, they're very prone to loss of precision.)
>
You might try using BCD (Binary Coded Decimal) instead of floats. There are
several libraries available for Linux and Windows.
-- * The Digital Hermit http://www.digitalhermit.com * Unix and Linux Solutions kwan@digitalhermit.com ----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:26:07 EDT