Re: Arithmetic overflow checking



On 7/25/2011 12:21 AM, Henderson wrote:
On 24/07/2011 12:16 PM, Patricia Shanahan wrote:
On 7/23/2011 7:55 PM, Henderson wrote:
We could go further and rewrite Number.java so that it is Number<T
extends Number<T>> and defines:

I don't think it would be wise to tie operator overloading to Number.
Number defines a series of conversions that make some sense for those
types that represent subsets of the real line.

I wasn't thinking beyond the real line to the more abstract stuff
mathematicians futz around with and consider to have addition and
multiplication.

Historically, complex numbers were indeed invented by and for
mathematicians for the abstract satisfaction of having solutions for all
quadratic equations. However, as happens surprisingly often when
mathematicians think they have invented something abstract for their own
amusement, scientists and engineers turned them into useful tools for
practical uses.

For example, a complex number can represent both magnitude and phase of
an alternating current. That simplifies some electrical engineering
calculations.

I've seen far too many uses of complex numbers in scientific and
engineering programs to be really comfortable with the fact that Java
lacks a practical way to express anything other than the simplest
complex number expressions.

Patricia
.