You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: exercises/practice/darts/.docs/hints.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,6 @@
2
2
3
3
## General
4
4
5
-
- The distance of a point `(x, y)` from the center of the target `(0, 0)` can be calculated with `sqrt(x*x + y *y)`
6
-
7
-
-You can calculate the square root of `x` by raising it to the power of `1/2`. In other words, `sqrt(x) == pow(x, 0.5)`
5
+
- The distance of a point `(x, y)` from the center of the target `(0, 0)` can be calculated with `sqrt(x * x + y *y)`.
6
+
- Elixir doesn't have a built-in square root function, but the Erlang function `:math.sqrt/1` is available.
7
+
-Alternatively, you can calculate the square root of `x` by raising it to the power of `1/2`. In other words, `def sqrt(x), do: Float.pow(x, 0.5)`. Note that `Float.pow/2` only accepts float arguments, integers need to be converted explicitly, for example with `1.0 * x`.
0 commit comments