Skip to content

Trailing 0s are lost when typecasting is done to float #42246

@gosavi-as

Description

@gosavi-as

Go Version: go version go1.14.2 darwin/amd64

Does this issue reproduce with the latest release? Yes

For float64 values like 0.0 or 1.0 etc. values loose trailing 0s when declared as interface and typecasting is done.

Eg.

var x interface{}
x = 1.00

fmt.Println(float64(x.(float64)))

Expected output here is 1.00 however, output is 1. Missing trailing 0s for such numbers.

When such data is Json marshalled same thing happens. When this marshalled data is consumed, unmarshalled and loaded in Parquet which is a schema on write format there is an inconsistency because of this issue.

Expectation is when float64 typecasting / json marshalling is done it should return float value without stripping decimal precision even if it's 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions