File Exchange

image thumbnail

Extended class

version 1.0 (270 KB) by

Class providing calculation with the native floating point format of the processor.

0 Downloads

Updated

No License

This class provides floating point calculation in the native floating point format of the processor. The extended class stores data with 64bit mantissa instead of 53bit in double.

The class is intended for calculations depending critically on the mantissa length. Summing a large with a small value generally leads to a truncation error of the small value to fit into the mantissa. The extended precision relaxes this constraint, useful to verify the accuracy of a numerical result.

Comments and Ratings (3)

Dear Zeyn Saigol,

thank you for your feedback. Indeed, I use in a few functions (size, rand, randn, ...) mathematical library functions mlfXxxx() by MATLAB. They were shipped as LIBMATLBMX.DLL up to R13. But since, the compiler was greatly improved (optimization and inlining of code), such that these functions are now compiled into the executable. So the library became obsolete and is no longer available. For size(), you can just use this m-function:

%Size of matrix.
%
function varargout=size(o,d)
if ~isa(o,'extended')
[varargout{1:nargout}]=size(o,double(d));
elseif nargin > 1
d=double(d);
if d < 1
error('Dimension number must be a non-negative integer.');
end
varargout{1}=size(o.extended,d+1);
elseif nargout > 1
[o,varargout{1:nargout}]=size(o.extended);
else
o=size(o.extended);
o=o(2:end);
if numel(o) < 2
o(2)=1;
end
varargout{1}=o;
end

I am planing of updating the elementary calculation packages for newer MATLAB releases. As of R2008a, MATLAB benefits of multi-threaded calculations on multi-core CPUs. As of now, my functions achieve top performance per core but do not even try to use multi-threading... So long, if all calculations are to be performed many times independently, users can just start several MATLAB instances.

Zeyn Saigol

It looks like this isn't completely compatible with Matlab R2007 - some functions work, but size() fails as it can't find LIBMATLBMX.DLL. As this file doesn't exist in my installation, I assume the class is compiled for an older version of Matlab.

Is there any chance of releasing a version for newer Matlabs?

Axel Schweiss

I installed it, i think. But how to use it???

Updates

Added function: numel
Added file version information.

MATLAB Release
MATLAB 6.0 (R12)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today