2.0

2.0 | 1 rating Rate this file 14 downloads (last 30 days) File Size: 4.15 MB File ID: #22234

Comparing double precision numbers

by Doug Hull

 

24 Nov 2008

Code covered by BSD License  

Two and a half minute video covers the tolerances in double precision numbers

Download Now | Watch this File

File Information
Description

Sometimes you will do a calculation where the answer looks like '0' or '1' or some other number like that. The natural thing to do is to do a test like this:
                    
if (answer == 1)
     Do something
end
                    
However, if the calculation was done in double precision, answer might actually be 1.000000001 or something like that. This video discusses a strategy for overcoming this:
                    
if abs(answer - 1) < 1e-14
     Do something
end
                    
See more videos without downloading here: http://blogs.mathworks.com/videos/category/video/

MATLAB release MATLAB 7.7 (R2008b)
Zip File Content  
HTML Files Video from http://blogs.mathworks.com/pick
Other Files 136 Advanced tolerances.flv,
136 Advanced tolerances.js,
136 Advanced tolerances_config.xml,
136 Advanced tolerances_controller.swf,
136 Advanced tolerances_nofp_bg.gif,
136 Advanced tolerances_preload.swf,
FlashTemplate.css,
mCode/main.m,
ProductionInfo.xml,
swfobject.js
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
25 Nov 2008 Thierry Dalon

The video contains not much more than the description.

See also function EPS.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
video Doug Hull 24 Nov 2008 15:50:25
tutorial Doug Hull 24 Nov 2008 15:50:25
double Doug Hull 24 Nov 2008 15:50:25
tolerance Doug Hull 24 Nov 2008 15:50:25
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com