Skip to content

sum for array of Float16 is wrong in dims=2 #58485

Closed as duplicate
Closed as duplicate
@prbzrg

Description

@prbzrg

maybe I don't know something but:

julia> a = ones(Float16, 3000, 3000);

julia> sum(a; dims=1)[1]
Float16(3.0e3)

julia> sum(a; dims=2)[1]
Float16(2.048e3)

julia> (a*a)[1]
Float16(2.048e3)

julia> versioninfo()
Julia Version 1.11.5
Commit 760b2e5b73 (2025-04-14 06:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 12 × Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, skylake)
Threads: 12 default, 2 interactive, 7 GC (on 12 virtual cores)

is this a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    foldsum, maximum, reduce, foldl, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions