|
1 | 1 | module FixedPointNumbers |
2 | 2 |
|
3 | 3 | import Base: ==, <, <=, -, +, *, /, ~, isapprox, |
4 | | - convert, promote_rule, show, isinteger, abs, decompose, |
5 | | - isnan, isinf, isfinite, |
| 4 | + convert, promote_rule, show, bitstring, abs, decompose, |
| 5 | + isnan, isinf, isfinite, isinteger, |
6 | 6 | zero, oneunit, one, typemin, typemax, floatmin, floatmax, eps, reinterpret, |
7 | 7 | float, trunc, round, floor, ceil, bswap, |
8 | 8 | div, fld, rem, mod, mod1, fld1, min, max, minmax, |
@@ -171,6 +171,8 @@ function minmax(x::X, y::X) where {X <: FixedPoint} |
171 | 171 | X(a,0), X(b,0) |
172 | 172 | end |
173 | 173 |
|
| 174 | +bitstring(x::FixedPoint) = bitstring(x.i) |
| 175 | + |
174 | 176 | bswap(x::X) where {X <: FixedPoint} = sizeof(X) == 1 ? x : X(bswap(x.i), 0) |
175 | 177 |
|
176 | 178 | for f in (:zero, :oneunit, :one, :eps, :rawone, :rawtype, :floattype) |
|
0 commit comments