Skip to content

Commit

Permalink
Try using Float32 as printf conversion type.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Oct 6, 2023
1 parent 3c6ed43 commit 569dcc5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/bfloat16.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import Base: isfinite, isnan, precision, iszero, eps,
asinh, acosh, atanh, acsch, asech, acoth,
bitstring, isinteger

import Printf

# LLVM 11 added support for BFloat16 in the IR; Julia 1.11 added support for generating
# code that uses the `bfloat` IR type, together with the necessary runtime functions.
# However, not all LLVM targets support `bfloat`. If the target can store/load BFloat16s
Expand Down Expand Up @@ -332,6 +334,7 @@ function Base.show(io::IO, x::BFloat16)
hastypeinfo || print(io, ")")
end
end
Printf.tofloat(x::BFloat16) = Float32(x)

# Random
import Random: rand, randn, randexp, AbstractRNG, Sampler
Expand Down

0 comments on commit 569dcc5

Please sign in to comment.