All Projects → robaho → Fixed

robaho / Fixed

Licence: mit
high performance fixed decimal place math library for Go

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Fixed

Ta Rs
Technical analysis library for Rust language
Stars: ✭ 248 (-5.7%)
Mutual labels:  financial, math
Mathnet Symbolics
Math.NET Symbolics
Stars: ✭ 256 (-2.66%)
Mutual labels:  math
SharpMath2
2D math / geometry collision library for C#, compatable with monogame.
Stars: ✭ 36 (-86.31%)
Mutual labels:  math
js-utils
A collection of dependency-free JavaScript utilities 🔧
Stars: ✭ 22 (-91.63%)
Mutual labels:  math
exponential-moving-average
Calculate an exponential moving average from an array of numbers.
Stars: ✭ 41 (-84.41%)
Mutual labels:  math
Django Ledger
A bookkeeping & financial analysis engine for the Django Framework. UNDER ACTIVE DEVELOPMENT & NOT STABLE YET.
Stars: ✭ 253 (-3.8%)
Mutual labels:  financial
elementary-math
初等数学笔记,LaTeX 排版,内容涉及代数、数论、几何、组合等。
Stars: ✭ 68 (-74.14%)
Mutual labels:  math
Home
Project Glimpse: Node Edition - Spend less time debugging and more time developing.
Stars: ✭ 260 (-1.14%)
Mutual labels:  performance
Query track
Find time-consuming database queries for ActiveRecord-based Rails Apps
Stars: ✭ 258 (-1.9%)
Mutual labels:  performance
blog
Blog colaborativo sobre matemáticas e informática de la comunidad de @libreim.
Stars: ✭ 27 (-89.73%)
Mutual labels:  math
imath
Arbitrary precision integer and rational arithmetic library
Stars: ✭ 92 (-65.02%)
Mutual labels:  math
StuyLib
Award-Winning FRC Library by StuyPulse Team 694
Stars: ✭ 17 (-93.54%)
Mutual labels:  math
Rz Go
Ripzap - Fast and 0 allocs leveled JSON logger for Go ⚡️. Dependency free.
Stars: ✭ 256 (-2.66%)
Mutual labels:  performance
IwEngine
This is an engine that I initially started building after taking a game coding class in high school. I didn't like Unity so tried to make something more code focused that was personally easier to use.
Stars: ✭ 97 (-63.12%)
Mutual labels:  math
Metered Rs
Fast, ergonomic metrics for Rust
Stars: ✭ 258 (-1.9%)
Mutual labels:  performance
mightyscape-1.X
A maintained extension collection for Inkscape 1.0+, working on Windows and Linux
Stars: ✭ 23 (-91.25%)
Mutual labels:  math
algorithm
📌 Notes and Codes for studying data structures and algorithm
Stars: ✭ 72 (-72.62%)
Mutual labels:  math
Kboom
The Kubernetes scale & soak load tester
Stars: ✭ 256 (-2.66%)
Mutual labels:  performance
Deepc
vendor independent deep learning library, compiler and inference framework microcomputers and micro-controllers
Stars: ✭ 260 (-1.14%)
Mutual labels:  performance
Xits
XITS - OpenType implementation of STIX fonts with math support
Stars: ✭ 257 (-2.28%)
Mutual labels:  math

Summary

A fixed place numeric library designed for performance.

All numbers have a fixed 7 decimal places, and the maximum permitted value is +- 99999999999, or just under 100 billion.

The library is safe for concurrent use. It has built-in support for binary and json marshalling.

It is ideally suited for high performance trading financial systems. All common math operations are completed with 0 allocs.

Design Goals

Primarily developed to improve performance in go-trader. Using Fixed rather than decimal.Decimal improves the performance by over 20%, and a lot less GC activity as well. You can review these changes under the 'fixed' branch.

If you review the go-trader code, you will quickly see that I use dot imports for the fixed and common packages. Since this is a "business/user" app and not systems code, this provides 2 major benefits: less verbose code, and I can easily change the implementation of Fixed without changing lots of LOC - just the import statement, and some of the wrapper methods in common.

The fixed.Fixed API uses NaN for reporting errors in the common case, since often code is chained like:

   result := someFixed.Mul(NewS("123.50"))

and this would be a huge pain with error handling. Since all operations involving a NaN result in a NaN, any errors quickly surface anyway.

Performance

BenchmarkAddFixed-2         	2000000000	         0.85 ns/op	       0 B/op	       0 allocs/op
BenchmarkAddDecimal-2       	 3000000	       472 ns/op	     400 B/op	      10 allocs/op
BenchmarkAddBigInt-2        	100000000	        18.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkAddBigFloat-2      	20000000	       109 ns/op	      48 B/op	       1 allocs/op
BenchmarkMulFixed-2         	200000000	         6.14 ns/op	       0 B/op	       0 allocs/op
BenchmarkMulDecimal-2       	20000000	        96.0 ns/op	      80 B/op	       2 allocs/op
BenchmarkMulBigInt-2        	100000000	        22.2 ns/op	       0 B/op	       0 allocs/op
BenchmarkMulBigFloat-2      	30000000	        50.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkDivFixed-2         	100000000	        19.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkDivDecimal-2       	 1000000	      1206 ns/op	     928 B/op	      22 allocs/op
BenchmarkDivBigInt-2        	20000000	        67.6 ns/op	      48 B/op	       1 allocs/op
BenchmarkDivBigFloat-2      	10000000	       148 ns/op	      64 B/op	       2 allocs/op
BenchmarkCmpFixed-2         	2000000000	         0.28 ns/op	       0 B/op	       0 allocs/op
BenchmarkCmpDecimal-2       	100000000	        10.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkCmpBigInt-2        	200000000	         8.10 ns/op	       0 B/op	       0 allocs/op
BenchmarkCmpBigFloat-2      	200000000	         8.39 ns/op	       0 B/op	       0 allocs/op
BenchmarkStringFixed-2      	20000000	        76.1 ns/op	      32 B/op	       1 allocs/op
BenchmarkStringNFixed-2     	20000000	        72.9 ns/op	      32 B/op	       1 allocs/op
BenchmarkStringDecimal-2    	 5000000	       328 ns/op	     144 B/op	       5 allocs/op
BenchmarkStringBigInt-2     	10000000	       212 ns/op	      80 B/op	       3 allocs/op
BenchmarkStringBigFloat-2   	 3000000	       568 ns/op	     272 B/op	       8 allocs/op
BenchmarkWriteTo-2          	20000000	        69.9 ns/op	      27 B/op	       0 allocs/op

The "decimal" above is the common shopspring decimal library

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].