vectorclass / version2

Vector class library, latest version
Apache License 2.0
1.3k stars 148 forks source link

Vec4f SSE2 round returning incorrect values #63

Closed Auburn closed 1 year ago

Auburn commented 1 year ago

Hi, I've been testing the output of different INSTRSET values match correctly and have found some mismatches with the non SSE4.1 version of round( Vec4f ) with large values. It seems to affect numbers larger than 8388608. Here is a small test setup:

#include <iostream>
#include "vectorclass/vectorclass.h"

using namespace std;

void test( float value )
{
    Vec4f a( value );

    Vec4f b = round( a );

    cout.precision( 16 );
    cout << "Round( " << a.extract( 0 ) << " ) = " << b.extract( 0 ) << endl;
}

int main()
{
    cout << "INSTRSET = " << INSTRSET << endl;

    test( 8388687.f );
    test( 8389345.f );

    return 0;
}

Outputs:

INSTRSET = 2
Round( 8388687 ) = 8388688
Round( 8389345 ) = 8389344

I've tested this on x64 latest MSVC and ClangCl

I don't see any remarks regarding this in the manual and was wondering if it's a known issue?

Thanks.

Auburn commented 1 year ago

Actually it looks like I was using an old version of the library by mistake. It looks to be fixed on the latest release.