
(FPCore (x y) :precision binary64 (+ (- (* 9.0 (pow x 4.0)) (pow y 4.0)) (* 2.0 (* y y))))
double code(double x, double y) {
return ((9.0 * pow(x, 4.0)) - pow(y, 4.0)) + (2.0 * (y * y));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((9.0d0 * (x ** 4.0d0)) - (y ** 4.0d0)) + (2.0d0 * (y * y))
end function
public static double code(double x, double y) {
return ((9.0 * Math.pow(x, 4.0)) - Math.pow(y, 4.0)) + (2.0 * (y * y));
}
def code(x, y): return ((9.0 * math.pow(x, 4.0)) - math.pow(y, 4.0)) + (2.0 * (y * y))
function code(x, y) return Float64(Float64(Float64(9.0 * (x ^ 4.0)) - (y ^ 4.0)) + Float64(2.0 * Float64(y * y))) end
function tmp = code(x, y) tmp = ((9.0 * (x ^ 4.0)) - (y ^ 4.0)) + (2.0 * (y * y)); end
code[x_, y_] := N[(N[(N[(9.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] - N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(9 \cdot {x}^{4} - {y}^{4}\right) + 2 \cdot \left(y \cdot y\right)
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (+ (- (* 9.0 (pow x 4.0)) (pow y 4.0)) (* 2.0 (* y y))))
double code(double x, double y) {
return ((9.0 * pow(x, 4.0)) - pow(y, 4.0)) + (2.0 * (y * y));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((9.0d0 * (x ** 4.0d0)) - (y ** 4.0d0)) + (2.0d0 * (y * y))
end function
public static double code(double x, double y) {
return ((9.0 * Math.pow(x, 4.0)) - Math.pow(y, 4.0)) + (2.0 * (y * y));
}
def code(x, y): return ((9.0 * math.pow(x, 4.0)) - math.pow(y, 4.0)) + (2.0 * (y * y))
function code(x, y) return Float64(Float64(Float64(9.0 * (x ^ 4.0)) - (y ^ 4.0)) + Float64(2.0 * Float64(y * y))) end
function tmp = code(x, y) tmp = ((9.0 * (x ^ 4.0)) - (y ^ 4.0)) + (2.0 * (y * y)); end
code[x_, y_] := N[(N[(N[(9.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] - N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(9 \cdot {x}^{4} - {y}^{4}\right) + 2 \cdot \left(y \cdot y\right)
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* (* y y) y) y))
(t_1 (pow (- (* (* (* (* x x) 9.0) x) x) t_0) 3.0))
(t_2 (- (* (* (* 9.0 (* x x)) x) x) t_0))
(t_3 (* (* (* 4.0 t_0) (+ y y)) y))
(t_4 (* (+ y y) (* t_0 4.0))))
(/
(/
(- (* t_3 t_3) (* t_1 t_1))
(/ (- (pow (* t_4 y) 2.0) (pow t_2 6.0)) (fma t_4 y (pow t_2 3.0))))
(*
(pow x 8.0)
(+
81.0
(fma
-18.0
(/ (* y y) (pow x 4.0))
(fma
-18.0
(/ (pow y 4.0) (pow x 4.0))
(fma
2.0
(/ (* (* y y) (fma 2.0 (* y y) (pow y 4.0))) (pow x 8.0))
(/ (pow y 8.0) (pow x 8.0))))))))))
double code(double x, double y) {
double t_0 = ((y * y) * y) * y;
double t_1 = pow((((((x * x) * 9.0) * x) * x) - t_0), 3.0);
double t_2 = (((9.0 * (x * x)) * x) * x) - t_0;
double t_3 = ((4.0 * t_0) * (y + y)) * y;
double t_4 = (y + y) * (t_0 * 4.0);
return (((t_3 * t_3) - (t_1 * t_1)) / ((pow((t_4 * y), 2.0) - pow(t_2, 6.0)) / fma(t_4, y, pow(t_2, 3.0)))) / (pow(x, 8.0) * (81.0 + fma(-18.0, ((y * y) / pow(x, 4.0)), fma(-18.0, (pow(y, 4.0) / pow(x, 4.0)), fma(2.0, (((y * y) * fma(2.0, (y * y), pow(y, 4.0))) / pow(x, 8.0)), (pow(y, 8.0) / pow(x, 8.0)))))));
}
function code(x, y) t_0 = Float64(Float64(Float64(y * y) * y) * y) t_1 = Float64(Float64(Float64(Float64(Float64(x * x) * 9.0) * x) * x) - t_0) ^ 3.0 t_2 = Float64(Float64(Float64(Float64(9.0 * Float64(x * x)) * x) * x) - t_0) t_3 = Float64(Float64(Float64(4.0 * t_0) * Float64(y + y)) * y) t_4 = Float64(Float64(y + y) * Float64(t_0 * 4.0)) return Float64(Float64(Float64(Float64(t_3 * t_3) - Float64(t_1 * t_1)) / Float64(Float64((Float64(t_4 * y) ^ 2.0) - (t_2 ^ 6.0)) / fma(t_4, y, (t_2 ^ 3.0)))) / Float64((x ^ 8.0) * Float64(81.0 + fma(-18.0, Float64(Float64(y * y) / (x ^ 4.0)), fma(-18.0, Float64((y ^ 4.0) / (x ^ 4.0)), fma(2.0, Float64(Float64(Float64(y * y) * fma(2.0, Float64(y * y), (y ^ 4.0))) / (x ^ 8.0)), Float64((y ^ 8.0) / (x ^ 8.0)))))))) end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 9.0), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] - t$95$0), $MachinePrecision], 3.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(9.0 * N[(x * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(4.0 * t$95$0), $MachinePrecision] * N[(y + y), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$4 = N[(N[(y + y), $MachinePrecision] * N[(t$95$0 * 4.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Power[N[(t$95$4 * y), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[t$95$2, 6.0], $MachinePrecision]), $MachinePrecision] / N[(t$95$4 * y + N[Power[t$95$2, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, 8.0], $MachinePrecision] * N[(81.0 + N[(-18.0 * N[(N[(y * y), $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(-18.0 * N[(N[Power[y, 4.0], $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(N[(N[(y * y), $MachinePrecision] * N[(2.0 * N[(y * y), $MachinePrecision] + N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[x, 8.0], $MachinePrecision]), $MachinePrecision] + N[(N[Power[y, 8.0], $MachinePrecision] / N[Power[x, 8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(y \cdot y\right) \cdot y\right) \cdot y\\
t_1 := {\left(\left(\left(\left(x \cdot x\right) \cdot 9\right) \cdot x\right) \cdot x - t\_0\right)}^{3}\\
t_2 := \left(\left(9 \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x - t\_0\\
t_3 := \left(\left(4 \cdot t\_0\right) \cdot \left(y + y\right)\right) \cdot y\\
t_4 := \left(y + y\right) \cdot \left(t\_0 \cdot 4\right)\\
\frac{\frac{t\_3 \cdot t\_3 - t\_1 \cdot t\_1}{\frac{{\left(t\_4 \cdot y\right)}^{2} - {t\_2}^{6}}{\mathsf{fma}\left(t\_4, y, {t\_2}^{3}\right)}}}{{x}^{8} \cdot \left(81 + \mathsf{fma}\left(-18, \frac{y \cdot y}{{x}^{4}}, \mathsf{fma}\left(-18, \frac{{y}^{4}}{{x}^{4}}, \mathsf{fma}\left(2, \frac{\left(y \cdot y\right) \cdot \mathsf{fma}\left(2, y \cdot y, {y}^{4}\right)}{{x}^{8}}, \frac{{y}^{8}}{{x}^{8}}\right)\right)\right)\right)}
\end{array}
\end{array}
Initial program 18.8%
Applied rewrites18.8%
lift-fma.f64N/A
flip-+N/A
lower-/.f64N/A
Applied rewrites18.8%
Applied rewrites18.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
Applied rewrites24.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* (* y y) y) y))
(t_1 (pow (- (* (* (* 9.0 (* x x)) x) x) t_0) 3.0))
(t_2 (* (+ y y) (* t_0 4.0))))
(/
(/
(fma (* t_2 t_2) (* y y) (* (- t_1) t_1))
(-
(* (* (* 4.0 t_0) (+ y y)) y)
(pow (- (* (* (* (* x x) 9.0) x) x) t_0) 3.0)))
(*
(pow x 8.0)
(+
81.0
(fma
-18.0
(/ (* y y) (pow x 4.0))
(fma
-18.0
(/ (pow y 4.0) (pow x 4.0))
(fma
2.0
(/ (* (* y y) (fma 2.0 (* y y) (pow y 4.0))) (pow x 8.0))
(/ (pow y 8.0) (pow x 8.0))))))))))
double code(double x, double y) {
double t_0 = ((y * y) * y) * y;
double t_1 = pow(((((9.0 * (x * x)) * x) * x) - t_0), 3.0);
double t_2 = (y + y) * (t_0 * 4.0);
return (fma((t_2 * t_2), (y * y), (-t_1 * t_1)) / ((((4.0 * t_0) * (y + y)) * y) - pow((((((x * x) * 9.0) * x) * x) - t_0), 3.0))) / (pow(x, 8.0) * (81.0 + fma(-18.0, ((y * y) / pow(x, 4.0)), fma(-18.0, (pow(y, 4.0) / pow(x, 4.0)), fma(2.0, (((y * y) * fma(2.0, (y * y), pow(y, 4.0))) / pow(x, 8.0)), (pow(y, 8.0) / pow(x, 8.0)))))));
}
function code(x, y) t_0 = Float64(Float64(Float64(y * y) * y) * y) t_1 = Float64(Float64(Float64(Float64(9.0 * Float64(x * x)) * x) * x) - t_0) ^ 3.0 t_2 = Float64(Float64(y + y) * Float64(t_0 * 4.0)) return Float64(Float64(fma(Float64(t_2 * t_2), Float64(y * y), Float64(Float64(-t_1) * t_1)) / Float64(Float64(Float64(Float64(4.0 * t_0) * Float64(y + y)) * y) - (Float64(Float64(Float64(Float64(Float64(x * x) * 9.0) * x) * x) - t_0) ^ 3.0))) / Float64((x ^ 8.0) * Float64(81.0 + fma(-18.0, Float64(Float64(y * y) / (x ^ 4.0)), fma(-18.0, Float64((y ^ 4.0) / (x ^ 4.0)), fma(2.0, Float64(Float64(Float64(y * y) * fma(2.0, Float64(y * y), (y ^ 4.0))) / (x ^ 8.0)), Float64((y ^ 8.0) / (x ^ 8.0)))))))) end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(N[(N[(9.0 * N[(x * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] - t$95$0), $MachinePrecision], 3.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + y), $MachinePrecision] * N[(t$95$0 * 4.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(t$95$2 * t$95$2), $MachinePrecision] * N[(y * y), $MachinePrecision] + N[((-t$95$1) * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(4.0 * t$95$0), $MachinePrecision] * N[(y + y), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] - N[Power[N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 9.0), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] - t$95$0), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, 8.0], $MachinePrecision] * N[(81.0 + N[(-18.0 * N[(N[(y * y), $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(-18.0 * N[(N[Power[y, 4.0], $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(N[(N[(y * y), $MachinePrecision] * N[(2.0 * N[(y * y), $MachinePrecision] + N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[x, 8.0], $MachinePrecision]), $MachinePrecision] + N[(N[Power[y, 8.0], $MachinePrecision] / N[Power[x, 8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(y \cdot y\right) \cdot y\right) \cdot y\\
t_1 := {\left(\left(\left(9 \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x - t\_0\right)}^{3}\\
t_2 := \left(y + y\right) \cdot \left(t\_0 \cdot 4\right)\\
\frac{\frac{\mathsf{fma}\left(t\_2 \cdot t\_2, y \cdot y, \left(-t\_1\right) \cdot t\_1\right)}{\left(\left(4 \cdot t\_0\right) \cdot \left(y + y\right)\right) \cdot y - {\left(\left(\left(\left(x \cdot x\right) \cdot 9\right) \cdot x\right) \cdot x - t\_0\right)}^{3}}}{{x}^{8} \cdot \left(81 + \mathsf{fma}\left(-18, \frac{y \cdot y}{{x}^{4}}, \mathsf{fma}\left(-18, \frac{{y}^{4}}{{x}^{4}}, \mathsf{fma}\left(2, \frac{\left(y \cdot y\right) \cdot \mathsf{fma}\left(2, y \cdot y, {y}^{4}\right)}{{x}^{8}}, \frac{{y}^{8}}{{x}^{8}}\right)\right)\right)\right)}
\end{array}
\end{array}
Initial program 18.8%
Applied rewrites18.8%
lift-fma.f64N/A
flip-+N/A
lower-/.f64N/A
Applied rewrites18.8%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
Applied rewrites18.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
Applied rewrites24.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* (* y y) y) y)) (t_1 (* (* (* 4.0 t_0) (+ y y)) y)))
(/
(/
(- (* t_1 t_1) (pow (pow (- (* (* (* 9.0 (* x x)) x) x) t_0) 3.0) 2.0))
(- t_1 (pow (- (* (* (* (* x x) 9.0) x) x) t_0) 3.0)))
(*
(pow x 8.0)
(+
81.0
(fma
-18.0
(/ (* y y) (pow x 4.0))
(fma
-18.0
(/ (pow y 4.0) (pow x 4.0))
(fma
2.0
(/ (* (* y y) (fma 2.0 (* y y) (pow y 4.0))) (pow x 8.0))
(/ (pow y 8.0) (pow x 8.0))))))))))
double code(double x, double y) {
double t_0 = ((y * y) * y) * y;
double t_1 = ((4.0 * t_0) * (y + y)) * y;
return (((t_1 * t_1) - pow(pow(((((9.0 * (x * x)) * x) * x) - t_0), 3.0), 2.0)) / (t_1 - pow((((((x * x) * 9.0) * x) * x) - t_0), 3.0))) / (pow(x, 8.0) * (81.0 + fma(-18.0, ((y * y) / pow(x, 4.0)), fma(-18.0, (pow(y, 4.0) / pow(x, 4.0)), fma(2.0, (((y * y) * fma(2.0, (y * y), pow(y, 4.0))) / pow(x, 8.0)), (pow(y, 8.0) / pow(x, 8.0)))))));
}
function code(x, y) t_0 = Float64(Float64(Float64(y * y) * y) * y) t_1 = Float64(Float64(Float64(4.0 * t_0) * Float64(y + y)) * y) return Float64(Float64(Float64(Float64(t_1 * t_1) - ((Float64(Float64(Float64(Float64(9.0 * Float64(x * x)) * x) * x) - t_0) ^ 3.0) ^ 2.0)) / Float64(t_1 - (Float64(Float64(Float64(Float64(Float64(x * x) * 9.0) * x) * x) - t_0) ^ 3.0))) / Float64((x ^ 8.0) * Float64(81.0 + fma(-18.0, Float64(Float64(y * y) / (x ^ 4.0)), fma(-18.0, Float64((y ^ 4.0) / (x ^ 4.0)), fma(2.0, Float64(Float64(Float64(y * y) * fma(2.0, Float64(y * y), (y ^ 4.0))) / (x ^ 8.0)), Float64((y ^ 8.0) / (x ^ 8.0)))))))) end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(4.0 * t$95$0), $MachinePrecision] * N[(y + y), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, N[(N[(N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[Power[N[Power[N[(N[(N[(N[(9.0 * N[(x * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] - t$95$0), $MachinePrecision], 3.0], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[Power[N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 9.0), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] - t$95$0), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, 8.0], $MachinePrecision] * N[(81.0 + N[(-18.0 * N[(N[(y * y), $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(-18.0 * N[(N[Power[y, 4.0], $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(N[(N[(y * y), $MachinePrecision] * N[(2.0 * N[(y * y), $MachinePrecision] + N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[x, 8.0], $MachinePrecision]), $MachinePrecision] + N[(N[Power[y, 8.0], $MachinePrecision] / N[Power[x, 8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(y \cdot y\right) \cdot y\right) \cdot y\\
t_1 := \left(\left(4 \cdot t\_0\right) \cdot \left(y + y\right)\right) \cdot y\\
\frac{\frac{t\_1 \cdot t\_1 - {\left({\left(\left(\left(9 \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x - t\_0\right)}^{3}\right)}^{2}}{t\_1 - {\left(\left(\left(\left(x \cdot x\right) \cdot 9\right) \cdot x\right) \cdot x - t\_0\right)}^{3}}}{{x}^{8} \cdot \left(81 + \mathsf{fma}\left(-18, \frac{y \cdot y}{{x}^{4}}, \mathsf{fma}\left(-18, \frac{{y}^{4}}{{x}^{4}}, \mathsf{fma}\left(2, \frac{\left(y \cdot y\right) \cdot \mathsf{fma}\left(2, y \cdot y, {y}^{4}\right)}{{x}^{8}}, \frac{{y}^{8}}{{x}^{8}}\right)\right)\right)\right)}
\end{array}
\end{array}
Initial program 18.8%
Applied rewrites18.8%
lift-fma.f64N/A
flip-+N/A
lower-/.f64N/A
Applied rewrites18.8%
lift-*.f64N/A
pow2N/A
lower-pow.f6418.8
lift-*.f64N/A
*-commutativeN/A
lift-*.f6418.8
Applied rewrites18.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
Applied rewrites24.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* (* y y) y) y))
(t_1 (pow (- (* (* (* 9.0 (* x x)) x) x) t_0) 3.0))
(t_2 (* (+ y y) (* t_0 4.0))))
(/
(/
(fma (* t_2 t_2) (* y y) (* (- t_1) t_1))
(-
(* (* (* 4.0 t_0) (+ y y)) y)
(pow (- (* (* (* (* x x) 9.0) x) x) t_0) 3.0)))
(fma
2.0
(* (* y y) (fma 2.0 (* y y) (pow y 4.0)))
(fma
(pow x 4.0)
(fma -18.0 (* y y) (fma -18.0 (pow y 4.0) (* 81.0 (pow x 4.0))))
(pow y 8.0))))))
double code(double x, double y) {
double t_0 = ((y * y) * y) * y;
double t_1 = pow(((((9.0 * (x * x)) * x) * x) - t_0), 3.0);
double t_2 = (y + y) * (t_0 * 4.0);
return (fma((t_2 * t_2), (y * y), (-t_1 * t_1)) / ((((4.0 * t_0) * (y + y)) * y) - pow((((((x * x) * 9.0) * x) * x) - t_0), 3.0))) / fma(2.0, ((y * y) * fma(2.0, (y * y), pow(y, 4.0))), fma(pow(x, 4.0), fma(-18.0, (y * y), fma(-18.0, pow(y, 4.0), (81.0 * pow(x, 4.0)))), pow(y, 8.0)));
}
function code(x, y) t_0 = Float64(Float64(Float64(y * y) * y) * y) t_1 = Float64(Float64(Float64(Float64(9.0 * Float64(x * x)) * x) * x) - t_0) ^ 3.0 t_2 = Float64(Float64(y + y) * Float64(t_0 * 4.0)) return Float64(Float64(fma(Float64(t_2 * t_2), Float64(y * y), Float64(Float64(-t_1) * t_1)) / Float64(Float64(Float64(Float64(4.0 * t_0) * Float64(y + y)) * y) - (Float64(Float64(Float64(Float64(Float64(x * x) * 9.0) * x) * x) - t_0) ^ 3.0))) / fma(2.0, Float64(Float64(y * y) * fma(2.0, Float64(y * y), (y ^ 4.0))), fma((x ^ 4.0), fma(-18.0, Float64(y * y), fma(-18.0, (y ^ 4.0), Float64(81.0 * (x ^ 4.0)))), (y ^ 8.0)))) end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(N[(N[(9.0 * N[(x * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] - t$95$0), $MachinePrecision], 3.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + y), $MachinePrecision] * N[(t$95$0 * 4.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(t$95$2 * t$95$2), $MachinePrecision] * N[(y * y), $MachinePrecision] + N[((-t$95$1) * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(4.0 * t$95$0), $MachinePrecision] * N[(y + y), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] - N[Power[N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 9.0), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] - t$95$0), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * N[(N[(y * y), $MachinePrecision] * N[(2.0 * N[(y * y), $MachinePrecision] + N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[x, 4.0], $MachinePrecision] * N[(-18.0 * N[(y * y), $MachinePrecision] + N[(-18.0 * N[Power[y, 4.0], $MachinePrecision] + N[(81.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[y, 8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(y \cdot y\right) \cdot y\right) \cdot y\\
t_1 := {\left(\left(\left(9 \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x - t\_0\right)}^{3}\\
t_2 := \left(y + y\right) \cdot \left(t\_0 \cdot 4\right)\\
\frac{\frac{\mathsf{fma}\left(t\_2 \cdot t\_2, y \cdot y, \left(-t\_1\right) \cdot t\_1\right)}{\left(\left(4 \cdot t\_0\right) \cdot \left(y + y\right)\right) \cdot y - {\left(\left(\left(\left(x \cdot x\right) \cdot 9\right) \cdot x\right) \cdot x - t\_0\right)}^{3}}}{\mathsf{fma}\left(2, \left(y \cdot y\right) \cdot \mathsf{fma}\left(2, y \cdot y, {y}^{4}\right), \mathsf{fma}\left({x}^{4}, \mathsf{fma}\left(-18, y \cdot y, \mathsf{fma}\left(-18, {y}^{4}, 81 \cdot {x}^{4}\right)\right), {y}^{8}\right)\right)}
\end{array}
\end{array}
Initial program 18.8%
Applied rewrites18.8%
lift-fma.f64N/A
flip-+N/A
lower-/.f64N/A
Applied rewrites18.8%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
Applied rewrites18.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
Applied rewrites19.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* (* y y) y) y)) (t_1 (* (* (* 4.0 t_0) (+ y y)) y)))
(/
(/
(- (* t_1 t_1) (pow (pow (- (* (* (* 9.0 (* x x)) x) x) t_0) 3.0) 2.0))
(- t_1 (pow (- (* (* (* (* x x) 9.0) x) x) t_0) 3.0)))
(fma
2.0
(* (* y y) (fma 2.0 (* y y) (pow y 4.0)))
(fma
(pow x 4.0)
(fma -18.0 (* y y) (fma -18.0 (pow y 4.0) (* 81.0 (pow x 4.0))))
(pow y 8.0))))))
double code(double x, double y) {
double t_0 = ((y * y) * y) * y;
double t_1 = ((4.0 * t_0) * (y + y)) * y;
return (((t_1 * t_1) - pow(pow(((((9.0 * (x * x)) * x) * x) - t_0), 3.0), 2.0)) / (t_1 - pow((((((x * x) * 9.0) * x) * x) - t_0), 3.0))) / fma(2.0, ((y * y) * fma(2.0, (y * y), pow(y, 4.0))), fma(pow(x, 4.0), fma(-18.0, (y * y), fma(-18.0, pow(y, 4.0), (81.0 * pow(x, 4.0)))), pow(y, 8.0)));
}
function code(x, y) t_0 = Float64(Float64(Float64(y * y) * y) * y) t_1 = Float64(Float64(Float64(4.0 * t_0) * Float64(y + y)) * y) return Float64(Float64(Float64(Float64(t_1 * t_1) - ((Float64(Float64(Float64(Float64(9.0 * Float64(x * x)) * x) * x) - t_0) ^ 3.0) ^ 2.0)) / Float64(t_1 - (Float64(Float64(Float64(Float64(Float64(x * x) * 9.0) * x) * x) - t_0) ^ 3.0))) / fma(2.0, Float64(Float64(y * y) * fma(2.0, Float64(y * y), (y ^ 4.0))), fma((x ^ 4.0), fma(-18.0, Float64(y * y), fma(-18.0, (y ^ 4.0), Float64(81.0 * (x ^ 4.0)))), (y ^ 8.0)))) end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(4.0 * t$95$0), $MachinePrecision] * N[(y + y), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, N[(N[(N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[Power[N[Power[N[(N[(N[(N[(9.0 * N[(x * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] - t$95$0), $MachinePrecision], 3.0], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[Power[N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 9.0), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] - t$95$0), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * N[(N[(y * y), $MachinePrecision] * N[(2.0 * N[(y * y), $MachinePrecision] + N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[x, 4.0], $MachinePrecision] * N[(-18.0 * N[(y * y), $MachinePrecision] + N[(-18.0 * N[Power[y, 4.0], $MachinePrecision] + N[(81.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[y, 8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(y \cdot y\right) \cdot y\right) \cdot y\\
t_1 := \left(\left(4 \cdot t\_0\right) \cdot \left(y + y\right)\right) \cdot y\\
\frac{\frac{t\_1 \cdot t\_1 - {\left({\left(\left(\left(9 \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x - t\_0\right)}^{3}\right)}^{2}}{t\_1 - {\left(\left(\left(\left(x \cdot x\right) \cdot 9\right) \cdot x\right) \cdot x - t\_0\right)}^{3}}}{\mathsf{fma}\left(2, \left(y \cdot y\right) \cdot \mathsf{fma}\left(2, y \cdot y, {y}^{4}\right), \mathsf{fma}\left({x}^{4}, \mathsf{fma}\left(-18, y \cdot y, \mathsf{fma}\left(-18, {y}^{4}, 81 \cdot {x}^{4}\right)\right), {y}^{8}\right)\right)}
\end{array}
\end{array}
Initial program 18.8%
Applied rewrites18.8%
lift-fma.f64N/A
flip-+N/A
lower-/.f64N/A
Applied rewrites18.8%
lift-*.f64N/A
pow2N/A
lower-pow.f6418.8
lift-*.f64N/A
*-commutativeN/A
lift-*.f6418.8
Applied rewrites18.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
Applied rewrites19.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* (* y y) y) y))
(t_1 (* 9.0 (* x x)))
(t_2 (* (+ y y) y))
(t_3 (* (* (* 4.0 t_0) (+ y y)) y))
(t_4 (- (* t_1 (* x x)) t_0)))
(/
(/
(- (* t_3 t_3) (pow (pow (- (* (* t_1 x) x) t_0) 3.0) 2.0))
(-
t_3
(pow (* (pow x 4.0) (+ 9.0 (* -1.0 (/ (pow y 4.0) (pow x 4.0))))) 3.0)))
(fma t_2 (- t_2 t_4) (pow t_4 2.0)))))
double code(double x, double y) {
double t_0 = ((y * y) * y) * y;
double t_1 = 9.0 * (x * x);
double t_2 = (y + y) * y;
double t_3 = ((4.0 * t_0) * (y + y)) * y;
double t_4 = (t_1 * (x * x)) - t_0;
return (((t_3 * t_3) - pow(pow((((t_1 * x) * x) - t_0), 3.0), 2.0)) / (t_3 - pow((pow(x, 4.0) * (9.0 + (-1.0 * (pow(y, 4.0) / pow(x, 4.0))))), 3.0))) / fma(t_2, (t_2 - t_4), pow(t_4, 2.0));
}
function code(x, y) t_0 = Float64(Float64(Float64(y * y) * y) * y) t_1 = Float64(9.0 * Float64(x * x)) t_2 = Float64(Float64(y + y) * y) t_3 = Float64(Float64(Float64(4.0 * t_0) * Float64(y + y)) * y) t_4 = Float64(Float64(t_1 * Float64(x * x)) - t_0) return Float64(Float64(Float64(Float64(t_3 * t_3) - ((Float64(Float64(Float64(t_1 * x) * x) - t_0) ^ 3.0) ^ 2.0)) / Float64(t_3 - (Float64((x ^ 4.0) * Float64(9.0 + Float64(-1.0 * Float64((y ^ 4.0) / (x ^ 4.0))))) ^ 3.0))) / fma(t_2, Float64(t_2 - t_4), (t_4 ^ 2.0))) end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$1 = N[(9.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + y), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(4.0 * t$95$0), $MachinePrecision] * N[(y + y), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$1 * N[(x * x), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]}, N[(N[(N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[Power[N[Power[N[(N[(N[(t$95$1 * x), $MachinePrecision] * x), $MachinePrecision] - t$95$0), $MachinePrecision], 3.0], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(t$95$3 - N[Power[N[(N[Power[x, 4.0], $MachinePrecision] * N[(9.0 + N[(-1.0 * N[(N[Power[y, 4.0], $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$2 * N[(t$95$2 - t$95$4), $MachinePrecision] + N[Power[t$95$4, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(y \cdot y\right) \cdot y\right) \cdot y\\
t_1 := 9 \cdot \left(x \cdot x\right)\\
t_2 := \left(y + y\right) \cdot y\\
t_3 := \left(\left(4 \cdot t\_0\right) \cdot \left(y + y\right)\right) \cdot y\\
t_4 := t\_1 \cdot \left(x \cdot x\right) - t\_0\\
\frac{\frac{t\_3 \cdot t\_3 - {\left({\left(\left(t\_1 \cdot x\right) \cdot x - t\_0\right)}^{3}\right)}^{2}}{t\_3 - {\left({x}^{4} \cdot \left(9 + -1 \cdot \frac{{y}^{4}}{{x}^{4}}\right)\right)}^{3}}}{\mathsf{fma}\left(t\_2, t\_2 - t\_4, {t\_4}^{2}\right)}
\end{array}
\end{array}
Initial program 18.8%
Applied rewrites18.8%
lift-fma.f64N/A
flip-+N/A
lower-/.f64N/A
Applied rewrites18.8%
lift-*.f64N/A
pow2N/A
lower-pow.f6418.8
lift-*.f64N/A
*-commutativeN/A
lift-*.f6418.8
Applied rewrites18.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-pow.f6418.8
Applied rewrites18.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 9.0 (* x x)))
(t_1 (* (+ y y) y))
(t_2 (* (* (* y y) y) y))
(t_3 (- (* t_0 (* x x)) t_2))
(t_4 (pow (- (* (* t_0 x) x) t_2) 3.0)))
(/
(/
(fma (* 64.0 (pow y 10.0)) (* y y) (* (- t_4) t_4))
(-
(* (* (* 4.0 t_2) (+ y y)) y)
(pow (- (* (* (* (* x x) 9.0) x) x) t_2) 3.0)))
(fma t_1 (- t_1 t_3) (pow t_3 2.0)))))
double code(double x, double y) {
double t_0 = 9.0 * (x * x);
double t_1 = (y + y) * y;
double t_2 = ((y * y) * y) * y;
double t_3 = (t_0 * (x * x)) - t_2;
double t_4 = pow((((t_0 * x) * x) - t_2), 3.0);
return (fma((64.0 * pow(y, 10.0)), (y * y), (-t_4 * t_4)) / ((((4.0 * t_2) * (y + y)) * y) - pow((((((x * x) * 9.0) * x) * x) - t_2), 3.0))) / fma(t_1, (t_1 - t_3), pow(t_3, 2.0));
}
function code(x, y) t_0 = Float64(9.0 * Float64(x * x)) t_1 = Float64(Float64(y + y) * y) t_2 = Float64(Float64(Float64(y * y) * y) * y) t_3 = Float64(Float64(t_0 * Float64(x * x)) - t_2) t_4 = Float64(Float64(Float64(t_0 * x) * x) - t_2) ^ 3.0 return Float64(Float64(fma(Float64(64.0 * (y ^ 10.0)), Float64(y * y), Float64(Float64(-t_4) * t_4)) / Float64(Float64(Float64(Float64(4.0 * t_2) * Float64(y + y)) * y) - (Float64(Float64(Float64(Float64(Float64(x * x) * 9.0) * x) * x) - t_2) ^ 3.0))) / fma(t_1, Float64(t_1 - t_3), (t_3 ^ 2.0))) end
code[x_, y_] := Block[{t$95$0 = N[(9.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y + y), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$0 * N[(x * x), $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[(N[(N[(t$95$0 * x), $MachinePrecision] * x), $MachinePrecision] - t$95$2), $MachinePrecision], 3.0], $MachinePrecision]}, N[(N[(N[(N[(64.0 * N[Power[y, 10.0], $MachinePrecision]), $MachinePrecision] * N[(y * y), $MachinePrecision] + N[((-t$95$4) * t$95$4), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(4.0 * t$95$2), $MachinePrecision] * N[(y + y), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] - N[Power[N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 9.0), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] - t$95$2), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 * N[(t$95$1 - t$95$3), $MachinePrecision] + N[Power[t$95$3, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 9 \cdot \left(x \cdot x\right)\\
t_1 := \left(y + y\right) \cdot y\\
t_2 := \left(\left(y \cdot y\right) \cdot y\right) \cdot y\\
t_3 := t\_0 \cdot \left(x \cdot x\right) - t\_2\\
t_4 := {\left(\left(t\_0 \cdot x\right) \cdot x - t\_2\right)}^{3}\\
\frac{\frac{\mathsf{fma}\left(64 \cdot {y}^{10}, y \cdot y, \left(-t\_4\right) \cdot t\_4\right)}{\left(\left(4 \cdot t\_2\right) \cdot \left(y + y\right)\right) \cdot y - {\left(\left(\left(\left(x \cdot x\right) \cdot 9\right) \cdot x\right) \cdot x - t\_2\right)}^{3}}}{\mathsf{fma}\left(t\_1, t\_1 - t\_3, {t\_3}^{2}\right)}
\end{array}
\end{array}
Initial program 18.8%
Applied rewrites18.8%
lift-fma.f64N/A
flip-+N/A
lower-/.f64N/A
Applied rewrites18.8%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
Applied rewrites18.8%
Taylor expanded in y around 0
lower-*.f64N/A
lower-pow.f6418.8
Applied rewrites18.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* (* y y) y) y))
(t_1 (* (+ y y) y))
(t_2 (* 9.0 (* x x)))
(t_3 (- (* t_2 (* x x)) t_0)))
(/
(/
(- (* 64.0 (pow y 12.0)) (pow (pow (- (* (* t_2 x) x) t_0) 3.0) 2.0))
(-
(* (* (* 4.0 t_0) (+ y y)) y)
(pow (- (* (* (* (* x x) 9.0) x) x) t_0) 3.0)))
(fma t_1 (- t_1 t_3) (pow t_3 2.0)))))
double code(double x, double y) {
double t_0 = ((y * y) * y) * y;
double t_1 = (y + y) * y;
double t_2 = 9.0 * (x * x);
double t_3 = (t_2 * (x * x)) - t_0;
return (((64.0 * pow(y, 12.0)) - pow(pow((((t_2 * x) * x) - t_0), 3.0), 2.0)) / ((((4.0 * t_0) * (y + y)) * y) - pow((((((x * x) * 9.0) * x) * x) - t_0), 3.0))) / fma(t_1, (t_1 - t_3), pow(t_3, 2.0));
}
function code(x, y) t_0 = Float64(Float64(Float64(y * y) * y) * y) t_1 = Float64(Float64(y + y) * y) t_2 = Float64(9.0 * Float64(x * x)) t_3 = Float64(Float64(t_2 * Float64(x * x)) - t_0) return Float64(Float64(Float64(Float64(64.0 * (y ^ 12.0)) - ((Float64(Float64(Float64(t_2 * x) * x) - t_0) ^ 3.0) ^ 2.0)) / Float64(Float64(Float64(Float64(4.0 * t_0) * Float64(y + y)) * y) - (Float64(Float64(Float64(Float64(Float64(x * x) * 9.0) * x) * x) - t_0) ^ 3.0))) / fma(t_1, Float64(t_1 - t_3), (t_3 ^ 2.0))) end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y + y), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(9.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$2 * N[(x * x), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]}, N[(N[(N[(N[(64.0 * N[Power[y, 12.0], $MachinePrecision]), $MachinePrecision] - N[Power[N[Power[N[(N[(N[(t$95$2 * x), $MachinePrecision] * x), $MachinePrecision] - t$95$0), $MachinePrecision], 3.0], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(4.0 * t$95$0), $MachinePrecision] * N[(y + y), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] - N[Power[N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 9.0), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] - t$95$0), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 * N[(t$95$1 - t$95$3), $MachinePrecision] + N[Power[t$95$3, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(y \cdot y\right) \cdot y\right) \cdot y\\
t_1 := \left(y + y\right) \cdot y\\
t_2 := 9 \cdot \left(x \cdot x\right)\\
t_3 := t\_2 \cdot \left(x \cdot x\right) - t\_0\\
\frac{\frac{64 \cdot {y}^{12} - {\left({\left(\left(t\_2 \cdot x\right) \cdot x - t\_0\right)}^{3}\right)}^{2}}{\left(\left(4 \cdot t\_0\right) \cdot \left(y + y\right)\right) \cdot y - {\left(\left(\left(\left(x \cdot x\right) \cdot 9\right) \cdot x\right) \cdot x - t\_0\right)}^{3}}}{\mathsf{fma}\left(t\_1, t\_1 - t\_3, {t\_3}^{2}\right)}
\end{array}
\end{array}
Initial program 18.8%
Applied rewrites18.8%
lift-fma.f64N/A
flip-+N/A
lower-/.f64N/A
Applied rewrites18.8%
lift-*.f64N/A
pow2N/A
lower-pow.f6418.8
lift-*.f64N/A
*-commutativeN/A
lift-*.f6418.8
Applied rewrites18.8%
Taylor expanded in y around 0
lower-*.f64N/A
lower-pow.f6418.8
Applied rewrites18.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* (* y y) y) y))
(t_1 (* (+ y y) y))
(t_2 (- (* (* 9.0 (* x x)) (* x x)) t_0)))
(/
(fma (* t_0 4.0) t_1 (pow t_2 3.0))
(fma t_1 (- t_1 t_2) (pow t_2 2.0)))))
double code(double x, double y) {
double t_0 = ((y * y) * y) * y;
double t_1 = (y + y) * y;
double t_2 = ((9.0 * (x * x)) * (x * x)) - t_0;
return fma((t_0 * 4.0), t_1, pow(t_2, 3.0)) / fma(t_1, (t_1 - t_2), pow(t_2, 2.0));
}
function code(x, y) t_0 = Float64(Float64(Float64(y * y) * y) * y) t_1 = Float64(Float64(y + y) * y) t_2 = Float64(Float64(Float64(9.0 * Float64(x * x)) * Float64(x * x)) - t_0) return Float64(fma(Float64(t_0 * 4.0), t_1, (t_2 ^ 3.0)) / fma(t_1, Float64(t_1 - t_2), (t_2 ^ 2.0))) end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y + y), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(9.0 * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]}, N[(N[(N[(t$95$0 * 4.0), $MachinePrecision] * t$95$1 + N[Power[t$95$2, 3.0], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 * N[(t$95$1 - t$95$2), $MachinePrecision] + N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(y \cdot y\right) \cdot y\right) \cdot y\\
t_1 := \left(y + y\right) \cdot y\\
t_2 := \left(9 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) - t\_0\\
\frac{\mathsf{fma}\left(t\_0 \cdot 4, t\_1, {t\_2}^{3}\right)}{\mathsf{fma}\left(t\_1, t\_1 - t\_2, {t\_2}^{2}\right)}
\end{array}
\end{array}
Initial program 18.8%
Applied rewrites18.8%
(FPCore (x y) :precision binary64 (let* ((t_0 (* (* (* y y) y) y)) (t_1 (- (* (* 9.0 (* x x)) (* x x)) t_0))) (/ (- (* t_0 4.0) (pow t_1 2.0)) (- (* (+ y y) y) t_1))))
double code(double x, double y) {
double t_0 = ((y * y) * y) * y;
double t_1 = ((9.0 * (x * x)) * (x * x)) - t_0;
return ((t_0 * 4.0) - pow(t_1, 2.0)) / (((y + y) * y) - t_1);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
t_0 = ((y * y) * y) * y
t_1 = ((9.0d0 * (x * x)) * (x * x)) - t_0
code = ((t_0 * 4.0d0) - (t_1 ** 2.0d0)) / (((y + y) * y) - t_1)
end function
public static double code(double x, double y) {
double t_0 = ((y * y) * y) * y;
double t_1 = ((9.0 * (x * x)) * (x * x)) - t_0;
return ((t_0 * 4.0) - Math.pow(t_1, 2.0)) / (((y + y) * y) - t_1);
}
def code(x, y): t_0 = ((y * y) * y) * y t_1 = ((9.0 * (x * x)) * (x * x)) - t_0 return ((t_0 * 4.0) - math.pow(t_1, 2.0)) / (((y + y) * y) - t_1)
function code(x, y) t_0 = Float64(Float64(Float64(y * y) * y) * y) t_1 = Float64(Float64(Float64(9.0 * Float64(x * x)) * Float64(x * x)) - t_0) return Float64(Float64(Float64(t_0 * 4.0) - (t_1 ^ 2.0)) / Float64(Float64(Float64(y + y) * y) - t_1)) end
function tmp = code(x, y) t_0 = ((y * y) * y) * y; t_1 = ((9.0 * (x * x)) * (x * x)) - t_0; tmp = ((t_0 * 4.0) - (t_1 ^ 2.0)) / (((y + y) * y) - t_1); end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(9.0 * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]}, N[(N[(N[(t$95$0 * 4.0), $MachinePrecision] - N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(y + y), $MachinePrecision] * y), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(y \cdot y\right) \cdot y\right) \cdot y\\
t_1 := \left(9 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) - t\_0\\
\frac{t\_0 \cdot 4 - {t\_1}^{2}}{\left(y + y\right) \cdot y - t\_1}
\end{array}
\end{array}
Initial program 18.8%
lift-+.f64N/A
+-commutativeN/A
flip-+N/A
lower-/.f64N/A
Applied rewrites18.8%
(FPCore (x y) :precision binary64 (fma (+ y y) y (- (* (* 9.0 (* x x)) (* x x)) (* (* (* y y) y) y))))
double code(double x, double y) {
return fma((y + y), y, (((9.0 * (x * x)) * (x * x)) - (((y * y) * y) * y)));
}
function code(x, y) return fma(Float64(y + y), y, Float64(Float64(Float64(9.0 * Float64(x * x)) * Float64(x * x)) - Float64(Float64(Float64(y * y) * y) * y))) end
code[x_, y_] := N[(N[(y + y), $MachinePrecision] * y + N[(N[(N[(9.0 * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y + y, y, \left(9 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) - \left(\left(y \cdot y\right) \cdot y\right) \cdot y\right)
\end{array}
Initial program 18.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f6418.8
lift-*.f64N/A
lift-pow.f64N/A
sqr-powN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-*.f6418.8
lift-pow.f64N/A
metadata-evalN/A
pow-sqrN/A
pow2N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites18.8%
(FPCore (x y) :precision binary64 (fma 2.0 (* y y) (* 9.0 (pow x 4.0))))
double code(double x, double y) {
return fma(2.0, (y * y), (9.0 * pow(x, 4.0)));
}
function code(x, y) return fma(2.0, Float64(y * y), Float64(9.0 * (x ^ 4.0))) end
code[x_, y_] := N[(2.0 * N[(y * y), $MachinePrecision] + N[(9.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(2, y \cdot y, 9 \cdot {x}^{4}\right)
\end{array}
Initial program 18.8%
Applied rewrites18.8%
lift-fma.f64N/A
flip-+N/A
lower-/.f64N/A
Applied rewrites18.8%
Applied rewrites18.8%
Taylor expanded in y around 0
Applied rewrites9.6%
(FPCore (x y) :precision binary64 (- (* (* 9.0 (* x x)) (* x x)) (* (* y y) (- (* y y) 2.0))))
double code(double x, double y) {
return ((9.0 * (x * x)) * (x * x)) - ((y * y) * ((y * y) - 2.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((9.0d0 * (x * x)) * (x * x)) - ((y * y) * ((y * y) - 2.0d0))
end function
public static double code(double x, double y) {
return ((9.0 * (x * x)) * (x * x)) - ((y * y) * ((y * y) - 2.0));
}
def code(x, y): return ((9.0 * (x * x)) * (x * x)) - ((y * y) * ((y * y) - 2.0))
function code(x, y) return Float64(Float64(Float64(9.0 * Float64(x * x)) * Float64(x * x)) - Float64(Float64(y * y) * Float64(Float64(y * y) - 2.0))) end
function tmp = code(x, y) tmp = ((9.0 * (x * x)) * (x * x)) - ((y * y) * ((y * y) - 2.0)); end
code[x_, y_] := N[(N[(N[(9.0 * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] - N[(N[(y * y), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(9 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(y \cdot y - 2\right)
\end{array}
Initial program 18.8%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
sqr-powN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-sqrN/A
pow-prod-downN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
distribute-rgt-out--N/A
Applied rewrites3.1%
herbie shell --seed 2025140
(FPCore (x y)
:name "From Rump in a 1983 paper"
:precision binary64
:pre (and (== x 10864.0) (== y 18817.0))
(+ (- (* 9.0 (pow x 4.0)) (pow y 4.0)) (* 2.0 (* y y))))