| 1 | extern crate libcrust-analyzer cargo float_extras 0.1.6 libc/; |
| 2 | |
| 3 | #[allow(dead_code)] |
| 4 | mod cmathrust-analyzer cargo float_extras 0.1.6 cmath/ { |
| 5 | use libcrust-analyzer cargo libc 0.2.189 crate/::{c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#, c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#}; |
| 6 | |
| 7 | #[link_name = "m"] |
| 8 | extern "C" { |
| 9 | pub fn frexprust-analyzer cargo float_extras 0.1.6 frexp().(n: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#, value: &mut c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#) -> c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#; |
| 10 | pub fn ldexprust-analyzer cargo float_extras 0.1.6 ldexp().(x: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#, n: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#) -> c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#; |
| 11 | pub fn modfrust-analyzer cargo float_extras 0.1.6 modf().(x: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#, iptr: &mut c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#) -> c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#; |
| 12 | pub fn ilogbrust-analyzer cargo float_extras 0.1.6 ilogb().(n: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#) -> c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#; |
| 13 | pub fn logbrust-analyzer cargo float_extras 0.1.6 logb().(n: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#) -> c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#; |
| 14 | pub fn scalbnrust-analyzer cargo float_extras 0.1.6 scalbn().(x: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#, n: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#) -> c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#; |
| 15 | |
| 16 | pub fn erfrust-analyzer cargo float_extras 0.1.6 erf().(n: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#) -> c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#; |
| 17 | pub fn erfcrust-analyzer cargo float_extras 0.1.6 erfc().(n: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#) -> c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#; |
| 18 | pub fn tgammarust-analyzer cargo float_extras 0.1.6 tgamma().(n: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#) -> c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#; |
| 19 | pub fn lgammarust-analyzer cargo float_extras 0.1.6 lgamma().(n: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#) -> c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#; |
| 20 | |
| 21 | pub fn fmodrust-analyzer cargo float_extras 0.1.6 fmod().(a: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#, b: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#) -> c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#; |
| 22 | pub fn lroundrust-analyzer cargo float_extras 0.1.6 lround().(x: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#) -> c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#; |
| 23 | // need longlong: llround |
| 24 | // need fenv.h: rint, lrint, llrint, nearbyint |
| 25 | pub fn remainderrust-analyzer cargo float_extras 0.1.6 remainder().(a: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#, b: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#) -> c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#; |
| 26 | pub fn remquorust-analyzer cargo float_extras 0.1.6 remquo().(x: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#, y: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#, quot: &mut c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#) -> c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#; |
| 27 | |
| 28 | pub fn copysignrust-analyzer cargo float_extras 0.1.6 copysign().(x: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#, y: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#) -> c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#; |
| 29 | pub fn nextafterrust-analyzer cargo float_extras 0.1.6 nextafter().(x: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#, y: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#) -> c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#; |
| 30 | // need long_double: nexttoward |
| 31 | |
| 32 | pub fn fdimrust-analyzer cargo float_extras 0.1.6 fdim().(a: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#, b: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#) -> c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#; |
| 33 | pub fn fmarust-analyzer cargo float_extras 0.1.6 fma().(x: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#, y: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#, z: c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#) -> c_doublerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_double#; |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | pub mod f64rust-analyzer cargo float_extras 0.1.6 f64/ { |
| 38 | use libcrust-analyzer cargo libc 0.2.189 crate/::c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#; |
| 39 | use superrust-analyzer cargo float_extras 0.1.6 crate/::cmathrust-analyzer cargo float_extras 0.1.6 cmath/; |
| 40 | |
| 41 | /// frexp is used to split the number x into a normalized fraction and an exponent |
| 42 | /// which is stored in exp. |
| 43 | pub fn frexprust-analyzer cargo float_extras 0.1.6 f64/frexp().(x: f64) -> (f64, isize) { |
| 44 | let mut n: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = 0; |
| 45 | let f = unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::frexprust-analyzer cargo float_extras 0.1.6 frexp().(x, &mut n) }; |
| 46 | (f, n as isize) |
| 47 | } |
| 48 | /// ldexp returns the result of multiplying the floating-point number x by 2 raised to |
| 49 | /// the power exp. |
| 50 | pub fn ldexprust-analyzer cargo float_extras 0.1.6 f64/ldexp().(x: f64, exp: isize) -> f64 { |
| 51 | unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::ldexprust-analyzer cargo float_extras 0.1.6 ldexp().(x, exp as i32) } |
| 52 | } |
| 53 | /// modf breaks the argument x into an integral part and a fractional part, each |
| 54 | /// of which has the same sign as x. |
| 55 | pub fn modfrust-analyzer cargo float_extras 0.1.6 f64/modf().(x: f64) -> (f64, f64) { |
| 56 | let mut i: f64 = 0.; |
| 57 | let f = unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::modfrust-analyzer cargo float_extras 0.1.6 modf().(x, &mut i) }; |
| 58 | (i, f) |
| 59 | } |
| 60 | /// iligb returns the exponent part of their argument as a signed integer. |
| 61 | pub fn ilogbrust-analyzer cargo float_extras 0.1.6 f64/ilogb().(n: f64) -> isize { |
| 62 | (unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::ilogbrust-analyzer cargo float_extras 0.1.6 ilogb().(n) }) as isize |
| 63 | } |
| 64 | /// logb extracts the exponent from the internal floating-point |
| 65 | /// representation of x and return it as a floating-point value. |
| 66 | pub fn logbrust-analyzer cargo float_extras 0.1.6 f64/logb().(x: f64) -> f64 { |
| 67 | unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::logbrust-analyzer cargo float_extras 0.1.6 logb().(x) } |
| 68 | } |
| 69 | /// scalbn multiplies their first argument x by FLT_RADIX (probably 2) to the power of |
| 70 | /// exp, that is: |
| 71 | /// ```text |
| 72 | /// x * FLT_RADIX ** exp |
| 73 | /// ``` |
| 74 | pub fn scalbnrust-analyzer cargo float_extras 0.1.6 f64/scalbn().(x: f64, exp: isize) -> f64 { |
| 75 | unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::scalbnrust-analyzer cargo float_extras 0.1.6 scalbn().(x, exp as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#) } |
| 76 | } |
| 77 | |
| 78 | /// erf returns the error function of x, defined as |
| 79 | /// ```text |
| 80 | /// erf(x) = 2/sqrt(pi)* integral from 0 to x of exp(-t*t) dt |
| 81 | /// ``` |
| 82 | pub fn erfrust-analyzer cargo float_extras 0.1.6 f64/erf().(x: f64) -> f64 { |
| 83 | unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::erfrust-analyzer cargo float_extras 0.1.6 erf().(x) } |
| 84 | } |
| 85 | /// erfc returns the complementary error function of x, that is, 1.0 - erf(x). |
| 86 | pub fn erfcrust-analyzer cargo float_extras 0.1.6 f64/erfc().(x: f64) -> f64 { |
| 87 | unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::erfcrust-analyzer cargo float_extras 0.1.6 erfc().(x) } |
| 88 | } |
| 89 | |
| 90 | /// tgamma calculates the Gamma function of x. |
| 91 | /// |
| 92 | /// The Gamma function is defined by |
| 93 | /// |
| 94 | /// ```text |
| 95 | /// Gamma(x) = integral from 0 to infinity of t^(x-1) e^-t dt |
| 96 | /// ``` |
| 97 | /// It is defined for every real number except for nonpositive integers. For nonnegative |
| 98 | /// integral m one has |
| 99 | /// |
| 100 | /// ```text |
| 101 | /// Gamma(m+1) = m! |
| 102 | /// ``` |
| 103 | /// and, more generally, for all x: |
| 104 | /// |
| 105 | /// ```text |
| 106 | /// Gamma(x+1) = x * Gamma(x) |
| 107 | /// ``` |
| 108 | /// |
| 109 | /// Furthermore, the following is valid for all values of x outside the poles: |
| 110 | /// |
| 111 | /// ```text |
| 112 | /// Gamma(x) * Gamma(1 - x) = PI / sin(PI * x) |
| 113 | /// ``` |
| 114 | pub fn tgammarust-analyzer cargo float_extras 0.1.6 f64/tgamma().(x: f64) -> f64 { |
| 115 | unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::tgammarust-analyzer cargo float_extras 0.1.6 tgamma().(x) } |
| 116 | } |
| 117 | /// lgamma returns the natural logarithm of the absolute value of the Gamma function. |
| 118 | pub fn lgammarust-analyzer cargo float_extras 0.1.6 f64/lgamma().(x: f64) -> f64 { |
| 119 | unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::lgammarust-analyzer cargo float_extras 0.1.6 lgamma().(x) } |
| 120 | } |
| 121 | |
| 122 | /// fmod computes the floating-point remainder of dividing x by y. The return |
| 123 | /// value is x - n * y, where n is the quotient of x / y, rounded toward zero to an integer. |
| 124 | pub fn fmodrust-analyzer cargo float_extras 0.1.6 f64/fmod().(x: f64, y: f64) -> f64 { |
| 125 | unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::fmodrust-analyzer cargo float_extras 0.1.6 fmod().(x, y) } |
| 126 | } |
| 127 | /// lround rounds their argument to the nearest integer value, rounding away from zero. |
| 128 | pub fn lroundrust-analyzer cargo float_extras 0.1.6 f64/lround().(x: f64) -> isize { |
| 129 | (unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::lroundrust-analyzer cargo float_extras 0.1.6 lround().(x) }) as isize |
| 130 | } |
| 131 | /// remainder compute the remainder of dividing x by y. The return value is x-n*y, where |
| 132 | /// n is the value x / y, rounded to the nearest integer. If the absolute value of x-n*y is |
| 133 | /// 0.5, n is chosen to be even. |
| 134 | pub fn remainderrust-analyzer cargo float_extras 0.1.6 f64/remainder().(x: f64, y: f64) -> f64 { |
| 135 | unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::remainderrust-analyzer cargo float_extras 0.1.6 remainder().(x, y) } |
| 136 | } |
| 137 | /// remquo computes the remainder and part of the quotient upon division of x by y. |
| 138 | pub fn remquorust-analyzer cargo float_extras 0.1.6 f64/remquo().(x: f64, y: f64) -> (isize, f64) { |
| 139 | let mut quot: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# = 0; |
| 140 | let rem = unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::remquorust-analyzer cargo float_extras 0.1.6 remquo().(x, y, &mut quot) }; |
| 141 | (quot as isize, rem) |
| 142 | } |
| 143 | |
| 144 | /// copysign returns a value whose absolute value matches that of x, but whose sign bit |
| 145 | /// matches that of y. |
| 146 | pub fn copysignrust-analyzer cargo float_extras 0.1.6 f64/copysign().(x: f64, y: f64) -> f64 { |
| 147 | unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::copysignrust-analyzer cargo float_extras 0.1.6 copysign().(x, y) } |
| 148 | } |
| 149 | /// nextafter returns the next representable floating-point value following x in the |
| 150 | /// direction of y. If y is less than x, these functions will return the largest representable |
| 151 | /// number less than x. |
| 152 | pub fn nextafterrust-analyzer cargo float_extras 0.1.6 f64/nextafter().(x: f64, y: f64) -> f64 { |
| 153 | unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::nextafterrust-analyzer cargo float_extras 0.1.6 nextafter().(x, y) } |
| 154 | } |
| 155 | |
| 156 | /// fdim returns the positive difference, max(x-y,0), between their arguments. |
| 157 | pub fn fdimrust-analyzer cargo float_extras 0.1.6 f64/fdim().(x: f64, y: f64) -> f64 { |
| 158 | unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::fdimrust-analyzer cargo float_extras 0.1.6 fdim().(x, y) } |
| 159 | } |
| 160 | /// fma computes x * y + z. The result is rounded as one ternary operation |
| 161 | /// according to the current rounding mode. |
| 162 | pub fn fmarust-analyzer cargo float_extras 0.1.6 f64/fma().(x: f64, y: f64, z: f64) -> f64 { |
| 163 | unsafe { cmathrust-analyzer cargo float_extras 0.1.6 cmath/::fmarust-analyzer cargo float_extras 0.1.6 fma().(x, y, z) } |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | #[cfg(test)] |
| 168 | mod testsrust-analyzer cargo float_extras 0.1.6 tests/ { |
| 169 | use superrust-analyzer cargo float_extras 0.1.6 crate/::f64rust-analyzer cargo float_extras 0.1.6 f64/::*; |
| 170 | |
| 171 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 172 | fn smoke_testrust-analyzer cargo float_extras 0.1.6 tests/smoke_test().() { |
| 173 | frexprust-analyzer cargo float_extras 0.1.6 f64/frexp().(0.); |
| 174 | ldexprust-analyzer cargo float_extras 0.1.6 f64/ldexp().(0., 0); |
| 175 | modfrust-analyzer cargo float_extras 0.1.6 f64/modf().(0.); |
| 176 | ilogbrust-analyzer cargo float_extras 0.1.6 f64/ilogb().(0.); |
| 177 | logbrust-analyzer cargo float_extras 0.1.6 f64/logb().(0.); |
| 178 | scalbnrust-analyzer cargo float_extras 0.1.6 f64/scalbn().(0., 0); |
| 179 | |
| 180 | erfrust-analyzer cargo float_extras 0.1.6 f64/erf().(0.); |
| 181 | erfcrust-analyzer cargo float_extras 0.1.6 f64/erfc().(0.); |
| 182 | tgammarust-analyzer cargo float_extras 0.1.6 f64/tgamma().(0.); |
| 183 | lgammarust-analyzer cargo float_extras 0.1.6 f64/lgamma().(0.); |
| 184 | lroundrust-analyzer cargo float_extras 0.1.6 f64/lround().(0.); |
| 185 | remainderrust-analyzer cargo float_extras 0.1.6 f64/remainder().(0., 0.); |
| 186 | remquorust-analyzer cargo float_extras 0.1.6 f64/remquo().(0., 0.); |
| 187 | |
| 188 | copysignrust-analyzer cargo float_extras 0.1.6 f64/copysign().(0., 0.); |
| 189 | nextafterrust-analyzer cargo float_extras 0.1.6 f64/nextafter().(0., 0.); |
| 190 | |
| 191 | fdimrust-analyzer cargo float_extras 0.1.6 f64/fdim().(0., 0.); |
| 192 | fmarust-analyzer cargo float_extras 0.1.6 f64/fma().(0., 0., 0.); |
| 193 | } |
| 194 | } |