[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
odd behaviour with 2x2 matrix floating-point multiplication
From: |
s.jo |
Subject: |
odd behaviour with 2x2 matrix floating-point multiplication |
Date: |
Sun, 14 Dec 2014 23:05:09 -0800 (PST) |
Dear all,
I found some errors in my Cygwin system:
+ ## Generate two floating numbers:
+ a = randn
a = -0.314598019079378
+ b = randn
b = 0.687235082446626
+ ##
+ ## Check
+ a * a + b * b
ans = 0.57126397215409
+ -b * a + a * b
ans = 0
+ ##
+ ## Matrix operation
+ [a, b; -b, a] * [a; b]
ans =
0.57126397215409
-5.62429876976855e-18
+ ##
+ ## Element-wise operation
+ [a, b] * [a; b]
ans = 0.57126397215409
+ [-b, a] * [a; b]
ans = 0
+ ##
+ ## Compare
+ [a, b; -b, a] * [a; b] == [a * a + b * b; -b * a + a * b]
ans =
1
0
As above example, two floating-point numbers a and b show different result
when I calculate directly -b * a + a * b and do it again with matrix
operation:
The first result is 0, but the second is -5.62429876976855e-18.
One of non-cygwin systema works well, Dan told.
I am not sure if it is a problem with my cygwin-octave 3.8.2.
Can other users check this example to see if all cygwin release has same
problem?
Best regards,
jo
--
View this message in context:
http://octave.1599824.n4.nabble.com/odd-behaviour-with-2x2-matrix-floating-point-multiplication-tp4667799.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.
- odd behaviour with 2x2 matrix floating-point multiplication,
s.jo <=
- Re: odd behaviour with 2x2 matrix floating-point multiplication, Jordi Gutiérrez Hermoso, 2014/12/15
- Re: odd behaviour with 2x2 matrix floating-point multiplication, Daniel J Sebald, 2014/12/15
- Re: odd behaviour with 2x2 matrix floating-point multiplication, s.jo, 2014/12/15
- Re: odd behaviour with 2x2 matrix floating-point multiplication, s.jo, 2014/12/15
- Re: odd behaviour with 2x2 matrix floating-point multiplication, Marco Atzeri, 2014/12/16
- Re: odd behaviour with 2x2 matrix floating-point multiplication, Marco Atzeri, 2014/12/16
- Re: odd behaviour with 2x2 matrix floating-point multiplication, Jordi Gutiérrez Hermoso, 2014/12/16
- Re: odd behaviour with 2x2 matrix floating-point multiplication, Marco Atzeri, 2014/12/16
- Re: odd behaviour with 2x2 matrix floating-point multiplication, Jordi Gutiérrez Hermoso, 2014/12/16
- Re: odd behaviour with 2x2 matrix floating-point multiplication, s.jo, 2014/12/15