Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimeSpan precision lost when creating big TimeSpan via another method than FromTicks #4056

Open
MangelMaxime opened this issue Feb 19, 2025 · 1 comment
Labels

Comments

@MangelMaxime
Copy link
Member

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

@MangelMaxime
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant