From 3d92926a902017e7cf1f5738e99ff62da596ce12 Mon Sep 17 00:00:00 2001 From: Ethan Werner Date: Sun, 9 Aug 2026 15:02:21 +0400 Subject: refactor --- lib/softplus.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/softplus.c') diff --git a/lib/softplus.c b/lib/softplus.c index b61f96b..6853f66 100644 --- a/lib/softplus.c +++ b/lib/softplus.c @@ -34,7 +34,12 @@ int ts_softplus( for( uint_t i = 0; i < n; ++i ) { fp_t xi = x[0][i]; - y[0][i] = xi > 20 ? xi : log( 1 + exp( xi ) ); + if ( xi > 20 ) + y[0][i] = xi; + else if ( xi < -37 ) + y[0][i] = exp( xi ); + else + y[0][i] = log( 1 + exp( xi ) ); } return 0; } -- cgit v1.3.1