What should printf infinity show?

D

dmoisset

Hi,
I'm looking for a standard definition about what should {printf
("%f", x)} do when x is INFINITY...
I've found that in ISO C99 the output should be "inf" or
"infinity", but I was wondering if something is said about this in
older standards.

Any pointer? Thanks,

Daniel
 
W

Walter Roberson

I'm looking for a standard definition about what should {printf
("%f", x)} do when x is INFINITY...
I've found that in ISO C99 the output should be "inf" or
"infinity", but I was wondering if something is said about this in
older standards.

In C89, there is no concept of infinity. The only reference
to the IEEE standard that I can find in C89 is in the description
of <float.h>, where it lists some sample limits "that also meet"
the IEEE standards.
 
M

Mabden

Hi,
I'm looking for a standard definition about what should {printf
("%f", x)} do when x is INFINITY...
I've found that in ISO C99 the output should be "inf" or
"infinity", but I was wondering if something is said about this in
older standards.

Any pointer? Thanks,

A grand master said, "With uniform equanimity, everything disappears of
itself."

This is the oldest teaching I could find quickly.

HTH. HAND.
 
M

Mabden

Keith Thompson said:
What's the real what?

Oh, Keith. Why must you control and contain every question? You want to
bring it into your world and change it into something you can understand
in order to convince everyone you have all the answers.

The obvious answer to the poster is simply this; "expect nothing, seek
nothing, and grasp nothing."
 
W

Walter Roberson

Oh, Keith. Why must you control and contain every question? You want to
bring it into your world and change it into something you can understand
in order to convince everyone you have all the answers.

-I- (not Keith) was the person who wrote, "In C89, there is no
concept of infinity.", and thus -I- was the one being asked,
"What's the *real* one". And you know, Mabden, -my- reaction when
I read that question was, "Huh?? What is this person trying to say?
What's the real -what-??".

When I read the "What's the *real* one" question, I thought about
it for a moment, thought about a few possible answers, and then flagged
the posting in my newsreader to return to it at a later time when
I would once more try to figure out what the person was really trying
to ask, and what the answers to that question would be, and to give
me time to decide whether (considering how busy I am lately) whether
I wanted to go the route of, "Well, you might have meant this, and the
answer for that is Foo, but you might have meant that, and the
answer for that is Bar, but you might have meant this other thing and
the answer to that is Baz..." I was the one being asked the question,
but I did not reply promptly because the question was so difficult
to answer -as stated- that it was going to take a lot of thought to
decypher.

Then Keith posted his succinct "What's the real what?" response, and
I looked at it and said, "Why yes, that will do; it sums up nicely
what I would have ended up saying" -- so I decided not to add my
confusion to the mix.

As far as -I- am concerned, Keith did not in any way attempt to
control or contain the question: he just didn't understand it, and
asked for clarification, which would have been the same thing I
likely would have ended up doing.

The obvious answer to the poster is simply this; "expect nothing, seek
nothing, and grasp nothing."

The poster said "not meaning to be flip", and in -my- opinion the
response you propose is flip and unamusing -- and philosophically
suspect. The Masters say, "Concentrate entirely on the moment,
and do the best you can at whatever is in front of you."
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top