Using double precision, find x for which exp(x) doesn't overflow.
4 次查看(过去 30 天)
显示 更早的评论
Using double precision, find x for which exp(x) doesn't overflow.
4 个评论
Rik
2021-3-24
I don't really understand what you're attempting to do with the while loop, but yes, there is a faster way. It requires you to think a bit more.
log2(realmax)
OK, so we are looking for x where e^x is at most 2^1024.
With a little bit of algebra that should not be too hard to solve. Can you see how?
回答(1 个)
KALYAN ACHARJYA
2021-3-24
编辑:KALYAN ACHARJYA
2021-3-24
All data creates in MATLAB are douple precision (Standard /By Default)
More:
e^x = 1 + (x ^ 1 / 1!) + (x ^ 2 / 2!) ......
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!