[erlang-questions] sine and cosine with degree angles
Roberto Ostinelli
roberto@REDACTED
Thu Aug 26 13:57:25 CEST 2010
2010/8/26 Dmitry Belyaev <rumata-estor@REDACTED>:
> Suddenly
> 1> math:sin(math:pi()).
> 1.2246063538223773e-16
>
> It's floating point, it's always not completely accurate.
>
> Check for epsilon range:
> -define(EPS, 1.0e-10).
> if -?EPS < Value andalso Value < ?EPS -> 0; _ -> Value end.
>
> Dmitry Belyaev
i know it's about approximations. this is why i was asking if i'm
missing an erlang function which takes degrees instead of radiants as
input.
thank you for your suggestion, i will use the EPS.
cheers :)
r.
More information about the erlang-questions
mailing list