Skip to content

D implementation of floating point decimal data type according to IEEE754-2008

Notifications You must be signed in to change notification settings

rjframe/decimal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

decimal

D implementation of floating point decimal data type according to IEEE-754-2008

Why

  • 1.1 + 2.2 = 3.3 (decimal) but 1.1 + 2.2 = 3.3000000000000003 (float)

  • 0.45 = 0.45 (decimal) but 0.45 = 0.450000018 (float)

Features:

  • fully IEEE-754-2008 compliant;
  • using Intel's binary decimal enconding;
  • three decimal data types: decimal32, decimal64 and decimal128
  • all D operators supported for all numeric types (left and right side integrals, floats, chars);
  • conversion supported from/to integrals, floats, bools, chars
  • conversion to other decimal formats (Microsoft Currency, Microsoft Decimal, IBM Densely Packed Decimal)
  • all std.math functions implemented (even logarithms and trigonometry);
  • all format specifiers implemented (%f, %e, %g, %a);
  • integrated with phobos format and conversion functions (to, format, writef);
  • thread local precision (from 1 to 34 decimal digits);
  • new rounding mode - Europe's most used - tiesToAway;
  • alternate exception handling (through flags);
  • minimal dependencies (some traits and some floating point functions);
  • comprehensive documentation;

Documentation: http://rumbu13.github.io/decimal/doc/decimal.html

About

D implementation of floating point decimal data type according to IEEE754-2008

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages