diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2021-05-31 14:23:40 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-31 14:23:40 +0200 |
| commit | bc4591fc1e8a4ab1b6736b5a86c4ce55117d335a (patch) | |
| tree | 4d05919712f13de40124c138f4485f2489144e19 | |
| parent | 46204ed7f0bdfe3ce74f50834f8c4a76400d5bd0 (diff) | |
| parent | 6465fb8ec7d5181404d565d7bdeb8c25d9611fb3 (diff) | |
Merge pull request #1006 from jockus/master
Fix for value rather than type used for intrinsics
| -rw-r--r-- | core/math/math.odin | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/math/math.odin b/core/math/math.odin index 1239d3e61..511d88a26 100644 --- a/core/math/math.odin +++ b/core/math/math.odin @@ -1335,27 +1335,27 @@ atan2 :: proc{ 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); } -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)); } -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)); } -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; } -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; } -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); return (t - 1) / (t + 1); } |