Support HexNumber and Any styles in BigInteger.Parse and BigInteger.TryParse
Description
BigInteger.TryParse and BigInteger.Parse accept different strings.
Repro code
open System
open System.Numerics
open System.Globalization
let s = "1234567890123456"
let mutable n = 0I
if BigInteger.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, &n) then
printfn $"String is a valid bigint: %A{n}"
else
printfn $"String is not a valid bigint"
try
let n = BigInteger.Parse(s, NumberStyles.Any, CultureInfo.InvariantCulture)
printfn $"String is a valid bigint: %A{n}"
with _ ->
printfn $"String is not a valid bigint"
https://fable.io/repl/#?code=PYBwpgdgBAygngZwC5gLYChSVolqB0AcgK6pgBOAlgMYKbjTzJr4DiANsAEYCG7lALx5JKwCOnTswSKAigBeKACIAjACYAzABYArADYA7AA4AnAAZ12-UolSZqYkh5cpUaIrMBJCZQBmUACFKAHNPCBRginwAFXI4AAUecgQwAAoEABooElQuChgkOCkEfABBCDgsgGFidiRicjAw32B8MIA3JMoecJq6hrAsgDIIAEooJAALSHQoKBAqcN9oABIlAsXgqEo5HihO-gATKC4QynCALigAUlKAbwgAXxswdhTZ+cWkZag1jfOtjs3MAZHsDpRjqdguckDZ0Eg4lAPnY3ApAiEwhEoolkmlMtlSHlyAUimASuVKlA+vVGs1Wh0uj0kNSBqMPgsYT8-giAdtdvs+BCTmdLjd7k8bAB3ShTKAAfSgAFoAHzsr5c9Y8iCAuQQEFQMGCyEi2HoIA&html=DwCwLgtgNgfAUHUBTAhgE3gAm54ElgqbhgAOAtEgI4CuAlgG4C8A5AMID2AdmEj+QBUAnqSQtMAY268erXgA8wAenDQA3JJAoATgGcCTGmABm5ABwt4wFagwJgAIw5oh8REqcu311bDhA&css=Q
Expected and actual results
Expected:
String is a valid bigint: 1234567890123456
String is a valid bigint: 1234567890123456
Actual:
String is not a valid bigint
String is a valid bigint: 1234567890123456
@njlr Yes, currently NumberStyles and cultures are not supported for bigint.
A compiler warning needs to be added. I've renamed the issue to clarify it.
In the mean time, parsing without styles/cultures should work (if you need NumberStyles.Any).
The supported formats (for JS) is what the BigInt constructor supports (i.e. something similar to invariant culture).
BigInteger.TryParse(s, &n)
BigInteger.Parse(s)
That's not going to work for hex style, so I'll leave this open until it gets resolved.