33 typedef typename compositor_t::function function_t;
40 symbol_table.add_variable(
"x",
x);
42 compositor_t compositor(symbol_table);
50 " case x < 0 : null; " 56 " var sqrt_x := x / 2; " 58 " if (equal(sqrt_x^2, x)) " 61 " sqrt_x := (1 / 2) * (sqrt_x + (x / sqrt_x)); " 62 " until ((z -= 1) <= 0); " 73 parser.compile(expression_str,expression);
75 for (std::size_t i = 0; i < 100; ++i)
77 x =
static_cast<T
>(i);
79 T result = expression.value();
81 printf(
"sqrt(%03d) - Result: %15.13f\tReal: %15.13f\n",
82 static_cast<unsigned int>(i),
90 newton_sqrt<double>();