Skip to content

Commit 6b335a4

Browse files
authored
Merge pull request #1830 from mcabbott/real
Zero is a real number (`Flux.Nil`)
2 parents d0a5b77 + 22a0b83 commit 6b335a4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/outputsize.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ using NNlib
44
import Random
55

66
"""
7-
Nil <: Number
7+
nil = Nil()
88
9-
Nil is a singleton type with a single instance `nil`.
10-
Unlike `Nothing` and `Missing` it subtypes `Number`.
9+
`Nil` is a singleton type with a single instance `nil`.
10+
Unlike `Nothing` and `Missing` it is a number: `Nil <: Real <: Number`.
1111
"""
12-
struct Nil <: Number end
12+
struct Nil <: Real end
1313

14+
@doc @doc(Nil)
1415
const nil = Nil()
1516

1617
Nil(::T) where T<:Number = nil
@@ -30,9 +31,8 @@ for f in [:+, :-, :*, :/, :^, :mod, :div, :rem]
3031
@eval Base.$f(::Nil, ::Nil) = nil
3132
end
3233

33-
Base.isless(::Nil, ::Nil) = true
34-
Base.isless(::Nil, ::Number) = true
35-
Base.isless(::Number, ::Nil) = true
34+
Base.:<(::Nil, ::Nil) = true
35+
Base.:<=(::Nil, ::Nil) = true
3636

3737
Base.isnan(::Nil) = false
3838
Base.isfinite(::Nil) = true

0 commit comments

Comments
 (0)