d2jsp
Log InRegister
d2jsp Forums > Off-Topic > General Chat > Homework Help > Why Does Sin(pi) Not Return 0 In Matlab?
Add Reply New Topic New Poll
Member
Posts: 35,671
Joined: Aug 11 2008
Gold: 2,130.00
Oct 25 2014 08:33pm
it returns 1.2246e-016.

Yes I know its approximately equal to 0 but why doesnt it output 0 then?
Member
Posts: 14,433
Joined: Oct 14 2013
Gold: Locked
Trader: Scammer
Oct 25 2014 08:37pm
type format short

1.2246e-016 is the computer's way of being precise, it's basically zero

This post was edited by JDota72 on Oct 25 2014 08:38pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Oct 25 2014 08:38pm
because pi is approximated in matlab.

if you need an exact answer, use degrees.

>> cosd(90)

ans =

0

>> sind(-180)

ans =

0
Member
Posts: 35,671
Joined: Aug 11 2008
Gold: 2,130.00
Oct 25 2014 08:44pm
k thanks guys
Go Back To Homework Help Topic List
Add Reply New Topic New Poll