Skip to content

DeltixInc/DFP

 
 

Repository files navigation

Decimal Floating Point Arithmetic for Java/.NET

"...it is a bad idea to use floating point to try to represent exact quantities like monetary amounts. Using floating point for dollars-and-cents calculations is a recipe for disaster. Floating point numbers are best reserved for values such as measurements, whose values are fundamentally inexact to begin with." -- Brian Goetz

Java lacks built-in type to represent Money or Quantity properties frequently used in financial domain.

Ideal data type for this purpose:

  • Use base-10 (rather than base-2) to accurately represent monetary values
  • Support wide range of values (ranging from hundred of billions of that represent portfolio values to fractions of 6 to 8 below decimal point to represent smallest tick sizes)
  • Allow GC-free arithmetic (Garbage Collection pauses are evil in low-latency systems). This most likely implies using primitive data types.
  • fast (as fast as non-builtin numeric data type could be)
  • Support efficient conversion to String and double

DFP uses Java long to represent base-10 floating point numbers. DFP is based on IEEE-754 standard.

Description/Usage

Quick Start Guide

Building

How to build this project

Credits

This project was developed by Vitali Haravy. Special thanks to Boris Chuprin for helping with native code and testing of this library

License

This library is released under Apache 2.0 license. See (license)

About

Decimal Floating Point Arithmetic for Java/.NET

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages

  • Java 65.3%
  • C# 27.8%
  • C++ 2.6%
  • PowerShell 1.6%
  • Makefile 0.9%
  • C 0.9%
  • Shell 0.9%