Reliably determine sign value of double in C90/C89

A

artifact.one

What does the standard say about this:

const double PositiveZero = 0.0;
const double NegativeZero = -0.0;

Are they guaranteed to be different?

(Yes, I know "positive zero" is an oxymoron, but then again, so is
"negative zero".)

Er, as for C89, I don't know. I don't have a copy of the standard.

MC
 
K

Keith Thompson

It's hard to say really. I can't see anything in N1124 that says they
have to be different, but then it also speaks of IEEE 754, which says
that they do. I suppose this could mean that it *implies* it...

N1124 (C99 plus corrigenda) speaks of IEEE 754, but it doesn't require
it. Conforming C implementations are possible on systems that use
other floating-point standards.
 
R

Richard Heathfield

Keith Thompson said:
Love the sig quote!

DV's sigs are always worth checking out. Sorry, Dave, but I always
scroll to the bottom of your articles *first*...
 
D

Dave Vandervies

Keith Thompson said:


DV's sigs are always worth checking out.

Only if your sense of humour matches mine.
(And, of course, the better your sense of humour matches mine, the more
likely you are to make it into my sigs file, and therefore the more
likely you are to see your name there.)
Sorry, Dave, but I always
scroll to the bottom of your articles *first*...

Meh, whatever gets you to read them. (That assumes, of course, that
you DO eventually read the rest of them.)


dave
 
J

jacob navia

Keith said:
Your definitiono "quite portable" is, to say the least, unusual.

It is, to say the most, nonsense.

No. You do not even say that the list of OSes where that runs
is wrong...

:)

The point I am trying to make is that the C library should NOT
be written in C.

jacob
 
G

Guest

jacob said:
No. You do not even say that the list of OSes where that runs
is wrong...

Well, I will. You say your x86 assembly code works on all versions of
Windows. Your assumption that all versions of Windows only work on x86
is wrong, and with that, so is your list.

That aside, it should be extremely obvious that x86 assembly cannot
work on a whole lot of sane systems that do accept standard C. It may
be reasonable to call x86 assembly "quite portable" in other places,
where both assumptions of the processor and the operating system are
the norm, but here, it's simply not.
 
K

Keith Thompson

jacob navia said:
No. You do not even say that the list of OSes where that runs
is wrong...

:)

The point I am trying to make is that the C library should NOT
be written in C.

You tell us the sky is green, but the point you're trying to make is
that it looks like rain and we should carry umbrellas.

Try saying what you actually mean.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,144
Latest member
KetoBaseReviews
Top