from double to single precision

178 views (last 30 days)
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?

Accepted Answer

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

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!