Skip to content

Commit

Permalink
Fux bug in functions.md example hypot (#54267)
Browse files Browse the repository at this point in the history
In the section explaining the `return` key word, the example of the
function computing the hypotenuse length of a right triangle with sides
of length x and y should return `abs(x)` if y is zero, and not
`zero(x)`.
  • Loading branch information
b-reinke authored Apr 26, 2024
1 parent dc2b73b commit 69b73e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion doc/src/manual/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ julia> function hypot(x, y)
return x*sqrt(1 + r*r)
end
if y == 0
return zero(x)
return x
end
r = x/y
return y*sqrt(1 + r*r)
Expand Down

0 comments on commit 69b73e0

Please sign in to comment.