[Pkg-pascal-devel] castle-game-engine test fails on i386

Michalis Kamburelis michalis.kambi at gmail.com
Sat Jan 10 15:15:05 UTC 2015

Hash: SHA1

Paul Gevers wrote:
> List of failures:
> To me they look the same, but maybe NaN is not equal (I know Matlab
> well, and NaN is not equal to NaN.

Same thing if you compare using our FloatsEqual (underneath
MatricesEqual, VectorsEqual): FloatsEqual returns false when comparing
Nan vs Nan. My test, with some comments, on http://pastebin.com/NAEk1zUn .

However, in case of TestMatrixMultiplication assertions, neither side
should have any Nan value inside... They should all be "normal"
numbers. TestMatrixMultiplication simply multiplies some sample 4x4
matrix values, to test that MatrixMult function and * operator work Ok.

Ha, I managed to find the error: M1[3] (4th column) in
TestMatrixMultiplication was simply undefined! I can reproduce your
failures by using

  M1[3][0] := 0;
  M1[3][1] := 0;
  M1[3][2] := Nan;
  M1[3][3] := 0;

So your M[3] was containing garbage memory. As it happens, if the
garbage was *any* representable float value, as it always happened on
my machines, the test would still succeed (as it was just comparing
the multiplications done in 2 ways). But if garbage would result in
Nan float value, the test fails. The trivial fix is on
https://sourceforge.net/p/castle-engine/code/14349/ .

Catching this was cool, thanks! :)

Version: GnuPG v1


More information about the Pkg-pascal-devel mailing list