From: Phrogz Date: 2009-12-23T14:45:05+09:00 Subject: Re: Trig value errors On Dec 22, 10:07 pm, Phrogz wrote: > irb(main):004:0> x = cos(onedegree/1e06) > => 1.0 > irb(main):005:0> x - 1.0 > => -1.11022302462516e-16 > irb(main):006:0> puts "%.30f" % x > 0.999999999999999888977697537484 As an interesting and related aside, I wanted to find out what the correct value for this calculation was (to a certain number of decimals). I thought asking Alpha would be an easy place to start. This query (which has the parameter off by a factor of 1000) works: http://www.wolframalpha.com/input/?i=cos%28+2*pi+%2F+360+%2F+1e3+%29 and results in: 0.9999999998476912901 Trying for smaller parameter values, however, results in Alpha giving up: http://www.wolframalpha.com/input/?i=cos%28+2*pi+%2F+360+%2F+1e4+%29 (For me, that query always results in a message: "This Wolfram|Alpha server is temporarily unavailable.")