JavaRanchFAQ HowToAskQuestionsOnJavaRanch UseCodeTags DontWriteLongLines ItDoesntWorkIsUseLess FormatCode JavaIndenter SSCCE API11 JLS JavaLanguageSpecification MainIsAPain KeyboardUtility
Campbell Ritchie wrote:...
Integer arithmetic has used “round towards zero” for as long as I can remember; as Carey said, 1 / 2 rounds towards zero and will therefore evaluate to 0. It is rounding that is the real explanation here, as Carey said.
RTFJD (the JavaDocs are your friends!) If you haven't read them in a long time, then RRTFJD (they might have changed!)
Campbell Ritchie wrote:My former supervisor was on the Forth standards committee, and about twelve years ago, Forth was standardised to change from round down to round towards zero.
RTFJD (the JavaDocs are your friends!) If you haven't read them in a long time, then RRTFJD (they might have changed!)
That is called “Euclidean” behaviour. I thought that is the same as Java®'s behaviour.Jesse Silverman wrote:. . . (m / n) * n + m % n == m for all m, n . . .
Campbell Ritchie wrote:
That is called “Euclidean” behaviour. I thought that is the same as Java®'s behaviour.Jesse Silverman wrote:. . . (m / n) * n + m % n == m for all m, n . . .
I don't remember a rift amongst Forth developers, but I certainly remember a rift amongst Eiffel programmers when ECMA367 came out, and Eiffel dropped below the radar. It seems to have reappeared on Tiobe.
RTFJD (the JavaDocs are your friends!) If you haven't read them in a long time, then RRTFJD (they might have changed!)
The sign of i % j is always the same as the sign of i (except when the remainder is 0).The remainder operation for operands that are integers after binary numeric promotion (§5.6) produces a result value such that (a/b)*b+(a%b) is equal to a.
Yes.. . . do integer division and modulus arithmetic behavior belong in Beginning Java?
It certainly was before Java8.Java as about as uptodate as "Laverne and Shirley" reruns . . .
That has always happened. Java1.0 might have been slow, but I am sure there are still people who remember that and think all Java® implementations are slow.. . . people dismissing Java for reasons that haven't been true for quite a long time.
If you are using a wood chipper, you are doing it wrong. Even on this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filleradvertising
