This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gnu software bugs - long double


On 11/03/2013 12:29 AM, Rob wrote:
Sat, Nov 02, 2013, Mischa Baars:
On 11/02/2013 11:19 PM, Jonathan Wakely wrote:
On 2 November 2013 22:12, Mischa Baars wrote:

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.
There's no converting to any string in your example. You only
convert source code strings into their corresponding doubles.

What I'm trying to point out is that the output differs from the
value entered in the source. The string 1.1 from the source is not
correctly converted to it's corresponding double, or the double is
not correctly converted back into it's corresponding string.
I challenge you to come up with a better way of representing floating
point numbers in an efficient manner _and_ support silly edge cases like
imperfectly representable numbers. Read up on IEEE floats, particularly
that link Jonathan posted earlier.

This sounds like to most reasonable alternative. I will do it myself.


But please stop wasting everyones' time. Clang exhibits the same
behaviour, it's not a compiler issue.

Thank you

Thanks.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]