HK.avdalyan
HK.avdalyan

Reputation: 734

SIne function in java and in matlab returns 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 returns 0.8513

Why???

The problem was I use 0.0001 as java rounded but matlab does not round it

Upvotes: 3

Views: 61

Answers (1)

MaxD
MaxD

Reputation: 377

The answer is 0.8513.

When I type it in Matlab I get 0.8513 as answer.

Maybe you should check in your code if you assign not a value to "pi" that is not equal to 3.1415...

Upvotes: 4

Related Questions