[net.math] Ok, I give up!

gsmith@brahms.BERKELEY.EDU (Gene Ward Smith) (01/29/86)

>> While algorithms for doing floating point arithmetic may be of interest
>> to mathematicians this above stuff has very little to do with mathematics.
>> It involves computer issues only. Please keep this sort of thing out of
>> net.math. By the way... are you sure you cross posted it to enough groups???
>>  
>> Bob Silverman
>
>> .... Tim announced that many people believe that such problems
>> are in fact mathematical. Unfortunatly, these people are wrong. I
>> suspect a lot of us would support the efforts of Bob Silverman or anyone else tokeep such submissions *off* of net.math, especially when the person posting
>> seems to be well-supplied with places to post. If the "people who post" don't
>> know or don't care what mathematics is, what is wrong with telling them so,
>> instead of "letting them decide"...
>> 
>>       Gene W. Smith
>
>Gene:
>
>As I mentioned before, we have more than one definition of what mathematics
>is.
>
>                               ...in the eye of the beholder...
>
			       Tim Snyder
>
>A recent discussion on net.arch raised the problem of defining integer
>division for negative numbers.  Most computers seem to say that -3/2 is
>-1, and -3%2 is -1.  Many people thought this was fine, but some of us
>think that -3/2 should be -2, and -3%2 should be 1.  Both sides agree
>Are there any good mathematical grounds for choosing one alternative over
>the other here?  Note that I am not asking from a hardware point of view
>which is better.  I want to know mathematically if one is better than
>the other.
>
>Tim Smith       sdcrdcf!ism780c!tim || ima!ism780!tim || ihnp4!cithep!tim
>

  I really do give up. Post your tax return here for all I care, it has numbers in it. In any case, this gives me a chance to vent one of my pet peeves, since
now that I have recanted, I can reply to Tim Smiths problem.

  Tim: Yes, of course one is better mathematically. The people who are trying
to tell you -3%2 = -1 is acceptable should be banned from the business. I
don't know how many times I've had to deal with the problem of the yo-yo
heads who put this kind of crap on a computer. "%" is supposed to be a mod
function, if it treats negative numbers differently than positive numbers
then we just have to re-write the function "%" or work around the mistake.
Its just like defining sin(x) as |sin(x)| and thinking this is just as good.
I've always been mystified as to the reason why anyone was dumb enough to
think differently, maybe I'll read net.arch and find out.

       Gene "Yeah, sure this is math" Smith

ladkin@kestrel.ARPA (01/30/86)

(smith on floating point arithmetic, speaking for many)

> >> .... [...] many people believe that such problems
> >> are in fact mathematical. Unfortunatly, these people are wrong. 

Jerry Coonen is getting a Ph. D. in MATH at Berkeley for
helping to write the IEEE standard for floating point arithmetic.
His advisor, William Kahan, is a mathematician, and has spent
much of his fruitful career dealing with the problem of how
to convey mathematical information via floating point arithmetic.
He designed the algorithms that are used in the HP34C, which
was the first calculator, I believe, to be able to give
accurate solutions to a general equation f(x)=0, where
f is in the closure of the rational functions, the
trig functions and the logarithmic functions (the same
class that Risch's algorithm can be used on).
Kahan also has shown that the tangent method is
equally good, in a precise sense, as Newton's method
for solving such equations.

(snyder)
> >A recent discussion on net.arch raised the problem of defining integer
> >division for negative numbers. 
> >[....]  I want to know mathematically if one is better than
> >the other.

(smith)
> 
>   Tim: Yes, of course one is better mathematically. The people who are t

(followed by some insults, and very little argument)

Gene, *mod* is mod, and integer division is not the mod function.
Some languages, like Pascal, have both.

There is extensive discussion by Kahan and students at Berkeley
about these issues. Anyone who is interested might attempt to
contact him for references.

I also can't resist noting:

(smith)
>   I really do give up. 

Thankyou. This may be the right solution.

Peter Ladkin

tim@ism780c.UUCP (Tim Smith) (01/31/86)

We seem to have here a set of three people, two of whom are named
"Tim", and two of whom are named "Smith."  Please be careful when
quoting someone as "Tim" or as "Smith" to specify _which_ "Tim" or
"Smith" you mean.

As to my posting on integer division in computers, I am sorry if 
anyone was annoyed, but I do think that there were good reasons 
for posting this to net.math.  First of all, I wanted ammunition 
for my side of the argument in net.arch.  Also, I didn't want to just
say that computers are _wrong_ without checking with real 
mathematicians ( I only have a B.S. in math ).

If I had phrased the question so that computers were not involved
would it have made people feel better?
-- 
Tim Smith       sdcrdcf!ism780c!tim || ima!ism780!tim || ihnp4!cithep!tim

gwyn@brl-tgr.UUCP (02/01/86)

> "%" is supposed to be a mod function ...

No, in C the % operator is a remainder operator.
Remember that C is intentionally vague on semantics
in cases where precise specification might have forced
additional run-time overhead in generated code.
Another example is sign propagation on right-shifts.

Yes, to get precise semantics you have to provide
your own function (although this one really should be
provided in the standard C library).

Knuth Vol. 1 (2nd Ed.), p. 38 discusses the reasonable
mathematical definition of the mod function.