|
12 | 12 | ceil, floor, trunc, round, fma,
|
13 | 13 | atan2, copysign, max, min, hypot,
|
14 | 14 | gamma, lgamma,
|
15 |
| - abs, imag, real, conj |
| 15 | + abs, imag, real, conj, angle, cis, |
| 16 | + eps, realmin, realmax |
16 | 17 |
|
17 | 18 |
|
18 | 19 | import Base.GMP: ClongMax, CulongMax, CdoubleMax
|
@@ -65,9 +66,6 @@ function tryparse(::Type{Float128}, s::AbstractString, base::Int=0)
|
65 | 66 | Nullable(ccall((:set_str_q, :libfloat128), Float128, (Cstring, ), s))
|
66 | 67 | end
|
67 | 68 |
|
68 |
| - |
69 |
| - |
70 |
| - |
71 | 69 | # Basic arithmetic without promotion
|
72 | 70 | for (fJ, fC) in ((:+,:add), (:-,:sub), (:/,:div), (:(*),:mul))
|
73 | 71 | @eval begin
|
@@ -206,6 +204,14 @@ function ^(x::Float128, y::Float128)
|
206 | 204 | ccall((:pow_q, :libfloat128), Float128, (Float128, Float128,), x, y)
|
207 | 205 | end
|
208 | 206 |
|
| 207 | +# constants |
| 208 | +eps(::Type{Float128}) = ccall(("eps_q", :libfloat128), Float128, (), ) |
| 209 | +realmin(::Type{Float128}) = ccall(("realmin_q", :libfloat128), Float128, (), ) |
| 210 | +realmax(::Type{Float128}) = ccall(("realmax_q", :libfloat128), Float128, (), ) |
| 211 | +convert(::Type{Float128}, ::Irrational{:π}) = ccall(("pi_q", :libfloat128), Float128, (), ) |
| 212 | +convert(::Type{Float128}, ::Irrational{:e}) = ccall(("e_q", :libfloat128), Float128, (), ) |
| 213 | + |
| 214 | + |
209 | 215 |
|
210 | 216 | # unary functions
|
211 | 217 | for f in (:acos, :acosh, :asin, :asinh, :atan, :atanh, :cosh, :cos,
|
@@ -242,13 +248,16 @@ for f in (:acos, :acosh, :asin, :asinh, :atan, :atanh, :cosh, :cos,
|
242 | 248 | end
|
243 | 249 |
|
244 | 250 | # unary complex functions with real result
|
245 |
| -for f in (:abs, :imag, :real, ) |
| 251 | +for f in (:abs, :imag, :real, :angle ) |
246 | 252 | @eval function $f(x::Float128)
|
247 | 253 | ccall(($(string(:c,f,:_q)), :libfloat128), Float128, (Complex256, ), x)
|
248 | 254 | end
|
249 | 255 | end
|
250 | 256 |
|
251 |
| -# arg, expi, proj |
| 257 | +function cis(x::Float128) |
| 258 | + ccall((:ccis_q, :libfloat128), Complex256, (Float128,), x) |
| 259 | +end |
| 260 | + |
252 | 261 |
|
253 | 262 |
|
254 | 263 | function string(x::Float128)
|
|
0 commit comments