SIne function in java and matlab return different values

I want to convert my matlab code to java
In Matlab I called sin(1621*2*pi*0.0001)

and it returns 0.7979


now in JAVA I called Math.sin(1621*2*Math.PI*0.0001)

and it returns0.8513

Why???

The problem was that I was using 0.0001 as java rounded, but Matlab didn't work around it

+3


source to share


1 answer


The answer is 0.8513.

When I print it in Matlab I get 0.8513 as the answer.



Maybe you should check your code if you are assigning a non-"pi" value that is not 3.1415 ...

+4


source







All Articles