Rudiments
|
00001 #include <math.h> 00002 #include <tgmath.h> 00003 #undef remainder 00004 #undef floor 00005 #undef round 00006 00007 #ifdef RUDIMENTS_NAMESPACE 00008 namespace rudiments { 00009 #endif 00010 00011 RUDIMENTS_INLINE int32_t math::absoluteValue(int32_t j) { 00012 // FIXME: use abs on platforms where an int is 32 bits 00013 return labs(j); 00014 } 00015 00016 RUDIMENTS_INLINE div_t math::divide(int32_t numer, int32_t denom) { 00017 // FIXME: use div on platforms where an int is 32 bits 00018 return ldiv(numer,denom); 00019 } 00020 00021 RUDIMENTS_INLINE int64_t math::absoluteValue(int64_t j) { 00022 return llabs(j); 00023 } 00024 00025 RUDIMENTS_INLINE lldiv_t math::divide(int64_t numer, int64_t denom) { 00026 return lldiv(numer,denom); 00027 } 00028 00029 00030 00031 00032 // float methods 00033 00034 RUDIMENTS_INLINE bool math::isFinite(float x) { 00035 return isfinite(x); 00036 } 00037 00038 RUDIMENTS_INLINE bool math::isNormal(float x) { 00039 return isnormal(x); 00040 } 00041 00042 RUDIMENTS_INLINE bool math::isSubNormal(float x) { 00043 return (fpclassify(x)==FP_SUBNORMAL); 00044 } 00045 00046 RUDIMENTS_INLINE bool math::isNaN(float x) { 00047 return isnan(x); 00048 } 00049 00050 RUDIMENTS_INLINE bool math::isInfinite(float x) { 00051 return isinf(x); 00052 } 00053 00054 RUDIMENTS_INLINE bool math::isGreater(float x, float y) { 00055 return isgreater(x,y); 00056 } 00057 00058 RUDIMENTS_INLINE bool math::isGreaterOrEqual(float x, float y) { 00059 return isgreaterequal(x,y); 00060 } 00061 00062 RUDIMENTS_INLINE bool math::isLess(float x, float y) { 00063 return isless(x,y); 00064 } 00065 00066 RUDIMENTS_INLINE bool math::isLessOrEqual(float x, float y) { 00067 return islessequal(x,y); 00068 } 00069 00070 RUDIMENTS_INLINE bool math::isLessOrGreater(float x, float y) { 00071 return islessgreater(x,y); 00072 } 00073 00074 RUDIMENTS_INLINE bool math::areNaN(float x, float y) { 00075 return isunordered(x,y); 00076 } 00077 00078 RUDIMENTS_INLINE bool math::isSignBitSet(float x) { 00079 return signbit(x); 00080 } 00081 00082 RUDIMENTS_INLINE float math::arcCosine(float x) { 00083 return acosf(x); 00084 } 00085 00086 RUDIMENTS_INLINE float math::arcSine(float x) { 00087 return asinf(x); 00088 } 00089 00090 RUDIMENTS_INLINE float math::arcTangent(float x) { 00091 return atanf(x); 00092 } 00093 00094 RUDIMENTS_INLINE float math::arcTangent(float y, float x) { 00095 return atan2f(y,x); 00096 } 00097 00098 RUDIMENTS_INLINE float math::cosine(float x) { 00099 return cosf(x); 00100 } 00101 00102 RUDIMENTS_INLINE float math::sine(float x) { 00103 return sinf(x); 00104 } 00105 00106 RUDIMENTS_INLINE float math::tangent(float x) { 00107 return tanf(x); 00108 } 00109 00110 RUDIMENTS_INLINE float math::hyperbolicArcCosine(float x) { 00111 return acoshf(x); 00112 } 00113 00114 RUDIMENTS_INLINE float math::hyperbolicArcSine(float x) { 00115 return asinhf(x); 00116 } 00117 00118 RUDIMENTS_INLINE float math::hyperbolicArcTangent(float x) { 00119 return atanhf(x); 00120 } 00121 00122 RUDIMENTS_INLINE float math::hyperbolicCosine(float x) { 00123 return coshf(x); 00124 } 00125 00126 RUDIMENTS_INLINE float math::hyperbolicSine(float x) { 00127 return sinhf(x); 00128 } 00129 00130 RUDIMENTS_INLINE float math::hyperbolicTangent(float x) { 00131 return tanhf(x); 00132 } 00133 00134 RUDIMENTS_INLINE float math::naturalExponent(float x) { 00135 return expf(x); 00136 } 00137 00138 RUDIMENTS_INLINE float math::normalize(float x, int32_t *exp) { 00139 return frexpf(x,exp); 00140 } 00141 00142 RUDIMENTS_INLINE float math::naturalLog(float x) { 00143 return logf(x); 00144 } 00145 00146 RUDIMENTS_INLINE float math::logBase10(float x) { 00147 return log10f(x); 00148 } 00149 00150 RUDIMENTS_INLINE float math::naturalExponentMinusOne(float x) { 00151 return expm1f(x); 00152 } 00153 00154 RUDIMENTS_INLINE float math::naturalLogPlusOne(float x) { 00155 return log1pf(x); 00156 } 00157 00158 RUDIMENTS_INLINE float math::exponent(float x) { 00159 return logbf(x); 00160 } 00161 00162 RUDIMENTS_INLINE float math::exponentBase2(float x) { 00163 return exp2f(x); 00164 } 00165 00166 RUDIMENTS_INLINE float math::logBase2(float x) { 00167 return log2f(x); 00168 } 00169 00170 RUDIMENTS_INLINE float math::power(float x, float y) { 00171 return powf(x,y); 00172 } 00173 00174 RUDIMENTS_INLINE float math::squareRoot(float x) { 00175 return sqrtf(x); 00176 } 00177 00178 RUDIMENTS_INLINE float math::hypotenuse(float x, float y) { 00179 return hypotf(x,y); 00180 } 00181 00182 RUDIMENTS_INLINE float math::cubeRoot(float x) { 00183 return cbrtf(x); 00184 } 00185 00186 RUDIMENTS_INLINE float math::ceiling(float x) { 00187 return ceilf(x); 00188 } 00189 00190 RUDIMENTS_INLINE float math::absoluteValue(float x) { 00191 return fabsf(x); 00192 } 00193 00194 RUDIMENTS_INLINE float math::floor(float x) { 00195 return floorf(x); 00196 } 00197 00198 RUDIMENTS_INLINE float math::remainder(float x, float y) { 00199 return fmodf(x,y); 00200 } 00201 00202 RUDIMENTS_INLINE float math::nearbyInteger(float x) { 00203 return nearbyintf(x); 00204 } 00205 00206 RUDIMENTS_INLINE float math::round(float x) { 00207 return roundf(x); 00208 } 00209 00210 RUDIMENTS_INLINE float math::truncate(float x) { 00211 return truncf(x); 00212 } 00213 00214 RUDIMENTS_INLINE float math::remainder(float x, float y, int32_t *quo) { 00215 return remquof(x,y,quo); 00216 } 00217 00218 RUDIMENTS_INLINE long math::roundToLong(float x) { 00219 return lrintf(x); 00220 } 00221 00222 RUDIMENTS_INLINE int64_t math::roundToLongLong(float x) { 00223 return llrintf(x); 00224 } 00225 00226 RUDIMENTS_INLINE long math::roundAwayFromZeroToLong(float x) { 00227 return lroundf(x); 00228 } 00229 00230 RUDIMENTS_INLINE int64_t math::roundAwayFromZeroToLongLong(float x) { 00231 return llroundf(x); 00232 } 00233 00234 RUDIMENTS_INLINE float math::copySignBit(float x, float y) { 00235 return copysignf(x,y); 00236 } 00237 00238 RUDIMENTS_INLINE float math::errorFunction(float x) { 00239 return erff(x); 00240 } 00241 00242 RUDIMENTS_INLINE float math::complementaryErrorFunction(float x) { 00243 return erfcf(x); 00244 } 00245 00246 RUDIMENTS_INLINE float math::trueGamma(float x) { 00247 return tgammaf(x); 00248 } 00249 00250 RUDIMENTS_INLINE float math::naturalLogGamma(float x) { 00251 return lgammaf(x); 00252 } 00253 00254 RUDIMENTS_INLINE float math::roundInexact(float x) { 00255 return rintf(x); 00256 } 00257 00258 RUDIMENTS_INLINE float math::nextAfter(float x, float y) { 00259 return nextafterf(x,y); 00260 } 00261 00262 RUDIMENTS_INLINE float math::nextToward(float x, float y) { 00263 return nexttowardf(x,y); 00264 } 00265 00266 RUDIMENTS_INLINE float math::scaleByRadixToPower(float x, float n) { 00267 return scalbf(x,n); 00268 } 00269 00270 RUDIMENTS_INLINE float math::scaleByRadixToPower(float x, int32_t n) { 00271 return scalbnf(x,n); 00272 } 00273 00274 RUDIMENTS_INLINE float math::scaleByRadixToPower(float x, long n) { 00275 return scalblnf(x,n); 00276 } 00277 00278 RUDIMENTS_INLINE int32_t math::integralExponent(float x) { 00279 return ilogbf(x); 00280 } 00281 00282 RUDIMENTS_INLINE float math::positiveDifference(float x, float y) { 00283 return fdimf(x,y); 00284 } 00285 00286 RUDIMENTS_INLINE float math::larger(float x, float y) { 00287 return fmaxf(x,y); 00288 } 00289 00290 RUDIMENTS_INLINE float math::smaller(float x, float y) { 00291 return fminf(x,y); 00292 } 00293 00294 RUDIMENTS_INLINE float math::multiplyAndAdd(float x, float y, float z) { 00295 return fmaf(x,y,z); 00296 } 00297 00298 RUDIMENTS_INLINE float math::argument(float complex z) { 00299 return cargf(z); 00300 } 00301 00302 RUDIMENTS_INLINE float complex math::conjugate(float complex z) { 00303 return conjf(z); 00304 } 00305 00306 RUDIMENTS_INLINE float complex math::project(float complex z) { 00307 return cprojf(z); 00308 } 00309 00310 RUDIMENTS_INLINE float math::imaginary(float complex z) { 00311 return cimagf(z); 00312 } 00313 00314 RUDIMENTS_INLINE float math::real(float complex z) { 00315 return crealf(z); 00316 } 00317 00318 00319 00320 // double methods 00321 00322 RUDIMENTS_INLINE bool math::isFinite(double x) { 00323 return isfinite(x); 00324 } 00325 00326 RUDIMENTS_INLINE bool math::isNormal(double x) { 00327 return isnormal(x); 00328 } 00329 00330 RUDIMENTS_INLINE bool math::isSubNormal(double x) { 00331 return (fpclassify(x)==FP_SUBNORMAL); 00332 } 00333 00334 RUDIMENTS_INLINE bool math::isNaN(double x) { 00335 return isnan(x); 00336 } 00337 00338 RUDIMENTS_INLINE bool math::isInfinite(double x) { 00339 return isinf(x); 00340 } 00341 00342 RUDIMENTS_INLINE bool math::isGreater(double x, double y) { 00343 return isgreater(x,y); 00344 } 00345 00346 RUDIMENTS_INLINE bool math::isGreaterOrEqual(double x, double y) { 00347 return isgreaterequal(x,y); 00348 } 00349 00350 RUDIMENTS_INLINE bool math::isLess(double x, double y) { 00351 return isless(x,y); 00352 } 00353 00354 RUDIMENTS_INLINE bool math::isLessOrEqual(double x, double y) { 00355 return islessequal(x,y); 00356 } 00357 00358 RUDIMENTS_INLINE bool math::isLessOrGreater(double x, double y) { 00359 return islessgreater(x,y); 00360 } 00361 00362 RUDIMENTS_INLINE bool math::areNaN(double x, double y) { 00363 return isunordered(x,y); 00364 } 00365 00366 RUDIMENTS_INLINE bool math::isSignBitSet(double x) { 00367 return signbit(x); 00368 } 00369 00370 RUDIMENTS_INLINE double math::arcCosine(double x) { 00371 return acos(x); 00372 } 00373 00374 RUDIMENTS_INLINE double math::arcSine(double x) { 00375 return asin(x); 00376 } 00377 00378 RUDIMENTS_INLINE double math::arcTangent(double x) { 00379 return atan(x); 00380 } 00381 00382 RUDIMENTS_INLINE double math::arcTangent(double y, double x) { 00383 return atan2(y,x); 00384 } 00385 00386 RUDIMENTS_INLINE double math::cosine(double x) { 00387 return cos(x); 00388 } 00389 00390 RUDIMENTS_INLINE double math::sine(double x) { 00391 return sin(x); 00392 } 00393 00394 RUDIMENTS_INLINE double math::tangent(double x) { 00395 return tan(x); 00396 } 00397 00398 RUDIMENTS_INLINE double math::hyperbolicArcCosine(double x) { 00399 return acosh(x); 00400 } 00401 00402 RUDIMENTS_INLINE double math::hyperbolicArcSine(double x) { 00403 return asinh(x); 00404 } 00405 00406 RUDIMENTS_INLINE double math::hyperbolicArcTangent(double x) { 00407 return atanh(x); 00408 } 00409 00410 RUDIMENTS_INLINE double math::hyperbolicCosine(double x) { 00411 return cosh(x); 00412 } 00413 00414 RUDIMENTS_INLINE double math::hyperbolicSine(double x) { 00415 return sinh(x); 00416 } 00417 00418 RUDIMENTS_INLINE double math::hyperbolicTangent(double x) { 00419 return tanh(x); 00420 } 00421 00422 RUDIMENTS_INLINE double math::naturalExponent(double x) { 00423 return exp(x); 00424 } 00425 00426 RUDIMENTS_INLINE double math::normalize(double x, int32_t *exp) { 00427 return frexp(x,exp); 00428 } 00429 00430 RUDIMENTS_INLINE double math::naturalLog(double x) { 00431 return log(x); 00432 } 00433 00434 RUDIMENTS_INLINE double math::logBase10(double x) { 00435 return log10(x); 00436 } 00437 00438 RUDIMENTS_INLINE double math::naturalExponentMinusOne(double x) { 00439 return expm1(x); 00440 } 00441 00442 RUDIMENTS_INLINE double math::naturalLogPlusOne(double x) { 00443 return log1p(x); 00444 } 00445 00446 RUDIMENTS_INLINE double math::exponent(double x) { 00447 return logb(x); 00448 } 00449 00450 RUDIMENTS_INLINE double math::exponentBase2(double x) { 00451 return exp2(x); 00452 } 00453 00454 RUDIMENTS_INLINE double math::logBase2(double x) { 00455 return log2(x); 00456 } 00457 00458 RUDIMENTS_INLINE double math::power(double x, double y) { 00459 return pow(x,y); 00460 } 00461 00462 RUDIMENTS_INLINE double math::squareRoot(double x) { 00463 return sqrt(x); 00464 } 00465 00466 RUDIMENTS_INLINE double math::hypotenuse(double x, double y) { 00467 return hypot(x,y); 00468 } 00469 00470 RUDIMENTS_INLINE double math::cubeRoot(double x) { 00471 return cbrt(x); 00472 } 00473 00474 RUDIMENTS_INLINE double math::ceiling(double x) { 00475 return ceil(x); 00476 } 00477 00478 RUDIMENTS_INLINE double math::absoluteValue(double x) { 00479 return fabs(x); 00480 } 00481 00482 RUDIMENTS_INLINE double math::floor(double x) { 00483 return floor(x); 00484 } 00485 00486 RUDIMENTS_INLINE double math::remainder(double x, double y) { 00487 return fmod(x,y); 00488 } 00489 00490 RUDIMENTS_INLINE double math::nearbyInteger(double x) { 00491 return nearbyint(x); 00492 } 00493 00494 RUDIMENTS_INLINE double math::round(double x) { 00495 return round(x); 00496 } 00497 00498 RUDIMENTS_INLINE double math::truncate(double x) { 00499 return trunc(x); 00500 } 00501 00502 RUDIMENTS_INLINE double math::remainder(double x, double y, int32_t *quo) { 00503 return remquo(x,y,quo); 00504 } 00505 00506 RUDIMENTS_INLINE long math::roundToLong(double x) { 00507 return lrint(x); 00508 } 00509 00510 RUDIMENTS_INLINE int64_t math::roundToLongLong(double x) { 00511 return llrint(x); 00512 } 00513 00514 RUDIMENTS_INLINE long math::roundAwayFromZeroToLong(double x) { 00515 return lround(x); 00516 } 00517 00518 RUDIMENTS_INLINE int64_t math::roundAwayFromZeroToLongLong(double x) { 00519 return llround(x); 00520 } 00521 00522 RUDIMENTS_INLINE double math::copySignBit(double x, double y) { 00523 return copysign(x,y); 00524 } 00525 00526 RUDIMENTS_INLINE double math::errorFunction(double x) { 00527 return erf(x); 00528 } 00529 00530 RUDIMENTS_INLINE double math::complementaryErrorFunction(double x) { 00531 return erfc(x); 00532 } 00533 00534 RUDIMENTS_INLINE double math::trueGamma(double x) { 00535 return tgamma(x); 00536 } 00537 00538 RUDIMENTS_INLINE double math::naturalLogGamma(double x) { 00539 return lgamma(x); 00540 } 00541 00542 RUDIMENTS_INLINE double math::roundInexact(double x) { 00543 return rint(x); 00544 } 00545 00546 RUDIMENTS_INLINE double math::nextAfter(double x, double y) { 00547 return nextafter(x,y); 00548 } 00549 00550 RUDIMENTS_INLINE double math::nextToward(double x, double y) { 00551 return nexttoward(x,y); 00552 } 00553 00554 RUDIMENTS_INLINE double math::scaleByRadixToPower(double x, double n) { 00555 return scalb(x,n); 00556 } 00557 00558 RUDIMENTS_INLINE double math::scaleByRadixToPower(double x, int32_t n) { 00559 return scalbn(x,n); 00560 } 00561 00562 RUDIMENTS_INLINE double math::scaleByRadixToPower(double x, long n) { 00563 return scalbln(x,n); 00564 } 00565 00566 RUDIMENTS_INLINE int32_t math::integralExponent(double x) { 00567 return ilogb(x); 00568 } 00569 00570 RUDIMENTS_INLINE double math::positiveDifference(double x, double y) { 00571 return fdim(x,y); 00572 } 00573 00574 RUDIMENTS_INLINE double math::larger(double x, double y) { 00575 return fmax(x,y); 00576 } 00577 00578 RUDIMENTS_INLINE double math::smaller(double x, double y) { 00579 return fmin(x,y); 00580 } 00581 00582 RUDIMENTS_INLINE double math::multiplyAndAdd(double x, double y, double z) { 00583 return fma(x,y,z); 00584 } 00585 00586 RUDIMENTS_INLINE double math::argument(double complex z) { 00587 return carg(z); 00588 } 00589 00590 RUDIMENTS_INLINE double complex math::conjugate(double complex z) { 00591 return conj(z); 00592 } 00593 00594 RUDIMENTS_INLINE double complex math::project(double complex z) { 00595 return cproj(z); 00596 } 00597 00598 RUDIMENTS_INLINE double math::imaginary(double complex z) { 00599 return cimag(z); 00600 } 00601 00602 RUDIMENTS_INLINE double math::real(double complex z) { 00603 return creal(z); 00604 } 00605 00606 00607 // long double methods 00608 00609 RUDIMENTS_INLINE bool math::isFinite(long double x) { 00610 return isfinite(x); 00611 } 00612 00613 RUDIMENTS_INLINE bool math::isNormal(long double x) { 00614 return isnormal(x); 00615 } 00616 00617 RUDIMENTS_INLINE bool math::isSubNormal(long double x) { 00618 return (fpclassify(x)==FP_SUBNORMAL); 00619 } 00620 00621 RUDIMENTS_INLINE bool math::isNaN(long double x) { 00622 return isnan(x); 00623 } 00624 00625 RUDIMENTS_INLINE bool math::isInfinite(long double x) { 00626 return isinf(x); 00627 } 00628 00629 RUDIMENTS_INLINE bool math::isGreater(long double x, long double y) { 00630 return isgreater(x,y); 00631 } 00632 00633 RUDIMENTS_INLINE bool math::isGreaterOrEqual(long double x, long double y) { 00634 return isgreaterequal(x,y); 00635 } 00636 00637 RUDIMENTS_INLINE bool math::isLess(long double x, long double y) { 00638 return isless(x,y); 00639 } 00640 00641 RUDIMENTS_INLINE bool math::isLessOrEqual(long double x, long double y) { 00642 return islessequal(x,y); 00643 } 00644 00645 RUDIMENTS_INLINE bool math::isLessOrGreater(long double x, long double y) { 00646 return islessgreater(x,y); 00647 } 00648 00649 RUDIMENTS_INLINE bool math::areNaN(long double x, long double y) { 00650 return isunordered(x,y); 00651 } 00652 00653 RUDIMENTS_INLINE bool math::isSignBitSet(long double x) { 00654 return signbit(x); 00655 } 00656 00657 RUDIMENTS_INLINE long double math::arcCosine(long double x) { 00658 return acosl(x); 00659 } 00660 00661 RUDIMENTS_INLINE long double math::arcSine(long double x) { 00662 return asinl(x); 00663 } 00664 00665 RUDIMENTS_INLINE long double math::arcTangent(long double x) { 00666 return atanl(x); 00667 } 00668 00669 RUDIMENTS_INLINE long double math::arcTangent(long double y, long double x) { 00670 return atan2l(y,x); 00671 } 00672 00673 RUDIMENTS_INLINE long double math::cosine(long double x) { 00674 return cosl(x); 00675 } 00676 00677 RUDIMENTS_INLINE long double math::sine(long double x) { 00678 return sinl(x); 00679 } 00680 00681 RUDIMENTS_INLINE long double math::tangent(long double x) { 00682 return tanl(x); 00683 } 00684 00685 RUDIMENTS_INLINE long double math::hyperbolicArcCosine(long double x) { 00686 return acoshl(x); 00687 } 00688 00689 RUDIMENTS_INLINE long double math::hyperbolicArcSine(long double x) { 00690 return asinhl(x); 00691 } 00692 00693 RUDIMENTS_INLINE long double math::hyperbolicArcTangent(long double x) { 00694 return atanhl(x); 00695 } 00696 00697 RUDIMENTS_INLINE long double math::hyperbolicCosine(long double x) { 00698 return coshl(x); 00699 } 00700 00701 RUDIMENTS_INLINE long double math::hyperbolicSine(long double x) { 00702 return sinhl(x); 00703 } 00704 00705 RUDIMENTS_INLINE long double math::hyperbolicTangent(long double x) { 00706 return tanhl(x); 00707 } 00708 00709 RUDIMENTS_INLINE long double math::naturalExponent(long double x) { 00710 return expl(x); 00711 } 00712 00713 RUDIMENTS_INLINE long double math::normalize(long double x, int32_t *exp) { 00714 return frexpl(x,exp); 00715 } 00716 00717 RUDIMENTS_INLINE long double math::naturalLog(long double x) { 00718 return logl(x); 00719 } 00720 00721 RUDIMENTS_INLINE long double math::logBase10(long double x) { 00722 return log10l(x); 00723 } 00724 00725 RUDIMENTS_INLINE long double math::naturalExponentMinusOne(long double x) { 00726 return expm1l(x); 00727 } 00728 00729 RUDIMENTS_INLINE long double math::naturalLogPlusOne(long double x) { 00730 return log1pl(x); 00731 } 00732 00733 RUDIMENTS_INLINE long double math::exponent(long double x) { 00734 return logbl(x); 00735 } 00736 00737 RUDIMENTS_INLINE long double math::exponentBase2(long double x) { 00738 return exp2l(x); 00739 } 00740 00741 RUDIMENTS_INLINE long double math::logBase2(long double x) { 00742 return log2l(x); 00743 } 00744 00745 RUDIMENTS_INLINE long double math::power(long double x, long double y) { 00746 return powl(x,y); 00747 } 00748 00749 RUDIMENTS_INLINE long double math::squareRoot(long double x) { 00750 return sqrtl(x); 00751 } 00752 00753 RUDIMENTS_INLINE long double math::hypotenuse(long double x, long double y) { 00754 return hypotl(x,y); 00755 } 00756 00757 RUDIMENTS_INLINE long double math::cubeRoot(long double x) { 00758 return cbrtl(x); 00759 } 00760 00761 RUDIMENTS_INLINE long double math::ceiling(long double x) { 00762 return ceill(x); 00763 } 00764 00765 RUDIMENTS_INLINE long double math::absoluteValue(long double x) { 00766 return fabsl(x); 00767 } 00768 00769 RUDIMENTS_INLINE long double math::floor(long double x) { 00770 return floorl(x); 00771 } 00772 00773 RUDIMENTS_INLINE long double math::remainder(long double x, long double y) { 00774 return fmodl(x,y); 00775 } 00776 00777 RUDIMENTS_INLINE long double math::nearbyInteger(long double x) { 00778 return nearbyintl(x); 00779 } 00780 00781 RUDIMENTS_INLINE long double math::round(long double x) { 00782 return roundl(x); 00783 } 00784 00785 RUDIMENTS_INLINE long double math::truncate(long double x) { 00786 return truncl(x); 00787 } 00788 00789 RUDIMENTS_INLINE long double math::remainder(long double x, 00790 long double y, int32_t *quo) { 00791 return remquol(x,y,quo); 00792 } 00793 00794 RUDIMENTS_INLINE long math::roundToLong(long double x) { 00795 return lrintl(x); 00796 } 00797 00798 RUDIMENTS_INLINE int64_t math::roundToLongLong(long double x) { 00799 return llrintl(x); 00800 } 00801 00802 RUDIMENTS_INLINE long math::roundAwayFromZeroToLong(long double x) { 00803 return lroundl(x); 00804 } 00805 00806 RUDIMENTS_INLINE int64_t math::roundAwayFromZeroToLongLong(long double x) { 00807 return llroundl(x); 00808 } 00809 00810 RUDIMENTS_INLINE long double math::copySignBit(long double x, long double y) { 00811 return copysignl(x,y); 00812 } 00813 00814 RUDIMENTS_INLINE long double math::errorFunction(long double x) { 00815 return erfl(x); 00816 } 00817 00818 RUDIMENTS_INLINE long double math::complementaryErrorFunction(long double x) { 00819 return erfcl(x); 00820 } 00821 00822 RUDIMENTS_INLINE long double math::trueGamma(long double x) { 00823 return tgammal(x); 00824 } 00825 00826 RUDIMENTS_INLINE long double math::naturalLogGamma(long double x) { 00827 return lgammal(x); 00828 } 00829 00830 RUDIMENTS_INLINE long double math::roundInexact(long double x) { 00831 return rintl(x); 00832 } 00833 00834 RUDIMENTS_INLINE long double math::nextAfter(long double x, long double y) { 00835 return nextafterl(x,y); 00836 } 00837 00838 RUDIMENTS_INLINE long double math::nextToward(long double x, long double y) { 00839 return nexttowardl(x,y); 00840 } 00841 00842 RUDIMENTS_INLINE long double math::scaleByRadixToPower(long double x, 00843 long double n) { 00844 return scalbl(x,n); 00845 } 00846 00847 RUDIMENTS_INLINE long double math::scaleByRadixToPower(long double x, 00848 int32_t n) { 00849 return scalbnl(x,n); 00850 } 00851 00852 RUDIMENTS_INLINE long double math::scaleByRadixToPower(long double x, long n) { 00853 return scalblnl(x,n); 00854 } 00855 00856 RUDIMENTS_INLINE int32_t math::integralExponent(long double x) { 00857 return ilogbl(x); 00858 } 00859 00860 RUDIMENTS_INLINE long double math::positiveDifference(long double x, 00861 long double y) { 00862 return fdiml(x,y); 00863 } 00864 00865 RUDIMENTS_INLINE long double math::larger(long double x, long double y) { 00866 return fmaxl(x,y); 00867 } 00868 00869 RUDIMENTS_INLINE long double math::smaller(long double x, long double y) { 00870 return fminl(x,y); 00871 } 00872 00873 RUDIMENTS_INLINE long double math::multiplyAndAdd(long double x, 00874 long double y, long double z) { 00875 return fmal(x,y,z); 00876 } 00877 00878 RUDIMENTS_INLINE long double math::argument(long double complex z) { 00879 return cargl(z); 00880 } 00881 00882 RUDIMENTS_INLINE long double complex math::conjugate(long double complex z) { 00883 return conjl(z); 00884 } 00885 00886 RUDIMENTS_INLINE long double complex math::project(long double complex z) { 00887 return cprojl(z); 00888 } 00889 00890 RUDIMENTS_INLINE long double math::imaginary(long double complex z) { 00891 return cimagl(z); 00892 } 00893 00894 RUDIMENTS_INLINE long double math::real(long double complex z) { 00895 return creall(z); 00896 } 00897 00898 RUDIMENTS_INLINE float math::loadExponent(float x, int32_t exp) { 00899 return ldexpf(x,exp); 00900 } 00901 00902 RUDIMENTS_INLINE double math::loadExponent(double x, int32_t exp) { 00903 return ldexp(x,exp); 00904 } 00905 00906 RUDIMENTS_INLINE long double math::loadExponent(long double x, int32_t exp) { 00907 return ldexpl(x,exp); 00908 } 00909 00910 #ifdef RUDIMENTS_NAMESPACE 00911 } 00912 #endif