[seqfan] Re: Factorials (A000142) compressed through the int data type

Richard J. Mathar mathar at mpia-hd.mpg.de
Fri Jun 30 17:31:35 CEST 2017


In answer to http://list.seqfan.eu/pipermail/seqfan/2017-June/017740.html :

Chapter 15.17.1 of the Java Language Specification (3rd edition) says:

"If an integer multiplication overflows, then the result is the low-order bits of
the mathematical product as represented in some sufficiently large two'sâ-comple-
ment format. As a result, if overflow occurs, then the sign of the result may not be
the same as the sign of the mathematical product of the two operand values.
The result of a floating-point multiplication is governed by the rules of IEEE.."

As mentioned earlier, the usual remedy is to use the BigInteger class
for calculations that may overflow in the int or long representations.
Applications are in the BigDecimalMath.java class in my
https://arxiv.org/src/0908.3030v3/anc and in my http://vixra.org/abs/1511.0015 .

RJM



More information about the SeqFan mailing list