from double to single precision

146 次查看(过去 30 天)
I want to calcute this equation x= 3.0*(4.0/3.0-1.0)-1.0 but using single precision instead of double. How do I do switch to single?

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2013-10-27
  3 个评论
Azzi Abdelmalek
Azzi Abdelmalek 2013-10-27
x = 1 - 3*(4/3 - 1)
a=single(x)
whos x a
and see the difference
Azzi Abdelmalek
Azzi Abdelmalek 2013-10-27
To get the smallest double and single number
realmin('double')
realmin('single')

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Particle & Nuclear Physics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by