Skip to content

Bug: Unexpected sign for large int64 decoding. #60

@travis-leith

Description

@travis-leith
open Thoth.Json.Net

type test_type = { i: int64 }

let extra = Extra.empty |> Extra.withInt64
let test_type_decoder = Decode.Auto.generateDecoder<test_type> (extra = extra)

let test_type_json1 = """{"i": 9223372036854775806}"""
let test_type_json2 = """{"i": 8223372036854775806}"""

let test_type1 = Decode.Auto.fromString<test_type> (test_type_json1, extra = extra)

let test_type2 = Decode.fromString test_type_decoder test_type_json2

printfn "test_type1: %A" test_type1
printfn "test_type2: %A" test_type2

For some reason the first value gets parsed as -ve. This seems to only happen for numbers close to the max value. Maybe some sort of overflow is happening.

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