MathSharp icon indicating copy to clipboard operation
MathSharp copied to clipboard

Bugs in basic math for float Vector256 without AVX?

Open hjred opened this issue 4 years ago • 0 comments

Hello there,

I am currently looking for a SIMD accelerated Math library for my personal project (nothing uploaded so far, but this will change) and I consider using MathSharp.

While looking through some code, there seems to be some suspicious instructions, for example Vector256 float addition without AVX: return FromLowHigh(Add(left.GetLower(), right.GetLower()), Add(left.GetUpper(), right.GetLower()));

Shouldn't the second Add have the upper value of both inputs? right.GetLower() is used in both Adds.

The same is true for other operations.

Add: https://github.com/john-h-k/MathSharp/blob/0ebf7031ab1fd05d3c52183d9c3bc6d0c8e17d71/sources/MathSharp/Vector/VectorFloatingPoint/VectorSingle/BasicMaths.cs#L116

Subtract: https://github.com/john-h-k/MathSharp/blob/0ebf7031ab1fd05d3c52183d9c3bc6d0c8e17d71/sources/MathSharp/Vector/VectorFloatingPoint/VectorSingle/BasicMaths.cs#L150

Multiply: https://github.com/john-h-k/MathSharp/blob/0ebf7031ab1fd05d3c52183d9c3bc6d0c8e17d71/sources/MathSharp/Vector/VectorFloatingPoint/VectorSingle/BasicMaths.cs#L194

Divide: https://github.com/john-h-k/MathSharp/blob/0ebf7031ab1fd05d3c52183d9c3bc6d0c8e17d71/sources/MathSharp/Vector/VectorFloatingPoint/VectorSingle/BasicMaths.cs#L269

Best regards

hjred avatar Dec 06 '20 19:12 hjred