Oracle’s internal formats.2

Negative values

A value of -99.99
3e = 0011 1110, this should 10^0 = 1
02 = 0000 0010
02 = 0000 0010
66 = 0110 0110 (seems to be the minus sign)

A value of -98.98
3e = 0011 1110, this should 10^0 = 1
03 = we could use 101 (0x65) as base – 3 = 98
03 = same
66 = minus sign

A value of -412
3d = 0011 1101, this should 10^2 = 100
61 = 0110 0001 = 0x65 – 0x61 = 0x4
59 = 0101 1001 = 0x65 – 0x59 = 0xC (12)
66 = 0110 0110 (minus sign)

A value of -1
3e = 10^0
64 = 0x65 – 0x64 = 1
66 = minus sign

I can transform the exponent by

exponent xor 0x7F

which results in an exponent as for positive numbers. The last mantissa byte is always 0x66, which we can ignore (minus sign). The exponent contains in the highest bit the sign flag, so I can differ between positive and negative numbers by

exponent & 0x80 = 0 (negative) = 1 (positive)

Negative values less than 1

A value of -0.00412
40
3C
51
66

WTF?

Leave a Reply