fdim


fdim

Obtains the positive difference between two numbers

 #include <math.h> double fdim ( double x , double y  ); float fdimf ( float x , float y  ); long double fdiml ( long double x , long double y  ); 

The fdim( ) function return x - y or 0, whichever is greater. If the implementation has signed zero values, the zero returned by fdim( ) is positive.

Example

 /* Make sure an argument is within the domain of asin( ) */ double sign, argument, result; /* ... */ sign = copysign( 1.0, argument );      // Save the sign ... argument = copysign( argument, 1.0 );  // ... then use only positive values argument = 1.0 - fdim( 1.0, argument );     // Trim excess beyond 1.0 result = asin( copysign(argument, sign) );  // Restore sign and call asin( ) 

See Also

copysign( ), fabs( ), fmax( ), fmin( )



C(c) In a Nutshell
C in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596006977
EAN: 2147483647
Year: 2006
Pages: 473

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net