Skip to content
Marc edited this page Oct 11, 2024 · 1 revision

Introduction to flints

float vs int vs flint

float

A float has its first bit as its sign, the next 8 bits as its exponent and the last remaining 23 bits for the fraction. This is the IEEE 754 standard for 32-bit floats. A flint, on the other hand, has its first bit as its sign, the next 8 bits as its exponent and the last remaining 23 bits for the fraction. This is the IEEE 754 standard for 32-bit floats. Because of the implicit leading 1 or 0 of floats, the number of decimal digits increase to $log_{10}\left(2^{24}\right)=7.225$ digits of precision.

A float ranges from $1.175494 × 10^-38$ to $3.4028237 × 10^38$ with a decimal precision of around $7.22$

int

A integer is a whole number with no decimal points. Almost all integers are stored in the complement form, which means that a 32 bit integer ranges from $-2^{31} = -2,147,483,648$ to $2^{31}-1 = 2,147,483,647$. This is because the first bit is used to store the sign of the number.

flint

A flint is a floating integer. It is basically an integer whose exponent can be negative. A flint is split into two parts: 8 bits in complementary form storing the exponent and 24 bits in complementary form containing the integer value itself. This means that a flint can range from $8.388.608E-128$ (Or $8,288608E-122$) up to $8.388.608E127$ (Or $8,288608E+133$). This is a huge range of numbers that can be stored in a flint.

A flint ranges from $8.288608 x 10^{-122}$ to $8.288608 x 10^{133}$ with a decimal precision of around $7.22$.

This means that the range got increased significantly while remaining the same decimal precision as a float. Additionally, an addition of flints is as exact as an addition of integer values. $0.1 + 0.2 = 0.3$ in flints, while in floats it would be $0.1 + 0.2 = 0.30000000000000004$.

Double precision flints = flouble (or maybe flint64 or douint?)

A double precision flint is a flint that has 64 bits instead of 32 bits. This means that the exponent has 11 bits and the fraction has 53 bits. This means that the precision of a double precision flint is $log_{10}\left(2^{53}\right)=15.95$ digits.

A double value has an a precision of around 15.95 digits, just like flint64. The range of double values goes from $1.7E-308$ to $1.7E+308$ A flint64 ranges from $9.715 × 10^16 E-1024$ to $9.715 × 10^16 E+1023$, which is caluclated as $9.715E-1008$ to $9.715E+1039$

This means a flint64 has a muuuuch higher range than a double has, while having the same precision and a greater exactness in calculations.

Conclusion

profit?

Clone this wiki locally