Skip to content

Commit 56afd4d

Browse files
authored
Merge pull request #13 from jagot/master
Corrected printing of unity roots
2 parents b27a099 + bdf1c9c commit 56afd4d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/roots.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
function to_root(io::IO, root, val)
2-
root == 1 && return val
2+
if root == 1
3+
write(io, string(val))
4+
return
5+
end
36
if root == 3
47
print(io, '')
58
elseif root == 4

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ latexstring = "\\bf{boldface} \\it{italic} \\bb{blackboard} \\cal{calligraphic}
2525
@test to_root(3,"542") == "∛5̅4̅2̅"
2626
@test to_root(4,"542") == "∜5̅4̅2̅"
2727
@test to_root(17,"542") == "¹⁷√5̅4̅2̅"
28+
@test to_root(1, "1") == "1"
29+
@test to_root(1, "-1") == "-1"

0 commit comments

Comments
 (0)