Alternative 1 | |
---|---|
Error | 1.6 |
Cost | 64 |
\[y
\]
(FPCore (x a y) :precision binary64 (* (pow x a) (pow y (- 1.0 a))))
(FPCore (x a y) :precision binary64 (* (pow x a) (/ y (pow y a))))
double code(double x, double a, double y) { return pow(x, a) * pow(y, (1.0 - a)); }
double code(double x, double a, double y) { return pow(x, a) * (y / pow(y, a)); }
real(8) function code(x, a, y) real(8), intent (in) :: x real(8), intent (in) :: a real(8), intent (in) :: y code = (x ** a) * (y ** (1.0d0 - a)) end function
real(8) function code(x, a, y) real(8), intent (in) :: x real(8), intent (in) :: a real(8), intent (in) :: y code = (x ** a) * (y / (y ** a)) end function
public static double code(double x, double a, double y) { return Math.pow(x, a) * Math.pow(y, (1.0 - a)); }
public static double code(double x, double a, double y) { return Math.pow(x, a) * (y / Math.pow(y, a)); }
def code(x, a, y): return math.pow(x, a) * math.pow(y, (1.0 - a))
def code(x, a, y): return math.pow(x, a) * (y / math.pow(y, a))
function code(x, a, y) return Float64((x ^ a) * (y ^ Float64(1.0 - a))) end
function code(x, a, y) return Float64((x ^ a) * Float64(y / (y ^ a))) end
function tmp = code(x, a, y) tmp = (x ^ a) * (y ^ (1.0 - a)); end
function tmp = code(x, a, y) tmp = (x ^ a) * (y / (y ^ a)); end
code[x_, a_, y_] := N[(N[Power[x, a], $MachinePrecision] * N[Power[y, N[(1.0 - a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_, a_, y_] := N[(N[Power[x, a], $MachinePrecision] * N[(y / N[Power[y, a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
{x}^{a} \cdot {y}^{\left(1 - a\right)}
{x}^{a} \cdot \frac{y}{{y}^{a}}
Results
Initial program 0.3
Applied egg-rr58.4
Simplified0.0
[Start]58.4 | \[ {x}^{a} \cdot \left(e^{\mathsf{log1p}\left(\frac{y}{{y}^{a}}\right)} - 1\right)
\] |
---|---|
expm1-def [=>]0.0 | \[ {x}^{a} \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{y}{{y}^{a}}\right)\right)}
\] |
expm1-log1p [=>]0.0 | \[ {x}^{a} \cdot \color{blue}{\frac{y}{{y}^{a}}}
\] |
Final simplification0.0
Alternative 1 | |
---|---|
Error | 1.6 |
Cost | 64 |
herbie shell --seed 1
(FPCore (x a y)
:name "x ^(a) * y ^ (1-a)"
:precision binary64
:pre (and (and (and (<= 0.0 x) (<= x 10.0)) (and (<= 0.0 a) (<= a 1.0))) (and (<= 0.0 y) (<= y 10.0)))
(* (pow x a) (pow y (- 1.0 a))))