1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Single and double precision matlab

  1. May 9, 2012 #1
    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.
     
  2. jcsd
  3. May 9, 2012 #2
    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.
     
  4. May 9, 2012 #3
    oh right i see. thank you.
     
  5. May 9, 2012 #4
    I know that's not a comforting answer if you have a large code with lots of variables -- sorry!
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook