# sin(2*pi) vs sind(360)

15 views (last 30 days)

Show older comments

##### 0 Comments

### Answers (3)

Mike Croucher
on 21 Oct 2022

##### 0 Comments

Stephen23
on 13 Jul 2015

Edited: Stephen23
on 13 Jul 2015

Yes, it is because π is a value that cannot be represented precisely using a finite binary floating point number. This is also shown in the sind documentation:

"Sine of 180 degrees compared to sine of π radians"

sind(180)

ans =

0

sin(pi)

ans =

1.2246e-16

##### 2 Comments

Stephen23
on 13 Jul 2015

Edited: Stephen23
on 13 Jul 2015

No.

Unless of course you buy a computer with infinite memory to hold an infinite representation of π and yet can somehow perform operations at the same speed as your current computer.

π is an irrational number. How do you imagine representing an irrational number with a finite floating point value and not getting rounding error? All numeric computations with floating point numbers include rounding errors, and it is your job to figure out how to take this into account. To understand floating point numbers you should read these:

Walter Roberson
on 13 Jul 2015

##### 2 Comments

Torsten
on 13 Jul 2015

For a numerical computation, sin(pi)=1.2246e-16 should be exact enough.

Best wishes

Torsten.

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!