disabling unary "-" for unsigned types

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Feb 16 02:48:22 PST 2010

Walter Bright wrote:
> Lutger wrote:
>> It's a valid viewpoint, but it is a 'should'. I believe many 
>> programmers have only passing familiarity if at all with the semantics 
>> of unsigned types and floating point operations. At least when coding, 
>> they don't have these semantics in mind. Why do you think Java doesn't 
>> have unsigned types? 
> Naive programmers have trouble with Java floating point as well:
>     http://www.eecs.berkeley.edu/~wkahan/JAVAhurt.pdf
> There's just no getting around it. Should Java just remove floating 
> point types as well?
> Heck, I knew a degree'd mechanical engineer who could not understand why 
> his calculator kept giving him answers off by a factor of 2 (he refused 
> to understand roundoff error, no matter how many times I tried to 
> explain it to him - he believed that calculators had mathematically 
> perfect arithmetic).

How could he refuse? One of my favorite games with calculators was to 
successively extract square root of 2 until I got 1. The better the 
calculator, the more steps it takes. That's kind of difficult to refuse 
to acknowledge :o).


More information about the Digitalmars-d mailing list