On Thu, 2011-04-14 at 13:44 +0100, Brian Gough wrote:
> 
> Hi. Apparently floating point constants require a "." as in
> LESS_GENERIC_NEGZERO.  Integer constants don't include the -, so
> GENERIC_NEGZERO is unary minus on integer 0 => integer zero.  Promoted
> to double after that, so +0.0.

Yeah, it's logical. Just somewhat surprising.

I noticed that the following is assigned without warning (-Wall):

  #define LESS_GENERIC_NEGZERO (-0.0)
  int okthen = LESS_GENERIC_NEGZERO;

So it is tempting to decide that (-0.0) is ok for both floating
point and integer contexts. But that creeps me out.

Also, the following compiles without warning:

  double w = -0.0;
  int okmaybe = w;


Back to my semi-original question: Why is neg-zero a macro instead
of a floating-point constant?




_______________________________________________
Bug-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gsl

Reply via email to