December 2005
Beginner to intermediate
618 pages
20h 19m
English
fdim
Obtains the positive difference between two numbers
#include <math.h> doublefdim( doublex, doubley); floatfdimf( floatx, floaty); long doublefdiml( long doublex, long doubley);
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.
/* 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()Read now
Unlock full access