We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The ** operator triggers an exception when the base is 0 or negative. Tested with Prec10 and Prec50 for epsilon values.
Prelude> :module + Data.Number.Fixed Prelude Data.Number.Fixed> (0 ** 2) :: Fixed Prec10 Loading package numbers-3000.2.0.1 ... linking ... done. *** Exception: Fraction.log Prelude Data.Number.Fixed> (0 ** (-2)) :: Fixed Prec10 *** Exception: Fraction.log Prelude Data.Number.Fixed> ((-2) ** 2) :: Fixed Prec10 *** Exception: Fraction.log Prelude Data.Number.Fixed>
Probably makes sense that negative values crash, but 0 shouldn't.
The text was updated successfully, but these errors were encountered:
This really is a deficiency of Haskell's Floating class. It gives a default implementation for (**) which is
Floating
(**)
x ** y = exp ((log x) * y)
and of course log 0 is undefined. For a similar reason, an error also occurs for sqrt (0 :: Fixed Prec10).
log 0
sqrt (0 :: Fixed Prec10)
Sorry, something went wrong.
In some cases the behavior is not the same as built-in types:
> (-1) ** (-5) :: Double -1.0 > (-1) ** (-5) :: BigFloat Prec50 *** Exception: Fraction.log
No branches or pull requests
The ** operator triggers an exception when the base is 0 or negative. Tested with Prec10 and Prec50 for epsilon values.
Probably makes sense that negative values crash, but 0 shouldn't.
The text was updated successfully, but these errors were encountered: