Skip to content

Support number as the return type for library functions #3913

Open
@hoangvuanduin

Description

@hoangvuanduin

Is your feature request related to a problem? Please describe.
I would like to use number instead of float in my application, but most library functions do not support number. For example, when parsing a string into a number, there is only ParseFloat and ParseInt available.

Describe the solution you'd like
Support number as a return type for library functions that return float

Describe alternatives you've considered
I tried to workaround by using functions that returns a Decimal, e.g. a: math.Pow(strconv.ParseFloat("1", 64), 1). This can solve the round trip problem when in doesn't fail for an exported JSON. However, if the JSON is 1.0 for the above case, it still fails. Also this is way too clunky.

Additional context
Related issue: #253 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestNew feature or requestTriageRequires triage/attention

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions