On 2 November 2013 22:12, Mischa Baars wrote:
> On 11/02/2013 11:06 PM, Jonathan Wakely wrote:
>>
>> On 2 November 2013 21:52, Mischa Baars wrote:
>>>
>>> You are mistaken :)
>>>
>>> Indeed some rational numbers can only be represented up to a certain
>>> number
>>> of bits, like 1 / 3. Others can be exactly represented, like 1 / 8.
>>>
>>> All real numbers, and therefore all rational numbers, can be represented
>>> up
>>> to a certain number of bits.
>>
>> i.e. not exactly.
>>
>>> Converting 1.1 from string to double should not be a problem.
>>
>> That's not what your program does. It converts (long double)1.1, which
>> is not equal to 1.1, to a string.
>
>
> I'm trying to pass a completely normal value to the debugger and to the
> standard output, and do not convert any value to a string.

Seriously?  How do you think printf writes to standard output if not
converting to a string?

And 1.1 is not representable as long double.

If you are willing to stop being so arrogant for a few minutes and
learn something try running this program and think about what the
result means:

#include <assert.h>

int main()
{
  long double l = 1.1;
  long double ll = 10 * l;
  assert( ll == 11 );
}

If you think GCC gets this result wrong then please use a different
compiler and stop wasting everyone's time, this is off-topic for this
mailing list.

Reply via email to