Skip to content

metatronsw/FDec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FDec

A fixed decimal number format for Swift.

Extremely fast numerical structure for precise decimal fraction calculations. Sacrificing size and the dynamic capabilities of float, you get an easy-to-use fast and simple but accurate calculation. Suitable for finance and small calculations. The number of decimals is fixed in the Structure variable, so mixing the sizes is not recommended, but it can be done. This needs special attention, but in return a piece of Int value takes up space in memory.

	FDec.decimalsNum = 3

	let a = FDec("32.001")
	let b = FDec(287.123)

	print(a+b) // 319.124

The biggest advantage is that you can save a decimal fractional value as Int type. Numbers are not distorted during serialization, and in most cases it takes up less space than a string.

About

A fixed decimal number format for Swift

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages