atan2 vs arithmetic

Edit on GitHub

Math.atan2 vs common arithmetic operations

Setup

Tests

  • atan2

    var sum = 0.0
    for(var i=0; i<100; i++) {
      sum += Math.atan2(i, sum);
    }
  • arithmetic

    var sum = 0.0
    for(var i=0; i<100; i++) {
      sum += (sum*sum+1.0)/(sum+i+1.0);
    }