Skip to content

Commit 24fa5cf

Browse files
committed
Added doc for fractional_even
1 parent 48b07bd commit 24fa5cf

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

docs/src/manual.md

+6
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ maxintfloat(::Type{Floatmu{szE,szf}}) where {szE,szf}
142142
143143
```
144144

145+
Lastly, some methods test properties on the different parts of a `Floatmu`:
146+
147+
```@docs
148+
fractional_even(x::Floatmu{szE,szf}) where {szE,szf}
149+
```
150+
145151
### Tests
146152

147153
```@docs

src/Floatmu.jl

+13
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,19 @@ Emax(::Type{Floatmu{szE,szf}}) where {szE, szf} = UInt32(2^(UInt32(szE)-1)-1)
208208
exponent_max(::Type{Floatmu{szE,szf}}) where {szE, szf} = Int64(Emax(Floatmu{szE,szf}))
209209
exponent_raw_max(::Type{Floatmu{szE,szf}}) where {szE, szf} = Int64(exponent_mask(Floatmu{szE,szf}) >> szf)
210210

211+
212+
"""
213+
fractional_even(x::Floatmu{szE,szf}) where {szE,szf}
214+
215+
Return `true` if the fractional part of `x` has a zero as the rightmost bit.
216+
217+
BEWARE: the function does not check whether `x` is an NaN or an infinite value.
218+
"""
219+
function fractional_even(x::Floatmu{szE,szf}) where {szE,szf}
220+
return (x.v & 1) == 0
221+
end
222+
223+
211224
"""
212225
Emin(::Type{Floatmu{szE,szf}}) where {szE, szf}
213226

src/MFPUtils.jl

+1-12
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module MFPUtils
2222

2323
import ..MicroFloatingPoints: Floatmu
2424

25-
export vertical_popcount, fractional_even
25+
export vertical_popcount
2626

2727
"""
2828
vertical_popcount(T::Vector{Floatmu{szE,szf}}) where {szE,szf}
@@ -59,15 +59,4 @@ function vertical_popcount(T::Vector{Floatmu{szE,szf}}) where {szE,szf}
5959
return count
6060
end
6161

62-
"""
63-
fractional_even(x::Floatmu{szE,szf}) where {szE,szf}
64-
65-
Return `true` if the fractional part of `x` has a zero as the rightmost bit.
66-
67-
BEWARE: the function does not check whether `x` is an NaN or an infinite value.
68-
"""
69-
function fractional_even(x::Floatmu{szE,szf}) where {szE,szf}
70-
return (x.v & 1) == 0
71-
end
72-
7362
end # Module

src/MicroFloatingPoints.jl

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export FloatmuIterator
2626
export isinexact, errorsign, reset_inexact, inexact
2727
export Emax, Emin, nb_fp_numbers, bias
2828
export eligible_step
29+
export fractional_even
2930

3031
include("Floatmu.jl")
3132

0 commit comments

Comments
 (0)