Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ ¹ ² ³ °
 

You are not logged in. #1 20060126 08:09:24
Generating sinesYesterday I wrote asking the following #2 20060126 17:55:04
Re: Generating sinesOK, that makes sense. You are incrementing a real number (one with fractional component), and the computer can't do that with total accuracy. However adding integers will be accurate. so: Code:for (var i=0;i<desiredLoops;i++) { r=(i/desiredLoops)*Math.PI; trace("Sin = "+Math.sin(r)); } I haven't included data types. "i" and "desiredLoops" should be integers, "r" a real, and you will need to be careful with "i/desiredLoops" to make sure it creates a fractional result (ie convert both to a real value before dividing). "The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  Leon M. Lederman 