Skip to content

TensorPrimitives.Exp<double> returns negative infinity instead of 0 for doubles between approximately -709.5 and -709.7 #107838

Closed
@BarionLP

Description

@BarionLP

Description

TensorPrimitives.Exp returns negative infinity instead of 0 for doubles between approximately -709.5 and -709.7.
When using Math.Exp() it correctly returns 0.
when using float also everything is fine.
I'm using System.Numerics.Tensors version 9.0.0-rc.1.24431.7

Reproduction Steps

double value = -709.5; //with -709.4 and -709.8 everything works fine
double[] test = [value, value, value, value, value];
double[] destination = new double[test.Length];
TensorPrimitives.Exp<double>(test, destination);

Console.WriteLine(string.Join(' ', destination));

Expected behavior

the above code should output 0 or values close to 0

Actual behavior

Output on my machine: -Infinity -Infinity -Infinity -Infinity -Infinity

Regression?

i haven't tried in the preview versions

Known Workarounds

No response

Configuration

.NET 9 rc1
Windows 10
x64 (AMD)
Simd uses 256bits (4 doubles)

Other information

No response

Metadata

Metadata

Assignees

Labels

area-System.Numerics.Tensorsin-prThere is an active PR which will close this issue when it is merged

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions