[Closed] s32 equal tolerance is 1

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

[Closed] s32 equal tolerance is 1

Post by BlindSide »

Sadly version 1.6 was released with this "feature" (I caught it right after release).

Basically doing:

Code: Select all

bool areTheyTheSame = vector2di(0, 0) == vector2di(0, 1);
Yields true (!).

This is because vector2d<T> uses the core::equals() method to compare it's components, and this method has been modified to take a tolerance of 1 (!) by default. This also means that doing core::equals(0, 1) will yield true (!).

Having ran out of exclamation marks, I now ask a question to engineer apple. What do you want to do about this?, and will setting the default tolerance to 0 (Or not having any tolerance, as was the case before February) have an adverse effect on your software renderer? (I assume some FP IR() hacks require some tolerance when testing).
Last edited by BlindSide on Fri Oct 02, 2009 9:22 pm, edited 2 times in total.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Having no tolerance parameter doesn't make sense, because it would require different functions depending on the type. But having a tolerance of 0 would make quite some sense. Just add this test to the vector regression test (I could have sworn that we also had this before...) and change the define to 0. If something does require a different tolerance it can be given as parameter or can be ifdef'ed somewhere.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Aye aye.

UPDATE: Hmmm yeah it seems the regression tests are too concerned with the comparisons returning true and don't seem to check enough which ones return false.

Added test (Which failed initially as expected) to vector2d and vector3d cases and changed the tolerance to 0 for s32 (Now it passes, as expected).

Done deal I suppose, I'll notify engineer_apple because this change may have an adverse effect on his renderer unless he goes through and specifies a tolerance of 1 where he needs it.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Post Reply