tiberio@seismo.UUCP (Mike Tiberio) (08/08/84)
a program, run on a sun and on a 780, both with 4.2 BSD:
main()
{
	double log10();
	printf("%f\n", log10(0.));
}
sun responds:
Infinity
vax responds:
-73891372717101319000000000000000000000.000000
may the joker responsible for the answer found on the sun be shot!
seismo!tiberiobrian@uwvax.ARPA (08/09/84)
I don't know if I would go so far as to shoot the "joker".  At least he 
made an attempt at giving the right answer, even though he was wrong.  The
vax answer, however, can't even be construed as an attempt at the correct
answer, it's ludicrous and WRONG.  Anyway, what little I remember from high
school calculus tells me that log10(0) is UNDEFINED, not Infinity.  This 
is because ten to any power does not equal zero.  Cheers to the Sun programmer
who had the idea... I love it.
-- 
Brian Pinkerton @ wisconsin
...!{allegra,heurikon,ihnp4,seismo,sfwin,ucbvax,uwm-evax}!uwvax!brian
brian@wisc-rsch.arpachris@umcp-cs.UUCP (08/10/84)
Actually, it makes sense that the sun would say ``Infinity'':
log10(0.0) returns the largest (smallest?) possible machine value and
sets errno to EDOM.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci (301) 454-7690
UUCP:	{seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@marylandjdd@allegra.UUCP (John DeTreville) (08/16/84)
--------
	From: gwyn@BRL-VLD.ARPA
	Newsgroups: net.unix-wizards
	Subject: Re:  more sun and vax diffs
	Date: Sun, 19-Aug-84 00:58:24 EDT
	From:      Doug Gwyn (VLD/VMB) <gwyn@BRL-VLD.ARPA>
	It is NOT proper to print "Infinity" in a numeric field that may
	have to be read back in by another program (even if the Sun scanf()
	can convert the string back into proper internal form, which I doubt,
	the output may be shipped to another system to be input).
--------
It is my impression that the Sun internally uses the new IEEE standard
floating-point format (coming soon to a CPU near you).  The IEEE standard
reserves a bit-pattern for "infinity", which is returned for operations such
as 1.0/0.0 (negative infinity is returned by -1.0/0.0); infinities obey the
rules of arithmetic as well as they can.
Unfortunately, the C language makes no provision for such things: there is
no number which can be printed out for infinity that could possibly be read
in as infinity.
Does the new C standard address this problem?
Cheers,
John ("Not Infinite") DeTreville
Bell Labs, Murray Hilltomk@ur-laser.uucp (Tom Kessler) (08/21/84)
minor FLAME.
I if you bothered to read the manual (and I quote) (ahemm),
" The %e, %f,and %g formats print IEEE indeterminate values (infinity or 
not-a-number) as 'Infinity' or 'Nan" respectively."
See its not a bug they EVEN documented it.
FLAME EXTINGUISHED
They do admit, however, that scanf is unableto read the result back in so
there is the real bug.
-- 
--------------------------
		   Tom Kessler {allegra |seismo }!rochester!ur-laser!tomk
Laboratory for Laser Energetics               Phone: (716)- 275 - 3786
250 East River Road                                         275 - 3194
Rochester, New York 14623mmr@utmbvax.UUCP (Mike Rubenstein) (08/23/84)
> It is NOT proper to print "Infinity" in a numeric field that may > have to be read back in by another program (even if the Sun scanf() > can convert the string back into proper internal form, which I doubt, > the output may be shipped to another system to be input). It's better to print an incorrect value? If another program reads in a number produced by a VAX when it couldn't calculate a value you're going to get some real garbage. The Sun's output does have the advantage of making it obvious that something is wrong. I've watched in some horror during the past 20 years as the tendency has grown to ignore the fact that the purpose of computing is to provide CORRECT solutions to problems. I believe that ideally a program which is incorrect should terminate as quickly as it can with an obvious indication that it failed. Unfortunately because of our inabilities this does not always seem to be practical. The next best result of an incorrect program is an obviously ridiculous answer (I'd class the Sun's output in this category, though in some cases it might well be considered correct. Of course if one takes that view there is no question that the Sun's result is preferable.) Worst possible result is that the program produces output that looks reasonable. The VAX's output is certainly more likely to fall into the latter category than is the Sun's. A program which is asked to do something it cannot do should, ideally, inform the user of the problem. This is, unfortunately, often impractical. If the program fails to do this, it should be handled as if the program were in error. -- Mike Rubenstein, OACB, UT Medical Branch, Galveston TX 77550
wb@gamma.UUCP (Bill Beblo) (08/26/84)
My experience with the Sun 2 workstation is that it returns a value which is printed via printf as "NAN" (not a number). I was under the impression this had something to do with the IEEE standard for floating point software. They claim they conform. My question is whether or not they are consistent when using their Sky hardware FP processor. Bill Beblo Bell Communications Research 600 Mountain Avenue Murray Hill, New Jersey 07974 (201) 582-7365
gwyn@BRL-VLD.ARPA (08/26/84)
From: Doug Gwyn (VLD/VMB) <gwyn@BRL-VLD.ARPA> It is NOT proper to print "Infinity" in a numeric field that may have to be read back in by another program (even if the Sun scanf() can convert the string back into proper internal form, which I doubt, the output may be shipped to another system to be input).
sunny@sun.uucp (Sunny Kirsten) (08/27/84)
>My experience with the Sun 2 workstation is that it returns a value >which is printed via printf as "NAN" (not a number). I was under >the impression this had something to do with the IEEE standard >for floating point software. They claim they conform. My question >is whether or not they are consistent when using their Sky >hardware FP processor. >Bill Beblo In the sun architecture the math libraries sense the presence/absence of the Sky Fast Floating Point Processor Board, and automatically call it if present. There are compile options to force a non-transportable optimized compile which calls the Sky driver directly, rather than calling the math library and letting it decide. -- {ucbvax|decvax|ihnp4}!sun!sunny (Sunny Kirsten of Sun Microsystems)
geoff@callan.UUCP (08/31/84)
>My experience with the Sun 2 workstation is that it returns a value >which is printed via printf as "NAN" (not a number). I was under >the impression this had something to do with the IEEE standard >for floating point software. They claim they conform. My question >is whether or not they are consistent when using their Sky >hardware FP processor. > Bill Beblo > Bell Communications Research The Sky FP unit is IEEE-488, and thus will return NAN's and infinity when appropriate. The SUN printf routines recognize these as special cases and print them specially. Thus, I would expect all to work just find when using the Sky board. Isn't it interesting that Sunny Kirsten of Sun answered a totally different question that wasn't even raised in Beblo's posting, and the correct answer had to come from one of Sun's hottest competitors? -- Geoff Kuenning Callan Data Systems ...!ihnp4!wlbr!callan!geoff
geoff@callan.UUCP (Geoff Kuenning) (08/31/84)
Oops. My fingers got ahead of me. IEEE-488 is a bus; I don't know the number of the floating point standard off the top of my head. Anyway, the Sky FP is IEEE floating point, not IEEE-488. Sorry. -- Geoff Kuenning Callan Data Systems ...!ihnp4!wlbr!callan!geoff
ron@BRL-TGR.ARPA (09/06/84)
From: Ron Natalie <ron@BRL-TGR.ARPA> I don't think IEEE-488 is what you mean here. 488 is a depraved instrumentation bus. _Ron
jbn@wdl1.UUCP (jbn ) (09/08/84)
#R:seismo:-281000:wdl1:17100005:000:272
wdl1!jbn    Sep  7 13:57:00 1984
    What are you complaining about?  Log10 of zero IS infinity.  The
SUN has the right answer.  The VAX is totally wrong.  There really is
a floating point value which represents infinity in IEEE floating point
notation, and that is what you get when you divide by zero.gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (09/09/84)
"Log10 of zero IS infinity." That is a good example of the problem with trying to support arithmetic on non-numbers. The quoted statement is incorrect in any case, since 10 ^ infinity is definitely not zero. I would also object to the more correct statement "Log10 of zero is minus infinity", if infinity is being treated on an equal basis with real numbers. Correct treatment of infinite and infinitesimal quantities is the province of the field of "nonstandard analysis", and these simplistic approaches will just get na"ive users into trouble. Let me ask another one: What is the square root of -1? Anyone who says "i" or "-i" is wrong; the square root is a double-valued function and must be treated VERY carefully or bogus answers will be obtained. This is explained in any good complex analysis course.