fsprojects / FSharp.Compatibility

Compatibility libraries for F#
44 stars 22 forks source link

FSharp.Compatibility.Ocaml.Big_int.big_int_of_string does not parse hex and octal notation correctly. #18

Closed A-Manning closed 6 years ago

A-Manning commented 6 years ago

FSharp.Compatibility.Ocaml.Big_int.big_int_of_string does not parse hex and octal notation correctly.

Ocaml's Z.of_string can parse hex and octal notation, whereas F#'s cannot.

wallymathieu commented 6 years ago

Do you have any test cases or perhaps an OCaml lib that you could be used to fix this bug?

A-Manning commented 6 years ago

The following should all be true: big_int_of_string "0xABC" = bigint 2748 big_int_of_string "-0xABC" = bigint (-2748) big_int_of_string "0xabc" = bigint 2748 big_int_of_string "0xaBc" = bigint 2748 big_int_of_string "0o123" = bigint 291 big_int_of_string "0b101" = bigint 5

nikswamy commented 6 years ago

Would be great to have a fix for this. Thanks!

A-Manning commented 6 years ago

@nikswamy https://github.com/fsprojects/FSharp.Compatibility/pull/19