Skip to content

Commit

Permalink
fix handling of INF arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-frbg authored May 31, 2024
1 parent 56bd57c commit 020b3e1
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions kernel/x86_64/dscal.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,12 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da, FLOAT *x, BLAS
while(j < n1)
{

x[i]=0.0;
x[i+inc_x]=0.0;
if (isinf(x[i])||isnan(x[i]))
x[i]=NAN;
else x[i]=0.0;
if (isinf(x[i+inc_x])||isnan(x[i+inc_x]))
x[i+inc_x]=NAN;
else x[i+inc_x]=0.0;
i += 2*inc_x ;
j+=2;

Expand All @@ -179,7 +183,9 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da, FLOAT *x, BLAS
while(j < n)
{

x[i]=0.0;
if (isinf(x[i])||isnan(x[i]))
x[i]=NAN;
else x[i]=0.0;
i += inc_x ;
j++;

Expand Down Expand Up @@ -213,25 +219,29 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da, FLOAT *x, BLAS
BLASLONG n1 = n & -8;
if ( n1 > 0 )
{
if ( da == 0.0 )
dscal_kernel_8_zero(n1 , &da , x);
else
// if ( da == 0.0 )
// dscal_kernel_8_zero(n1 , &da , x);
// else
dscal_kernel_8(n1 , &da , x);
}

if ( da == 0.0 )
{
for ( i=n1 ; i<n; i++ )
{
x[i] = 0.0;
if(isinf(x[i])||isnan(x[i]))
x[i]=NAN;
else x[i] = 0.0;
}
}
else
{

for ( i=n1 ; i<n; i++ )
{
x[i] *= da;
if(isinf(x[i]))
x[i]=NAN;
else x[i] *= da;
}
}
return(0);
Expand Down

0 comments on commit 020b3e1

Please sign in to comment.