operations on single precision numbers unstable in matlab 7.1 (64bit ) vesions and higher

Jan Mathijs Schoffelen Jan.Schoffelen at FCDONDERS.RU.NL
Tue Nov 28 14:12:28 CET 2006


Dear Ali,

What about temporarily converting your data into double precision, and doing
your stuff?

data = struct2double(data);

DO YOUR STUFF HERE

data = struct2single(data);

Yours,

JM

-----Original Message-----
From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf
Of Ali Mazaheri
Sent: Tuesday, November 28, 2006 1:55 PM
To: FIELDTRIP at NIC.SURFNET.NL
Subject: [FIELDTRIP] operations on single precision numbers unstable in
matlab 7.1 (64bit ) vesions and higher

Dear all,
The long subject captions says it all.
I just recently discovered that solutions to the  low level functions in
matlab7.1 and  higher run on a 64 bit platform  become unstable when
using single precision.
This problem does not appear to be  present on matlabs running on a 32
bit platform.

.
A simple example of this problem is as follows

 a=[1 2]
b=[1 2];

 >> a/b
ans = 1

NOW in single precision

a=single(a);
b=single(b);
 >> a/b
ans = 1.9074 e-05


the problem of course become much more compounded when doing more higher
level functions such as detrend. I am completely unable to do a linear
detrend on
single precious data.


regards
Ali



More information about the fieldtrip mailing list