Skip to content

Commit d0f2551

Browse files
authored
Update darts hints to mention Elixir gotchas (#1434)
* Update hints.md * Update exercises/practice/darts/.docs/hints.md
1 parent 32bd39b commit d0f2551

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

exercises/practice/darts/.docs/hints.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
## General
44

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

Comments
 (0)