single and double precision matlab


by sara_87
Tags: double, matlab, precision, single
sara_87
sara_87 is offline
#1
May9-12, 04:00 PM
P: 774
1. The problem statement, all variables and given/known data

MATLAB uses double precision as default.
How can I change this to single? so that all computations will be made using single precision.

2. Relevant equations



3. The attempt at a solution
I went to:
file
preferences
virtual reality precision: floating point: single (I changed this from double to single)

However, my computations are still being made in double precision.

I don't want to change a single variable to single precision (this is done using single(A)) I want to change all computations.

thank you.
Phys.Org News Partner Science news on Phys.org
SensaBubble: It's a bubble, but not as we know it (w/ video)
The hemihelix: Scientists discover a new shape using rubber bands (w/ video)
Microbes provide insights into evolution of human language
Steely Dan
Steely Dan is offline
#2
May9-12, 04:06 PM
P: 317
I do not believe there is a way to change the default arithmetic for all operations, as MATLAB variables are indeed double precision by default. Nevertheless, if you define variables to be single precision to begin with, then any operations between them will result in a single precision output.
sara_87
sara_87 is offline
#3
May9-12, 04:23 PM
P: 774
oh right i see. thank you.

Steely Dan
Steely Dan is offline
#4
May9-12, 05:42 PM
P: 317

single and double precision matlab


I know that's not a comforting answer if you have a large code with lots of variables -- sorry!


Register to reply

Related Discussions
Converting binary numbers to floating point format using single-precision IEEE 754 Engineering, Comp Sci, & Technology Homework 6
Single precision floating point Engineering, Comp Sci, & Technology Homework 14
Roundoff error - double precision is not enough General Math 4
converting 29 and 0.7 to IEEE single precision floating point Engineering, Comp Sci, & Technology Homework 5
single-precision floating point Introductory Physics Homework 0