瀏覽代碼

Fix atrig functions

gingerBill 2 年之前
父節點
當前提交
ff36b754cb
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      core/math/math.odin

+ 3 - 3
core/math/math.odin

@@ -1385,15 +1385,15 @@ atan2 :: proc{
 }
 
 atan :: proc "contextless" (x: $T) -> T where intrinsics.type_is_float(T) {
-	return atan2(x, 1)
+	return atan2(1, x)
 }
 
 asin :: proc "contextless" (x: $T) -> T where intrinsics.type_is_float(T) {
-	return atan2(x, sqrt(1 - x*x))
+	return atan2(sqrt(1 - x*x), x)
 }
 
 acos :: proc "contextless" (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 "contextless" (x: $T) -> T where intrinsics.type_is_float(T) {