diff options
| author | Ethan Werner <mail@ethanwerner.com> | 2026-08-09 15:02:21 +0400 |
|---|---|---|
| committer | Ethan Werner <mail@ethanwerner.com> | 2026-08-09 15:02:21 +0400 |
| commit | 3d92926a902017e7cf1f5738e99ff62da596ce12 (patch) | |
| tree | 2b55422c26a48759d56fa91f06df24449e9dfa88 /lib/swish.c | |
| parent | 07e18043145f3d91c8ea7ec3ad41b3c905585277 (diff) | |
Diffstat (limited to 'lib/swish.c')
| -rw-r--r-- | lib/swish.c | 7 |
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; } |