Skip to content

Base.issubnormal(::BFloat16) is missing #86

Open
@dzhang314

Description

The floating-point introspection function issubnormal(x) is not implemented for x::BFloat16. Since BFloat16 has the same exponent range as Float32, I suggest the following implementation:

@inline Base.issubnormal(x::BFloat16) = issubnormal(Float32(x))

This compiles to nice, clean assembly, at least on arm:

	.build_version macos, 15, 0
	.globl	_julia_issubnormal_42           ; -- Begin function julia_issubnormal_42
	.p2align	2
_julia_issubnormal_42:                  ; @julia_issubnormal_42
; %bb.0:                                ; %top
	tst	w0, #0x7f80
	cset	w8, eq
	tst	w0, #0x7f
	cset	w9, ne
	and	w0, w8, w9
	ret
                                        ; -- End function
.subsections_via_symbols

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions