Skip to content

Creating tensor from float decimal issue #448

Open
@torepettersen

Description

@torepettersen

Creating a tensor from a float is causing a problem with the decimals:

Nx.tensor(0.43)
#Nx.Tensor<
  f32
  0.4300000071525574
>

The same goes if type is set to f16:

Nx.tensor(0.47, type: {:f, 16})
#Nx.Tensor<
  f16
  0.469970703125
>

But for f64 it seems to work:

Nx.tensor(0.47, type: {:f, 64})
#Nx.Tensor<
  f64
  0.47
>

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:nxApplies to nxkind:choreInternal improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions