So if I run
System.out.println(1e+0);
it outputs 1
however if i run
System.out.println(Math.E);
it outputs 2.718.........
for the life of me I cant figure out how the little e interacts with numbers I get that Math.E is a constant that has something to do with logarithms but I thought the little e was just that being represented in a number yet the code is showing me something different. can anyone explain how that e interacts with numbers in java?
The literal 1e+0
is scientific notation for 1 * 10⁰
, and 10⁰
being 1
this gives 1 * 1
, thus 1
.
The constant Math.E
is Euler's Number .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.