x = 0.423438990337458964763328594926861114799976348876953125
That particular value happens to be exactly representable as an IEEE-754 double
(1). We can find out its closest neighbourgs with a little snippet.
0.4234389903374589092521773636690340936183929443359375
0.423438990337458964763328594926861114799976348876953125
0.42343899033745902027447982618468813598155975341796875
Note that a value like 0.423438990337459
it's not exactly representable by a double
and will be internally approximated by one of those(2). Also note that their relative "distance" is around 10-16.
In general, it's always possible to obtain the exact base 10 representation (with a maybe big, but finite number of decimal digits) of a floating point value with radix 2. The inverse is in general not possible (you'll need an inifinite number of bits to represent 0.1). I suspect the OP obtained this value by inspecting a particular double
using a debugger.
When converting this value to degrees then back to radians, I expect the computer to give me the same value of x without losing precision.
I don't know how qRadiansToDegrees
is implemented in Qt, nor what architecture the OP are using, but when I tried a possible implementation of this round trip I was lucky (see e.g. the first result here).
In general you should lower your expectations, I'm afraid, considering that a floating point multiplication is not even associative.
Here I tried to test the percentage of failures with random angles. It's around 25% in that testing environment.
1) The C++ Standard doesn't mandate the IEEE-754 standard for representing floating point values. The point of this answer, though, is that any fixed-sized representation can't possibly guarantee what the OP is expecting.
2) Some architectures may provide a wider precision (like 80-bits) for registers, so that intermediate results and calculations in general can be more accurate. This is just an example.