mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Merge pull request #1006 from jockus/master
Fix for value rather than type used for intrinsics
This commit is contained in:
+6
-6
@@ -1335,27 +1335,27 @@ atan2 :: proc{
|
|||||||
atan2_f64, atan2_f64le, atan2_f64be,
|
atan2_f64, atan2_f64le, atan2_f64be,
|
||||||
};
|
};
|
||||||
|
|
||||||
atan :: proc(x: $T) -> T where intrinsics.type_is_float(x) {
|
atan :: proc(x: $T) -> T where intrinsics.type_is_float(T) {
|
||||||
return atan2(x, 1);
|
return atan2(x, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
asin :: proc(x: $T) -> T where intrinsics.type_is_float(x) {
|
asin :: proc(x: $T) -> T where intrinsics.type_is_float(T) {
|
||||||
return atan2(x, 1 + sqrt(1 - x*x));
|
return atan2(x, 1 + sqrt(1 - x*x));
|
||||||
}
|
}
|
||||||
|
|
||||||
acos :: proc(x: $T) -> T where intrinsics.type_is_float(x) {
|
acos :: proc(x: $T) -> T where intrinsics.type_is_float(T) {
|
||||||
return 2 * atan2(sqrt(1 - x), sqrt(1 + x));
|
return 2 * atan2(sqrt(1 - x), sqrt(1 + x));
|
||||||
}
|
}
|
||||||
|
|
||||||
sinh :: proc(x: $T) -> T where intrinsics.type_is_float(x) {
|
sinh :: proc(x: $T) -> T where intrinsics.type_is_float(T) {
|
||||||
return (exp(x) - exp(-x))*0.5;
|
return (exp(x) - exp(-x))*0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
cosh :: proc(x: $T) -> T where intrinsics.type_is_float(x) {
|
cosh :: proc(x: $T) -> T where intrinsics.type_is_float(T) {
|
||||||
return (exp(x) + exp(-x))*0.5;
|
return (exp(x) + exp(-x))*0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
tanh :: proc(x: $T) -> T where intrinsics.type_is_float(x) {
|
tanh :: proc(x: $T) -> T where intrinsics.type_is_float(T) {
|
||||||
t := exp(2*x);
|
t := exp(2*x);
|
||||||
return (t - 1) / (t + 1);
|
return (t - 1) / (t + 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user