Skip to content

Commit 98d87c7

Browse files
authored
Merge pull request #59 from JuliaString/spj/tests
Update requirements, make work on v1.4 of Julia, improve tests
2 parents 5d9f63a + ad56c70 commit 98d87c7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
3636
test = ["Test", "Random", "Printf"]
3737

3838
[compat]
39-
julia = "1.6"
39+
julia = "1.4"

src/printf.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,16 @@ function _get_strspec(spec)
430430
_strspec[spec] = string(spec; modifier="R")
431431
end
432432

433+
@static if VERSION < v"1.5"
434+
_snprintf(ptr, siz, spec, arg) =
435+
ccall((:mpfr_snprintf,:libmpfr), Int32,
436+
(Ptr{UInt8}, Culong, Ptr{UInt8}, Ref{BigFloat}...),
437+
ptr, siz, spec, arg)
438+
else
433439
_snprintf(ptr, siz, spec, arg) =
434440
@ccall "libmpfr".mpfr_snprintf(ptr::Ptr{UInt8}, siz::Csize_t, spec::Ptr{UInt8};
435441
arg::Ref{BigFloat})::Cint
442+
end
436443

437444
function _fmt(buf, pos, spec::FmtSpec{<:FmtFlts}, arg::BigFloat)
438445
isfinite(arg) || return _fmt(buf, pos, spec, Float64(arg))

0 commit comments

Comments
 (0)