Classic RW 2 (was: Rounding errors

From: William M. Klein (wmklein_at_nospam.netcom.com)
Date: 09/01/04


Date: Tue, 31 Aug 2004 22:11:12 -0500

Let's look at how changing logic is used in a classic RW response

-- 
Bill Klein
 wmklein <at> ix.netcom.com
"Robert Wagner" <robert@wagner.net.yourmammaharvests> wrote in message 
news:052aj0lmkgdi0r22g75jskjrqg8vv4se50@4ax.com...
> On 30 Aug 2004 12:39:58 -0700, riplin@Azonic.co.nz (Richard) wrote:
<snip>
> What if the numbers were not truncated, computed or rounded? I posted
> a demo of that case to which you had no reasonable answer.
>
>>> but it does in Cobol due to a bug.
>>
>>No. Wrong.  The rounding mechanism is well defined and works
>>identically in primary school textbooks, mechanical adding machines,
>>C, Java, and Cobol.
>
> You're incorrect. It doesn't work that way in C# nor in JavaScript (I
> don't know about compiled Java).
>
 <snip>
The original post stated,
"works identically in primary school textbooks, mechanical adding machines, C, 
Java, and Cobol."
The response says that this is INCORRECT because (and I quote)
It doesn't work that way in C# nor in JavaScript (I  don't know about compiled 
Java)."
So now, tell me why does RW think this response has any relationship to the 
original statement?
If the original statement had been,
"works identically in all variations and derrivites of Java and C and COBOL."
then his response would have been responsive.
Only (well that IS an exageration <G>) RW would respond to
 "A and B work the same"
with the statement
 "Incorrect, A and D don't work the same"
     ***
Again, (because I think I know what he MEANT to say), it would be nice if he 
would respond correctly with a statement like,
"Sorry for my original mis-statement.  What I meant to say was
 You may (or may not) be right when you said ' rounding mechanism is well 
defined and works identically in primary school textbooks, mechanical adding 
machines, >>C, Java, and Cobol.'
but it is also true that there are many other programming languages that use 
other approaches for rounding that avoid what I think is an unwarrented bias. 
For example,   C# and  JavaScript use "bankers' rounding" see:
For C# :
 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemmathclassroundtopic3.aspFor JavaScript:   well, oops, according to at least one reference, JavaScript does NOT use"bankers rounding" for its "normal" rounding.  See:http://www.developingskills.com/ds.php?article=jsround&page=1which says,"Math.round - if the decimal part is 0.5 or more, it is rounded up. If it's lessthan 0.5, it is rounded down. This is just the way we're taught at school and isideal unless we specifically need something different."and later says,"Many programming languages use a type of rounding called "round to even" or"banker's rounding". This means that rounding works in the normal way EXCEPTwhen the decimal part is exactly 0.5. In this case it will round to the nearesteven number. So 1.5 rounds to 2 and so does 2.5. The Javascript function toachieve this is:      function roundToEven(num){            if ((Math.floor(num)%2==0) && (Math.abs(num-Math.floor(num))==0.5))                return Math.round(num)-1;            else                return Math.round(num);        }"


Relevant Pages

  • Re: Repeated read From Socket is Truncated
    ... to return control back to the client code. ... Maybe the size of the response is fixed reads in data ... can't Java do that. ... int readSum = 0; ...
    (comp.lang.java.programmer)
  • Re: IE error when closing
    ... Don, thanks for the response. ... Adobe and Java which both work with IE on certain sites. ... >> found more then one post who never had the issue until they got SP2. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • C# generated .NET stubs break on a null return of a complex object
    ... I have a SOAP written in Java, and being served by Apache Axis - using the ... When I make this same call with my java client - here is the SOAP message ... the response object is basically empty - because there were ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Confirm my Performance Test Against Java?
    ... language choice or even hardware. ... I often hear that Ruby is "fast enough" or that the performance ... a java environment my team has built provides SOAP/REST ... our average server side response time is something we ...
    (comp.lang.ruby)
  • Re: Java beginners and GUIs (was Re: simple sound problem)
    ... > perspective of learning and understanding Java, ... When I wrote that I didn't see a reason why it ... married to any single pedagogy for teaching Java. ... > section of Andrew's response would have appeared. ...
    (comp.lang.java.programmer)