Skip to content

json_ParseNumber significant digit check possibly too strict #234

@zgrose

Description

@zgrose
' Excel only stores 15 significant digits, so any numbers larger than that are truncated
' This can lead to issues when BIGINT's are used (e.g. for Ids or Credit Cards), as they will be invalid above 15 digits
' See: http://support.microsoft.com/kb/269370
'
' Fix: Parse -> String, Convert -> String longer than 15 characters containing only numbers and decimal points -> Number
If Not JsonOptions.UseDoubleForLargeNumbers And Len(json_Value) >= 16 Then

The value 1234567890.12345 has 15 significant digits (and will display in Excel 2016 without truncation) but has length = 16 because the decimal adds to the length without altering the significance. Perhaps test for "." in the json_Value string and allow for 17 characters with a decimal and 16 without?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions