Yes, there are IEEE 754 double-precision(*) values x
that are such x != 1.0 / (1.0 / x)
.
It is easy to build an example of a normal value with this property by hand: the one that's written 0x1.fffffffffffffp0
in C99's hexadecimal notation for floating-point values is such that 1.0 / (1.0 / 0x1.fffffffffffffp0) == 0x1.ffffffffffffep0
. It was natural to expect 0x1.fffffffffffffp0
to be a counter-example because 1.0 / 0x1.fffffffffffffp0
falls at the beginning of a binade, where floating-point numbers are less dense, so a larger relative error had to happen on the innermost division. More precisely, 1.0 / 0x1.fffffffffffffp0
falls just above the midpoint between 0.5
and its double-precision successor, so that 1.0 / 0x1.fffffffffffffp0
is rounded up to the successor of 0.5, with a large relative error.
In decimal %.16e
format, 0x1.fffffffffffffp0
is 1.9999999999999998e+00
and 0x1.ffffffffffffep0
is 1.9999999999999996e+00
.
(*) there is no reason for the inverse function to have the property in the question for any of the IEEE 754 format
binary32
:x=0x1.fffffep-1: 1.0f/x=0x1.000002p+0 1.0f/(1.0f/x)=0x1.fffffcp-1
and withbinary64
:x=0x1.fffffffffffffp-1: 1.0f/x=0x1.0000000000001p+0 1.0f/(1.0f/x)=0x1.ffffffffffffep-1
– Gilianax = 100000
, and I'm pretty sure they're IEEE754 complaint... – Noveltyx= 0x1.86a0000000000p+16: 1.0f/x= 0x1.4f8b588e368f1p-17 1.0f/(1.0f/x)= 0x1.869ffffffffffp+16
– Giliana