inline CanonicalForm abs ( const CanonicalForm & f ) * * abs() - return absolute value of `f'. * * The absolute value is defined in terms of the function * `sign()'. If it reports negative sign for `f' than -`f' is * returned, otherwise `f'. * * This behaviour is most useful for integers and rationals. But * it may be used to sign-normalize the leading coefficient of * arbitrary polyno
| 114 | * |
| 115 | **/ |
| 116 | inline CanonicalForm |
| 117 | abs ( const CanonicalForm & f ) |
| 118 | { |
| 119 | // it is not only more general to use `sign()' instead of a |
| 120 | // direct comparison `f < 0', it is faster, too |
| 121 | if ( sign( f ) < 0 ) |
| 122 | return -f; |
| 123 | else |
| 124 | return f; |
| 125 | } |
| 126 | //}}} |
| 127 | |
| 128 | /*ENDPUBLIC*/ |
no test coverage detected