Register to reply

Single and double precision matlab

by sara_87
Tags: double, matlab, precision, single
Share this thread:
sara_87
#1
May9-12, 04:00 PM
P: 773
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
Mysterious source of ozone-depleting chemical baffles NASA
Water leads to chemical that gunks up biofuels production
How lizards regenerate their tails: Researchers discover genetic 'recipe'
Steely Dan
#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
#3
May9-12, 04:23 PM
P: 773
oh right i see. thank you.

Steely Dan
#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