There are other surprises. You might then expect byte * byte to be a byte, char * char to be a char, short * short to be a short, but they are not. All of them result in an int.
Further byte and short are sign extended to int before the multiply.
long * long gives a long, again truncating without overflow notification. long * int also gives a long.
Floating point, (float and double) works quite differently. float * float gives a float and double * double gives a double. double * float also gives a double. Floating point warns you when the multiply fails by giving NaN (Not A Number) results.
|
|
available on the web at: |
http://mindprod.com/jgloss/multiplication.html |
optional Replicator mirror
|
J:\mindprod\jgloss\multiplication.html | |
![]() |
Please email your
feedback for publication,
letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear
wording, broken/redirected link reports, suggestions to improve this page or comments to
Roedy Green :
| |
| Blog | Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[54.234.231.49] |
|
| Feedback | You are visitor number 11. | |