Browse Source

fix handling of INF arguments

tags/v0.3.28^2
Martin Kroeker GitHub 1 year ago
parent
commit
020b3e1682
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 8 deletions
  1. +18
    -8
      kernel/x86_64/dscal.c

+ 18
- 8
kernel/x86_64/dscal.c View File

@@ -169,8 +169,12 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da, FLOAT *x, BLAS
while(j < n1) 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 ; i += 2*inc_x ;
j+=2; j+=2;


@@ -179,7 +183,9 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da, FLOAT *x, BLAS
while(j < n) 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 ; i += inc_x ;
j++; j++;


@@ -213,9 +219,9 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da, FLOAT *x, BLAS
BLASLONG n1 = n & -8; BLASLONG n1 = n & -8;
if ( n1 > 0 ) 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); dscal_kernel_8(n1 , &da , x);
} }


@@ -223,7 +229,9 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da, FLOAT *x, BLAS
{ {
for ( i=n1 ; i<n; i++ ) 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 else
@@ -231,7 +239,9 @@ int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da, FLOAT *x, BLAS


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


Loading…
Cancel
Save