mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
math.v: Added more functions
Added almost all the functions present in C math lib
This commit is contained in:
parent
2c3b10da76
commit
ac4a4cbcc9
39
math/math.v
39
math/math.v
@ -15,10 +15,34 @@ fn abs(a f64) f64 {
|
|||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn ceil(a f64) f64 {
|
||||||
|
return C.ceil(a)
|
||||||
|
}
|
||||||
|
|
||||||
fn cos(a f64) f64 {
|
fn cos(a f64) f64 {
|
||||||
return C.cos(a)
|
return C.cos(a)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn cosh(a f64) f64 {
|
||||||
|
return C.cosh(a)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn exp(a f64) f64 {
|
||||||
|
return C.exp(a)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn floor(a f64) f64 {
|
||||||
|
return C.floor(a)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn log(a f64) f64 {
|
||||||
|
return C.log(a)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn log10(a f64) f64 {
|
||||||
|
return C.log10(a)
|
||||||
|
}
|
||||||
|
|
||||||
fn max(a, b f64) f64 {
|
fn max(a, b f64) f64 {
|
||||||
if a > b {
|
if a > b {
|
||||||
return a
|
return a
|
||||||
@ -49,7 +73,22 @@ fn sin(a f64) f64 {
|
|||||||
return C.sin(a)
|
return C.sin(a)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn sinh(a f64) f64 {
|
||||||
|
return C.sinh(a)
|
||||||
|
}
|
||||||
|
|
||||||
fn sqrt(a f64) f64 {
|
fn sqrt(a f64) f64 {
|
||||||
return C.sqrt(a)
|
return C.sqrt(a)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn tan(a f64) f64 {
|
||||||
|
return C.tan(a)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn tanh(a f64) f64 {
|
||||||
|
return C.tanh(a)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn trunc(a f64) f64 {
|
||||||
|
return C.trunc(a)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user