필터 지우기
필터 지우기

10e5 == 10^5 is not true in MATLAB

조회 수: 576 (최근 30일)
prohi
prohi 2017년 11월 4일
편집: Vasileios Delimaras 2024년 2월 17일
If you type in
10e5 == 10^5
ans =
logical
0
so 10e5 does NOT mean 10 to the power of 5 but it means 10 to the power of 6.
10e5 == 10^6
ans =
logical
1
What does 10e5 mean then? Is it somewhere in the documentation? I just can't seem to find it, I've been looking for it for quite some time now.
Thanks for the help!
  댓글 수: 1
Vasileios Delimaras
Vasileios Delimaras 2024년 2월 17일
편집: Vasileios Delimaras 2024년 2월 17일
The notation "10e5" means "10 times of 10 to the power of 5," where the "e" represents the exponent of the power of 10 (10^x). So for your example, 1e5 == 10^5.

댓글을 달려면 로그인하십시오.

채택된 답변

Birdman
Birdman 2017년 11월 4일
  댓글 수: 1
Guillaume
Guillaume 2017년 11월 4일
편집: Jan 2017년 11월 5일
Or in short,
aeb
means
a * 10^b
so 10e5 is 10 * 10^5, indeed the same as 10^6. And similarly, 9e5 does not mean 9^5 == 59409 but 9*10^5 = 900000

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

chaman lal dewangan
chaman lal dewangan 2019년 12월 21일
1e6=10^6;
  댓글 수: 1
John D'Errico
John D'Errico 2023년 7월 9일
@chaman lal dewangan - If you think this statement is relevant, then you don't understand floating point numbers. That it happens to work in this instance, but not for the case of 1e5, this is just mathematical happenstance. SOMETIMES, you get lucky in any such test.
1e6==10^6
ans = logical
1
But to properly use MATLAB, you don't want to leave things to mathematical happenstance, hoping to get lucky. That is just a bad idea.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by