Jump to content

User:BZAW31559/sandbox/floatingpointimprecision

From Wikipedia, the free encyclopedia

0.1 + 0.2 = ? in single precision

[edit]

2^-24 in decimal32 loses the number of digits?

[edit]

2^-24 in decimal32 loses the number of digits?

Yes, the decimal32 floating-point format only supports 7 decimal digits, but the half precision of this value is correct and can fit this value exactly. –BZAW31559 (talk) 07:30, 4 May 2019 (UTC)

See math:

4-bit minifloat

[edit]
Form type 0 0 00 0 0 01 0 0 10 0 0 11 0 1 00 0 1 01 0 1 10 0 1 11 1 0 00 1 0 01 1 0 10 1 0 11 1 1 00 1 1 01 1 1 10 1 1 11
Signed decimal 0 0.25 0.5 0.75 1 1.25 1.5 1.75 −0 −0.25 −0.5 −0.75 −1 −1.25 −1.5 −1.75
Unsigned decimal 0 0.25 0.5 0.75 1 1.25 1.5 1.75 2 2.5 3 3.5 4 5 6 7
Floating imaginary 0 0.25 0.5 0.75 1 Inf NaN NaN –0 –0.25 –0.5 –0.75 –1 –Inf NaN NaN
Signed integer 0 1 2 3 4 5 6 7 −0 −1 −2 −3 −4 −5 −6 −7
Unsigned integer 0 1 2 3 4 5 6 7 8 10 12 14 16 20 24 28
Fixed quarter imaginary 0 1 2 3 2i 4i 6i 1+2i 1+4i 1+6i 2+2i 2+4i 2+6i 3+2i 3+4i 3+6i
Floating quarter imaginary 0 1 2 3 2i 4i 6i −4 −8 −12 −8i −16i −24i 16 32i NaN

2-bit data type

[edit]

There are no significand or mantissa bits in this format. Only sign bit and combination bit.

Form type 0b00 0b01 0b10 0b11
Integer 0 1 2 3
Inverse boolean 0 1 –0 –1
Inverse imaginary 0 1 –1 NaN
Unsigned imaginary 0 1 Infinity NaN
Quarter imaginary 0 1 2i 1+2i
Deprecated imaginary 0 1 2i NaN