[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_C_LONG_DOUBLE is wrong on IRIX 5.3
From: |
Paul Eggert |
Subject: |
Re: AC_C_LONG_DOUBLE is wrong on IRIX 5.3 |
Date: |
Thu, 15 Nov 2001 17:30:49 -0800 (PST) |
> From: Oliver Kiddle <address@hidden>
> Date: Thu, 15 Nov 2001 18:18:49 +0000
>
> Patch is below.
Thanks. I have some further remarks:
> Is the line break in the AC_DEFINE near the end ok?
I'd avoid it by shortening the comment; please see below.
> > int a[LDBL_MAX <= DBL_MAX ? -1 : 1];
>
> Ah, ok, thanks. Again, you should take a look that the patch is what
> you had in mind. I assume that you didn't suggest the simpler
> int a = LDBL_MAX <= DBL_MAX ? -1 : 1
> because it has some problem such as compilers doing it at runtime after
> converting LDBL_MAX to a double or similar.
No, the point was to have a compile-time error, not a run-time error.
> I changed the -1 to 0
Please undo that change, as that will cause the program to succeed with
some compilers, as some compilers allow zero-size arrays.
> and used sizeof(a) == 0
This shouldn't be needed; please see below.
> -If the C compiler supports the @code{long double} type, define
> +If the C compiler supports the @code{long double} type and this type
> +provides greater precision than the @code{double} type, define
Please reword to:
If the C compiler supports a @code{long double} type with
greater range or precision than the @code{double} type, define
> -[AC_CACHE_CHECK(for long double, ac_cv_c_long_double,
> +[AC_CACHE_CHECK(for useful long double, ac_cv_c_long_double,
Please change 'useful long double' to 'long double with greater range
or precision than double'.
> AC_TRY_RUN(
It should use AC_TRY_COMPILE, not AC_TRY_RUN. I realize that the old
version used AC_TRY_RUN, but let's fix that bug while we're at it.
AC_TRY_RUN makes cross-compiling problematic.
> +#if defined (LDBL_MAX) && defined (DBL_MAX)
This #if should be removed. If those symbols are not present, the
code will fail to compile, and this should do the right thing.
> + int a[LDBL_MAX <= DBL_MAX ? 0 : 1];
Two things. First (as described before) the 0 should be -1. Second,
as you noted, we should also use 'long double' if it merely has
greater greater precision. So please reword as follows:
int a[DBL_MAX < LDBL_MAX || LDBL_EPSILON < DBL_EPSILON ? 1 : -1];
> /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
This comment isn't needed any more.
> + exit ((sizeof (a) == 0) ||
> + (sizeof (long double) <= sizeof (double)));
There's no need to invoke exit, as it's a compile-time test now.
> + [Define if the `long double' type works and provides greater
> + precision than `double'.])
Reword to 'Define if long double has greater range or precision than double.'
Then it'll fit on a line.
Can you please test and resubmit a patch along those lines?
(In case you're worried, this process should converge eventually. :-)
- AC_C_LONG_DOUBLE is wrong on IRIX 5.3, Oliver Kiddle, 2001/11/07
- Re: AC_C_LONG_DOUBLE is wrong on IRIX 5.3, Paul Eggert, 2001/11/07
- Re: AC_C_LONG_DOUBLE is wrong on IRIX 5.3, Oliver Kiddle, 2001/11/09
- Re: AC_C_LONG_DOUBLE is wrong on IRIX 5.3, Oliver Kiddle, 2001/11/15
- Re: AC_C_LONG_DOUBLE is wrong on IRIX 5.3,
Paul Eggert <=
- Re: AC_C_LONG_DOUBLE is wrong on IRIX 5.3, Oliver Kiddle, 2001/11/16
- Re: AC_C_LONG_DOUBLE is wrong on IRIX 5.3, Oliver Kiddle, 2001/11/16
- FYI: AC_LONG_DOUBLE patch for IRIX 5.3, and for GCC 2.95.2, Paul Eggert, 2001/11/16