From: Walton Hoops Date: 2009-12-28T15:26:45+09:00 Subject: Re: Trig value errors On 12/27/2009 11:04 PM, jzakiya wrote: > My methods > >> sin1(67*degrees) => 0.92050485345244 >> cos1(67*degrees) => 0.39073112848927 >> > Ruby methods > > >> sin(67*degrees) => 0.92050485345244 >> cos(67*degrees) => 0.39073112848927 >> > Same answers. > > Really? huh.... irb(main):017:0> def sin1(x) irb(main):018:1> y=(1-cos(x)**2)**0.5 # calculate (2) irb(main):019:1> return 0.0 if y==0 irb(main):020:1> return sin(x) < 0 ? -y : y # for correct quadrant sign irb(main):021:1> end => nil irb(main):022:0> def cos1(x) irb(main):023:1> y=(1-sin(x)**2)**0.5 # calculate (2) irb(main):024:1> return 0.0 if y==0 irb(main):025:1> return cos(x) < 0 ? -y : y # for correct quadrant sign irb(main):026:1> end => nil irb(main):027:0> degrees=PI/180 => 0.0174532925199433 irb(main):028:0> s0=sin1(67*degrees) => 0.92050485345244 irb(main):029:0> c0=cos1(67*degrees) => 0.390731128489274 irb(main):030:0> s1=sin(67*degrees) => 0.92050485345244 irb(main):031:0> c1=cos(67*degrees) => 0.390731128489274 irb(main):032:0> s0==s1 => false irb(main):033:0> c0==c1 => false irb(main):034:0> s0-s1 => -1.11022302462516e-16 irb(main):035:0> c0-c1 => -5.55111512312578e-17 irb(main):036:0> whoops.. guess they aren't equal after all. Similarly, from one of your earlier examples: irb(main):036:0> s=sin((360-1e-6)*degrees) => -1.74532923897938e-08 irb(main):037:0> c=cos((360-1e-6)*degrees) => 1.0 irb(main):038:0> c==1 => false irb(main):039:0> 1-c => 1.11022302462516e-16 That 1 isn't really a 1. This has been pointed out before, you just chose to ignore it. > It's clear you jokers just like to argue and spew nonsense. You make > stupid statements and provide no > data to establish your claims. But I guess well thought > out and consistent reproducible claims are just too > much for you guys to produce. > > Are you guys Republicans and/or Global Climate Change deniers too? > >