Skip to content

disagreement in converting float32 result to float64 on 32-bit platform #41

@JeffBezanson

Description

@JeffBezanson

This was seen on a 32-bit Xeon system:

julia> ndigf(n)=float64(log(float32(n)))

julia> ndigf(256)
5.5451774444736657

julia> float64(log(float32(256)))
5.5451774597167969

julia> log(256)
5.5451774444795623

The last answer is correct, the middle one is the float64 conversion of the correctly-rounded float32 answer, and the first one is something strange.

julia> num2hex(5.5451774444795623)
"40162e42fefa39ef"

julia> num2hex(5.5451774444736657)
"40162e42fefa2000"

Looks like the float64 answer with the last 13 bits zero'd.

Happens with some functions, e.g. log and sin, but not with sqrt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorsystem:32-bitAffects only 32-bit systems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions