Re: On writing negative zero - with or without sign



Janne Blomqvist wrote:
James Giles wrote:
Just my opinion, but I'd recommend that you print the minus sign.
I don't even see a need to have an option to turn it off. It's not
like any old programs could be dependent on the behavior.

The NIST testsuite is, apparently. To which extent that is
representative of real F77 applications, I don't know.


Well, given that it's a test suite, it's dependency is probably
that it was deliberately written to test whether zero has a
negative sign printed with it. My guess is that it has no
further meaning than that.

The standard has already changed once. It used to be required
that an output of entirely zero digits must not have a minus sign.
And now (as of F95 I think) if the internal value is negative (other
than negative zero) the output field must have a minus sign - even
if the only digits actually output are zeros. Headway occurs slowly.
I can't find it quickly, but I think F2003 requires the minus sign if
the implementation is IEEE and the internal value is a negative zero.

As the standard changes, test suites will too. In the meantime
dropping the sign of zero is a numerically unfriendly act. I still
recommend keeping the sign without options to turn it off.

--
J. Giles

"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare


.



Relevant Pages

  • Re: On writing negative zero - with or without sign
    ... like any old programs could be dependent on the behavior. ... that an output of entirely zero digits must not have a minus sign. ... the implementation is IEEE and the internal value is a negative zero. ...
    (comp.lang.fortran)
  • Re: Ideas for finding blank data fields in user records?
    ... trick all tested for negative zero using assembler and the SIGN ... The code itself says it was written in Fortran II. ... But if you are testing for a negative zero, there has to be a way to ... tape of the programs and several boxes of cards which turned out to be ...
    (comp.lang.fortran)
  • Re: On writing negative zero - with or without sign
    ... the representation of a positive or zero internal ... The representation of a negative ... only the burden of saying that a negative zero is both a zero ... interpretation opens the possibility of prefixing the external ...
    (comp.lang.fortran)
  • Re: Rfd: floating point truncation V1
    ... Negative zero is a computer invention (see Wikipedia et al). ... which includes infinitesimal and infinite values outside ...
    (comp.lang.forth)
  • Re: Ideas for finding blank data fields in user records?
    ... failed if asked to transfer the sign from zero. ... Quite a few have to use the negative zero and sign-transfer-and-test ... PDP 10 and 20 computers ... It used an Assembler routine to test for the 'negative ...
    (comp.lang.fortran)