Adding the C math functions.
This commit is contained in:
parent
55b9e64fa8
commit
6c802ef0c0
29
src/c/math.rs
Normal file
29
src/c/math.rs
Normal 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;
|
||||||
|
}
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
|
|
||||||
mod errno;
|
mod errno;
|
||||||
|
mod math;
|
||||||
mod stddef;
|
mod stddef;
|
||||||
mod stdlib;
|
mod stdlib;
|
||||||
mod string;
|
mod string;
|
||||||
@ -12,6 +13,7 @@ mod time;
|
|||||||
|
|
||||||
|
|
||||||
pub use self::errno::*;
|
pub use self::errno::*;
|
||||||
|
pub use self::math::*;
|
||||||
pub use self::stddef::*;
|
pub use self::stddef::*;
|
||||||
pub use self::stdlib::*;
|
pub use self::stdlib::*;
|
||||||
pub use self::string::*;
|
pub use self::string::*;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use binding::CVoid;
|
use binding::CVoid;
|
||||||
|
|
||||||
|
|
||||||
|
#[link(name="c")]
|
||||||
extern
|
extern
|
||||||
{
|
{
|
||||||
pub fn calloc(nobj: usize, size: usize) -> *mut CVoid;
|
pub fn calloc(nobj: usize, size: usize) -> *mut CVoid;
|
||||||
|
@ -1,8 +1,3 @@
|
|||||||
#[link(name="c")]
|
|
||||||
extern
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(feature="no_mem_manip"))]
|
#[cfg(not(feature="no_mem_manip"))]
|
||||||
#[link(name="c")]
|
#[link(name="c")]
|
||||||
extern
|
extern
|
||||||
|
Loading…
x
Reference in New Issue
Block a user