[Haskell-beginners] How to use trigonometric functions with Data.Scientific?

David McBride toad3k at gmail.com
Tue Jun 2 18:57:17 UTC 2015


You should be able to use sin (toRealFloat a).  But I imagine that could
introduce some error into your calculations.  You will have to make sure
you put enough type signatures to infer Double.

On Tue, Jun 2, 2015 at 6:51 AM, Martin Vlk <martin at vlkk.cz> wrote:

> Hi, I am writing a program to do some astronomical calculation, and I am
> using the Data.Scientific library to represent my floating point
> numbers. Would anyone know how to use trigonometric functions with the
> Scientific type?
>
> I see:
> a :: Scientific
> a = scientific 500036 (-5)
>
> sin :: Floating a => a -> a
>
> -- this won't work
> wrongType = sin a
>
> Any ideas?
>
> Many Thanks
> Martin
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150602/78dc737a/attachment.html>


More information about the Beginners mailing list