Fable
Fable copied to clipboard
TimeSpan precision lost when creating big TimeSpan via another method than `FromTicks`
Hello,
printfn $"""
Big TimeSpan value (Fable): %A{System.TimeSpan.FromDays(10675199).Ticks}
Big TimeSpan value (.NET): 9223372036854775807L
"""
Big TimeSpan value (Fable): 9223371936000000000
Big TimeSpan value (.NET): 9223372036854775807L
This doesn't happens when creating TimeSpan.FromTicks because in this case we are using BigInteger.
Fixing this issues will also open the possibility improve the precision supported by TimeSpan in Fable to be on par with .NET and Python
Actually, even FromTicks is affected probably because we transform from bigint to Number
printfn $"""
Big TimeSpan value (WebSharper): %A{System.TimeSpan.FromTicks(9223372036854775807L).Ticks}
Big TimeSpan value (.NET): 9223372036854775807L
"""
Big TimeSpan value (WebSharper): 9223372036854769664
Big TimeSpan value (.NET): 9223372036854775807L