]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/Functors/Inverse.hxx
...
[FrontAlgorithms.git] / lib / fpa / Base / Functors / Inverse.hxx
index e2ad9f0092fc0645f0ec8ba679aaa57292a38a46..4574cae2e712e94f77468d787e293b701d1fe3fb 100644 (file)
@@ -9,14 +9,18 @@ Evaluate( const TInput& x ) const
 {
   TInput sign = TInput( ( x < TInput( 0 ) )? -1: 1 );
   TOutput y = TOutput( 1 ) / ( TOutput( 1 ) + TOutput( x * sign ) );
-  return( y * TOutput( sign ) );
+  if( sign < TInput( 0 ) )
+    return( y * this->m_NegativeValue );
+  else
+    return( y );
 }
 
 // -------------------------------------------------------------------------
 template< class _TInput, class _TOutput >
 fpa::Base::Functors::Inverse< _TInput, _TOutput >::
 Inverse( )
-  : Superclass( )
+  : Superclass( ),
+    m_NegativeValue( _TOutput( -1 ) )
 {
 }