Forum Stats

  • 3,750,796 Users
  • 2,250,251 Discussions
  • 7,867,147 Comments

Discussions

Why integer division of literals is always performed at run-time in Java?

Hi All!


Why Java compiler always generates IDIV instruction to perform INTEGER division of integer LITERALS at run-time instead of evaluate it at compile time (as it does for FP division)? Is there any reason? Where this behavior is described in documentation (IMHO JLS and JVMS does not state anything).


BR, Gennadiy

Answers