-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Milestone
Description
Description
Vector2.Normalize - wrong result and i think this is Cpu problem (.Net use some unsuported intrinsics?)
Reproduction Steps
Console.WriteLine(Vector2.Normalize(new(0,2)));
Expected behavior
<0 1>
Actual behavior
<0 ∞>
Regression?
In 7 and 8.0.preview.1 - works
8.0.preview.2, rc.1, 8.0.201 ... - issue
Known Workarounds
No response
Configuration
I reproduced this on intel celeron e3300 and intel p6100
(Win10 and Win7) x64
Other information
public static Vector2 Normalize2(Vector2 value)
{
if (Vector.IsHardwareAccelerated)
{
//-----------------------------------------------------------------------------
Console.WriteLine("HardwareAccelerated");
//-----------------------------------------------------------------------------
float length = value.Length();
return value / length;
}
else
{
float ls = value.X * value.X + value.Y * value.Y;
float invNorm = 1.0f / (float)Math.Sqrt((double)ls);
return new Vector2(
value.X * invNorm,
value.Y * invNorm);
}
}
code
var v1 = new Vector2(0,2);
Console.WriteLine(Vector2.Normalize(v1));
Console.WriteLine(Normalize2(v1));
shows
<0 ∞>
HardwareAccelerated
<0 1>
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged