Skip to content

Commit

Permalink
Fix adstring method (#74)
Browse files Browse the repository at this point in the history
* Fix adstring method

* Add Test
  • Loading branch information
Aman-Pandey-afk committed Apr 4, 2022
1 parent 4c0b306 commit f745f52
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/adstring.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ function adstring(ra::T, dec::T; precision::Int=0,
Int(ra_min), ra_sec_string)
end
dec_sec_string = formatsec(dec_sec, precision, truncate)
dec_string = @sprintf("%+03.2d %02d %s", Int(dec_deg),
Int(dec_min), dec_sec_string)
dec_string = (dec >= 0 ? "+" : "-") * @sprintf("%02.2d %02d %s", Int(abs(dec_deg)), Int(dec_min), dec_sec_string)
return string(ra_string, dec_string)
end

Expand Down
1 change: 1 addition & 0 deletions test/utils-tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
@test @inferred(adstring((30.4, -1.23), truncate=true)) ==
@inferred(adstring([30.4, -1.23], truncate=true)) ==
" 02 01 35.9 -01 13 48"
@test @inferred(adstring(15, -.5)) == " 01 00 00.0 -00 30 00"
@test @inferred(adstring(19.19321, truncate=true)) == "+19 11 35.5"
@test @inferred(adstring(ten(36,24,15.015), -ten(8,24,36.0428), precision=3)) ==
" 02 25 37.0010 -08 24 36.043"
Expand Down

0 comments on commit f745f52

Please sign in to comment.