On Fri, 1 May 2015, Andrew Makhorin wrote:

On Fri, 2015-05-01 at 15:17 +0000, Agostina Kodelia wrote:
Hi!
 I'm solving a very simple postman travelling problem with
the glp_intopt method. When I retrieved the column value
with glp_mip_col_val, it returns a negative zero. The zero is alright,
but I don't understand why has a minus, could anyone explain to me why
is this happening?


This is because the IEEE 754 standard which most of modern FPUs conform
to claims that a floating-point zero has the sign bit. A negative zero
may appear, for example, on computing (2. - 3.) * (5. - 5.) = -1. * +0.
= -0.

The minus sign was not actually necessary.
C89 is not required to notice the sign of zero.
That printf did suggests that its author made a special effort.
So far as I know,
none of C89's successors are required to notice the sign of zero.
C99 implementations *may* choose to honor IEEE floating point
and to note the fact in a C99-defined preprocessor symbol.
C99 defines said choice to include noticing the sign of zero.

--
Michael   henne...@web.cs.ndsu.nodak.edu
"SCSI is NOT magic. There are *fundamental technical
reasons* why it is necessary to sacrifice a young
goat to your SCSI chain now and then."   --   John Woods

_______________________________________________
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to