summaryrefslogtreecommitdiffstats
path: root/lib/swish.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/swish.c')
-rw-r--r--lib/swish.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/swish.c b/lib/swish.c
index 7d09787..ae0105f 100644
--- a/lib/swish.c
+++ b/lib/swish.c
@@ -34,7 +34,12 @@ int ts_swish(
for( uint_t i = 0; i < n; ++i )
{
fp_t xi = x[0][i];
- y[0][i] = xi / ( 1 + exp( -xi ) );
+ if ( xi > 20 )
+ y[0][i] = xi;
+ else if ( xi < -20 )
+ y[0][i] = xi * exp( xi );
+ else
+ y[0][i] = xi / ( 1 + exp( -xi ) );
}
return 0;
}