开发者

How do you represent fraction in F# without the loss of precision?

开发者 https://www.devze.com 2023-02-17 13:23 出处:网络
What is best way to represent fractions in F#? Haskell and Rack开发者_StackOverflowet have convinient way to represent ratios. Is there a data type in F# to represent ratios?You can use the F# Powerpa

What is best way to represent fractions in F#? Haskell and Rack开发者_StackOverflowet have convinient way to represent ratios. Is there a data type in F# to represent ratios?


You can use the F# Powerpack which has a BigRational (arbitrary precision rational numbers) type:

let r = (1N/2N) * (1N/3N) // 1/6


The BigRational type has F# support in Math.Net Numerics according to the updated F# PowerPack archive on GitHub README.

0

精彩评论

暂无评论...
验证码 换一张
取 消