Skip to content

Commit cb772eb

Browse files
committed
Tweak iszerovalue docstring
1 parent 58a3733 commit cb772eb

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/base.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,22 @@ Base.isone(q::AbstractQuaternion{T}) where {T<:Number} = isone(q[1]) && iszero(q
3535
"""
3636
iszerovalue(x)
3737
38-
!!! warn "Private function!"
38+
!!! warning "Private function!"
3939
40-
This function is considered private and may change or be removed without warning.
40+
This function is private and may change or be removed without warning.
4141
4242
This is essentially `Base.iszero`, but intended to be overridden for types like
4343
`ForwardDiff.Dual`, where the value may be zero, but if the tangent is not zero, then
44-
`Base.iszero` will return `false`.
44+
`Base.iszero` will return `false`. This function, on the other hand, ignores the tangent
45+
part, and will return `true` if and only if the value part is zero.
4546
4647
This is needed internally in math functions like `exp`, `log`, and `sqrt`, where we
4748
frequently need to switch the algorithm based on whether some components are zero. In those
4849
isolated cases, a Taylor series should be provided that will be exactly zero for, e.g.,
4950
`Float64`, but will also work correctly for `ForwardDiff.Dual` and other ADs.
5051
52+
Like `Base.iszero`, this function is defined recursively for arrays and quaternions.
53+
5154
"""
5255
iszerovalue(x) = iszero(x)
5356
iszerovalue(x::AbstractArray) = all(iszerovalue, x)

0 commit comments

Comments
 (0)