Skip to content

Commit ac0bcff

Browse files
authored
Added wrapper for Base.rem (maps to remainderq) and also Base.Integer… (#65)
* Added wrapper for Base.rem (maps to remainderq) and also Base.Integer(x::Float128) = Int(x) and a single test case that uses both. Fixes #64 Signed-off-by: Don MacMillen <don@macmillen.net>
1 parent 4d3f6f0 commit ac0bcff

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Quadmath"
22
uuid = "be4d8f0f-7fa4-5f49-b795-2f01399ab2dd"
3-
version = "0.5.8"
3+
version = "0.5.9"
44

55
[deps]
66
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"

src/Quadmath.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,11 @@ end
355355
Float128(@ccall(libquadmath.hypotq(x::Cfloat128, y::Cfloat128)::Cfloat128))
356356
@assume_effects :foldable atan(x::Float128, y::Float128) =
357357
Float128(@ccall(libquadmath.atan2q(x::Cfloat128, y::Cfloat128)::Cfloat128))
358+
359+
Base.Integer(x::Float128) = Int(x)
360+
@assume_effects :foldable Base.rem(x::Float128, y::Float128) =
361+
Float128(@ccall(libquadmath.remainderq(x::Cfloat128, y::Cfloat128)::Cfloat128))
362+
358363
sincos(x::Float128) = (sin(x), cos(x))
359364

360365
## misc

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ end
144144
m = maxintfloat(Float128)
145145
@test m+one(Float128) == m
146146
@test m-one(Float128) != m
147+
@test rem(Float128(3//2), Float128(1//2)) == 0.0
147148
end
148149

149150
function hist(X, n)
@@ -224,6 +225,7 @@ end
224225
@test !(1//3 < fnan)
225226
@test !(1//3 == fnan)
226227
@test !(1//3 > fnan)
228+
@test [Float128(-10//1):Float128(1//10):Float128(0//1);] isa Any
227229
end
228230

229231
@testset "ambiguities" begin

0 commit comments

Comments
 (0)