What is best way to represent fractions in F#? Haskell and Racket have convinient way to represent ratios. Is there a data type in F# to represent ratios?
How do you represent fraction in F# without the loss of precision?
Asked Answered
You can use the F# Powerpack which has a BigRational
(arbitrary precision rational numbers) type:
let r = (1N/2N) * (1N/3N) // 1/6
Hi Gabe, is this something that's still viable, or do you know if its been replaced by new F# features? –
Stria
@JimDel: As far as I know, Powerpack is still the way to go. –
Purree
According to the F# PowerPack archive on GitHub README, BigRational is present in F# support in Math.Net Numerics –
Arrearage
The BigRational
type has F# support in Math.Net Numerics according to the updated F# PowerPack archive on GitHub README.
© 2022 - 2024 — McMap. All rights reserved.