Adding the C math functions.

This commit is contained in:
Myrddin Dundragon 2017-06-22 16:21:30 -04:00
parent 55b9e64fa8
commit 6c802ef0c0
4 changed files with 32 additions and 6 deletions

29
src/c/math.rs Normal file
View File

@ -0,0 +1,29 @@
use binding::{CDouble, CInt};
#[link(name="c")]
extern
{
pub fn acos(x: CDouble) -> CDouble;
pub fn asin(x: CDouble) -> CDouble;
pub fn atan(x: CDouble) -> CDouble;
pub fn atan2(y: CDouble, x: CDouble) -> CDouble;
pub fn cos(x: CDouble) -> CDouble;
pub fn cosh(x: CDouble) -> CDouble;
pub fn sin(x: CDouble) -> CDouble;
pub fn sinh(x: CDouble) -> CDouble;
pub fn tanh(x: CDouble) -> CDouble;
pub fn exp(x: CDouble) -> CDouble;
pub fn frexp(x: CDouble, exponent: *mut CInt) -> CDouble;
pub fn ldexp(x: CDouble, exponent: CInt) -> CDouble;
pub fn log(x: CDouble)-> CDouble;
pub fn log10(x: CDouble)-> CDouble;
pub fn modf(x: CDouble, integer: *mut CInt)-> CDouble;
pub fn pow(x: CDouble, y: CDouble) -> CDouble;
pub fn sqrt(x: CDouble) -> CDouble;
pub fn ceil(x: CDouble) -> CDouble;
pub fn fabs(x: CDouble) -> CDouble;
pub fn floor(x: CDouble) -> CDouble;
pub fn fmod(x: CDouble, y: CDouble) -> CDouble;
}

View File

@ -4,6 +4,7 @@
mod errno;
mod math;
mod stddef;
mod stdlib;
mod string;
@ -12,6 +13,7 @@ mod time;
pub use self::errno::*;
pub use self::math::*;
pub use self::stddef::*;
pub use self::stdlib::*;
pub use self::string::*;

View File

@ -1,7 +1,7 @@
use binding::CVoid;
#[link(name="c")]
extern
{
pub fn calloc(nobj: usize, size: usize) -> *mut CVoid;

View File

@ -1,8 +1,3 @@
#[link(name="c")]
extern
{
}
#[cfg(not(feature="no_mem_manip"))]
#[link(name="c")]
extern