
(FPCore (x y z) :precision binary64 (* (/ 1.0 2.0) (+ x (* y (sqrt z)))))
double code(double x, double y, double z) {
return (1.0 / 2.0) * (x + (y * sqrt(z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / 2.0d0) * (x + (y * sqrt(z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / 2.0) * (x + (y * Math.sqrt(z)));
}
def code(x, y, z): return (1.0 / 2.0) * (x + (y * math.sqrt(z)))
function code(x, y, z) return Float64(Float64(1.0 / 2.0) * Float64(x + Float64(y * sqrt(z)))) end
function tmp = code(x, y, z) tmp = (1.0 / 2.0) * (x + (y * sqrt(z))); end
code[x_, y_, z_] := N[(N[(1.0 / 2.0), $MachinePrecision] * N[(x + N[(y * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (* (/ 1.0 2.0) (+ x (* y (sqrt z)))))
double code(double x, double y, double z) {
return (1.0 / 2.0) * (x + (y * sqrt(z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / 2.0d0) * (x + (y * sqrt(z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / 2.0) * (x + (y * Math.sqrt(z)));
}
def code(x, y, z): return (1.0 / 2.0) * (x + (y * math.sqrt(z)))
function code(x, y, z) return Float64(Float64(1.0 / 2.0) * Float64(x + Float64(y * sqrt(z)))) end
function tmp = code(x, y, z) tmp = (1.0 / 2.0) * (x + (y * sqrt(z))); end
code[x_, y_, z_] := N[(N[(1.0 / 2.0), $MachinePrecision] * N[(x + N[(y * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right)
\end{array}
(FPCore (x y z) :precision binary64 (* (+ x (/ y (pow z -0.5))) 0.5))
double code(double x, double y, double z) {
return (x + (y / pow(z, -0.5))) * 0.5;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + (y / (z ** (-0.5d0)))) * 0.5d0
end function
public static double code(double x, double y, double z) {
return (x + (y / Math.pow(z, -0.5))) * 0.5;
}
def code(x, y, z): return (x + (y / math.pow(z, -0.5))) * 0.5
function code(x, y, z) return Float64(Float64(x + Float64(y / (z ^ -0.5))) * 0.5) end
function tmp = code(x, y, z) tmp = (x + (y / (z ^ -0.5))) * 0.5; end
code[x_, y_, z_] := N[(N[(x + N[(y / N[Power[z, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \frac{y}{{z}^{-0.5}}\right) \cdot 0.5
\end{array}
Initial program 99.8%
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.8%
Simplified99.8%
Taylor expanded in z around inf
Simplified93.2%
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (sqrt z))))
(if (<= t_0 -5e-37)
(/ (* y 0.5) (pow z -0.5))
(if (<= t_0 5e-122)
(* 0.5 (- x (/ (* z (* y y)) x)))
(* y (* 0.5 (sqrt z)))))))
double code(double x, double y, double z) {
double t_0 = y * sqrt(z);
double tmp;
if (t_0 <= -5e-37) {
tmp = (y * 0.5) / pow(z, -0.5);
} else if (t_0 <= 5e-122) {
tmp = 0.5 * (x - ((z * (y * y)) / x));
} else {
tmp = y * (0.5 * sqrt(z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = y * sqrt(z)
if (t_0 <= (-5d-37)) then
tmp = (y * 0.5d0) / (z ** (-0.5d0))
else if (t_0 <= 5d-122) then
tmp = 0.5d0 * (x - ((z * (y * y)) / x))
else
tmp = y * (0.5d0 * sqrt(z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * Math.sqrt(z);
double tmp;
if (t_0 <= -5e-37) {
tmp = (y * 0.5) / Math.pow(z, -0.5);
} else if (t_0 <= 5e-122) {
tmp = 0.5 * (x - ((z * (y * y)) / x));
} else {
tmp = y * (0.5 * Math.sqrt(z));
}
return tmp;
}
def code(x, y, z): t_0 = y * math.sqrt(z) tmp = 0 if t_0 <= -5e-37: tmp = (y * 0.5) / math.pow(z, -0.5) elif t_0 <= 5e-122: tmp = 0.5 * (x - ((z * (y * y)) / x)) else: tmp = y * (0.5 * math.sqrt(z)) return tmp
function code(x, y, z) t_0 = Float64(y * sqrt(z)) tmp = 0.0 if (t_0 <= -5e-37) tmp = Float64(Float64(y * 0.5) / (z ^ -0.5)); elseif (t_0 <= 5e-122) tmp = Float64(0.5 * Float64(x - Float64(Float64(z * Float64(y * y)) / x))); else tmp = Float64(y * Float64(0.5 * sqrt(z))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * sqrt(z); tmp = 0.0; if (t_0 <= -5e-37) tmp = (y * 0.5) / (z ^ -0.5); elseif (t_0 <= 5e-122) tmp = 0.5 * (x - ((z * (y * y)) / x)); else tmp = y * (0.5 * sqrt(z)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-37], N[(N[(y * 0.5), $MachinePrecision] / N[Power[z, -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e-122], N[(0.5 * N[(x - N[(N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \sqrt{z}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-37}:\\
\;\;\;\;\frac{y \cdot 0.5}{{z}^{-0.5}}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-122}:\\
\;\;\;\;0.5 \cdot \left(x - \frac{z \cdot \left(y \cdot y\right)}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(0.5 \cdot \sqrt{z}\right)\\
\end{array}
\end{array}
if (*.f64 y (sqrt.f64 z)) < -4.9999999999999997e-37Initial program 99.6%
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.6%
Simplified99.6%
flip-+N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
clear-numN/A
flip-+N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
rem-square-sqrtN/A
sqrt-lowering-sqrt.f64N/A
rem-square-sqrt99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0
associate-*l/N/A
*-lft-identityN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6474.0%
Simplified74.0%
associate-/r/N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sqrt-divN/A
metadata-evalN/A
pow1/2N/A
pow-flipN/A
pow-lowering-pow.f64N/A
metadata-eval74.1%
Applied egg-rr74.1%
if -4.9999999999999997e-37 < (*.f64 y (sqrt.f64 z)) < 4.9999999999999999e-122Initial program 99.9%
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.9%
Simplified99.9%
flip-+N/A
div-subN/A
frac-2negN/A
frac-2negN/A
sub-divN/A
/-lowering-/.f64N/A
Applied egg-rr60.6%
Taylor expanded in x around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6454.9%
Simplified54.9%
*-commutativeN/A
*-lowering-*.f64N/A
div-subN/A
neg-sub0N/A
metadata-evalN/A
flip-+N/A
+-lft-identityN/A
--lowering--.f64N/A
frac-2negN/A
sub0-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
distribute-rgt-neg-outN/A
remove-double-negN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6487.5%
Applied egg-rr87.5%
if 4.9999999999999999e-122 < (*.f64 y (sqrt.f64 z)) Initial program 99.8%
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.8%
Simplified99.8%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6476.0%
Simplified76.0%
Final simplification79.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (sqrt z))))
(if (<= t_0 -5e-37)
(/ 0.5 (/ (pow z -0.5) y))
(if (<= t_0 5e-122)
(* 0.5 (- x (/ (* z (* y y)) x)))
(* y (* 0.5 (sqrt z)))))))
double code(double x, double y, double z) {
double t_0 = y * sqrt(z);
double tmp;
if (t_0 <= -5e-37) {
tmp = 0.5 / (pow(z, -0.5) / y);
} else if (t_0 <= 5e-122) {
tmp = 0.5 * (x - ((z * (y * y)) / x));
} else {
tmp = y * (0.5 * sqrt(z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = y * sqrt(z)
if (t_0 <= (-5d-37)) then
tmp = 0.5d0 / ((z ** (-0.5d0)) / y)
else if (t_0 <= 5d-122) then
tmp = 0.5d0 * (x - ((z * (y * y)) / x))
else
tmp = y * (0.5d0 * sqrt(z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * Math.sqrt(z);
double tmp;
if (t_0 <= -5e-37) {
tmp = 0.5 / (Math.pow(z, -0.5) / y);
} else if (t_0 <= 5e-122) {
tmp = 0.5 * (x - ((z * (y * y)) / x));
} else {
tmp = y * (0.5 * Math.sqrt(z));
}
return tmp;
}
def code(x, y, z): t_0 = y * math.sqrt(z) tmp = 0 if t_0 <= -5e-37: tmp = 0.5 / (math.pow(z, -0.5) / y) elif t_0 <= 5e-122: tmp = 0.5 * (x - ((z * (y * y)) / x)) else: tmp = y * (0.5 * math.sqrt(z)) return tmp
function code(x, y, z) t_0 = Float64(y * sqrt(z)) tmp = 0.0 if (t_0 <= -5e-37) tmp = Float64(0.5 / Float64((z ^ -0.5) / y)); elseif (t_0 <= 5e-122) tmp = Float64(0.5 * Float64(x - Float64(Float64(z * Float64(y * y)) / x))); else tmp = Float64(y * Float64(0.5 * sqrt(z))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * sqrt(z); tmp = 0.0; if (t_0 <= -5e-37) tmp = 0.5 / ((z ^ -0.5) / y); elseif (t_0 <= 5e-122) tmp = 0.5 * (x - ((z * (y * y)) / x)); else tmp = y * (0.5 * sqrt(z)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-37], N[(0.5 / N[(N[Power[z, -0.5], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e-122], N[(0.5 * N[(x - N[(N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \sqrt{z}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-37}:\\
\;\;\;\;\frac{0.5}{\frac{{z}^{-0.5}}{y}}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-122}:\\
\;\;\;\;0.5 \cdot \left(x - \frac{z \cdot \left(y \cdot y\right)}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(0.5 \cdot \sqrt{z}\right)\\
\end{array}
\end{array}
if (*.f64 y (sqrt.f64 z)) < -4.9999999999999997e-37Initial program 99.6%
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.6%
Simplified99.6%
flip-+N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
clear-numN/A
flip-+N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
rem-square-sqrtN/A
sqrt-lowering-sqrt.f64N/A
rem-square-sqrt99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0
associate-*l/N/A
*-lft-identityN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6474.0%
Simplified74.0%
sqrt-divN/A
metadata-evalN/A
pow1/2N/A
pow-flipN/A
pow-lowering-pow.f64N/A
metadata-eval74.0%
Applied egg-rr74.0%
if -4.9999999999999997e-37 < (*.f64 y (sqrt.f64 z)) < 4.9999999999999999e-122Initial program 99.9%
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.9%
Simplified99.9%
flip-+N/A
div-subN/A
frac-2negN/A
frac-2negN/A
sub-divN/A
/-lowering-/.f64N/A
Applied egg-rr60.6%
Taylor expanded in x around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6454.9%
Simplified54.9%
*-commutativeN/A
*-lowering-*.f64N/A
div-subN/A
neg-sub0N/A
metadata-evalN/A
flip-+N/A
+-lft-identityN/A
--lowering--.f64N/A
frac-2negN/A
sub0-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
distribute-rgt-neg-outN/A
remove-double-negN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6487.5%
Applied egg-rr87.5%
if 4.9999999999999999e-122 < (*.f64 y (sqrt.f64 z)) Initial program 99.8%
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.8%
Simplified99.8%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6476.0%
Simplified76.0%
Final simplification79.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (sqrt z))) (t_1 (* y (* 0.5 (sqrt z)))))
(if (<= t_0 -5e-37)
t_1
(if (<= t_0 5e-122) (* 0.5 (- x (/ (* z (* y y)) x))) t_1))))
double code(double x, double y, double z) {
double t_0 = y * sqrt(z);
double t_1 = y * (0.5 * sqrt(z));
double tmp;
if (t_0 <= -5e-37) {
tmp = t_1;
} else if (t_0 <= 5e-122) {
tmp = 0.5 * (x - ((z * (y * y)) / x));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = y * sqrt(z)
t_1 = y * (0.5d0 * sqrt(z))
if (t_0 <= (-5d-37)) then
tmp = t_1
else if (t_0 <= 5d-122) then
tmp = 0.5d0 * (x - ((z * (y * y)) / x))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * Math.sqrt(z);
double t_1 = y * (0.5 * Math.sqrt(z));
double tmp;
if (t_0 <= -5e-37) {
tmp = t_1;
} else if (t_0 <= 5e-122) {
tmp = 0.5 * (x - ((z * (y * y)) / x));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = y * math.sqrt(z) t_1 = y * (0.5 * math.sqrt(z)) tmp = 0 if t_0 <= -5e-37: tmp = t_1 elif t_0 <= 5e-122: tmp = 0.5 * (x - ((z * (y * y)) / x)) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(y * sqrt(z)) t_1 = Float64(y * Float64(0.5 * sqrt(z))) tmp = 0.0 if (t_0 <= -5e-37) tmp = t_1; elseif (t_0 <= 5e-122) tmp = Float64(0.5 * Float64(x - Float64(Float64(z * Float64(y * y)) / x))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * sqrt(z); t_1 = y * (0.5 * sqrt(z)); tmp = 0.0; if (t_0 <= -5e-37) tmp = t_1; elseif (t_0 <= 5e-122) tmp = 0.5 * (x - ((z * (y * y)) / x)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[(0.5 * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-37], t$95$1, If[LessEqual[t$95$0, 5e-122], N[(0.5 * N[(x - N[(N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \sqrt{z}\\
t_1 := y \cdot \left(0.5 \cdot \sqrt{z}\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-122}:\\
\;\;\;\;0.5 \cdot \left(x - \frac{z \cdot \left(y \cdot y\right)}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 y (sqrt.f64 z)) < -4.9999999999999997e-37 or 4.9999999999999999e-122 < (*.f64 y (sqrt.f64 z)) Initial program 99.7%
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.7%
Simplified99.7%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6474.9%
Simplified74.9%
if -4.9999999999999997e-37 < (*.f64 y (sqrt.f64 z)) < 4.9999999999999999e-122Initial program 99.9%
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.9%
Simplified99.9%
flip-+N/A
div-subN/A
frac-2negN/A
frac-2negN/A
sub-divN/A
/-lowering-/.f64N/A
Applied egg-rr60.6%
Taylor expanded in x around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6454.9%
Simplified54.9%
*-commutativeN/A
*-lowering-*.f64N/A
div-subN/A
neg-sub0N/A
metadata-evalN/A
flip-+N/A
+-lft-identityN/A
--lowering--.f64N/A
frac-2negN/A
sub0-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
distribute-rgt-neg-outN/A
remove-double-negN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6487.5%
Applied egg-rr87.5%
Final simplification79.7%
(FPCore (x y z) :precision binary64 (* 0.5 (+ x (* y (sqrt z)))))
double code(double x, double y, double z) {
return 0.5 * (x + (y * sqrt(z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 0.5d0 * (x + (y * sqrt(z)))
end function
public static double code(double x, double y, double z) {
return 0.5 * (x + (y * Math.sqrt(z)));
}
def code(x, y, z): return 0.5 * (x + (y * math.sqrt(z)))
function code(x, y, z) return Float64(0.5 * Float64(x + Float64(y * sqrt(z)))) end
function tmp = code(x, y, z) tmp = 0.5 * (x + (y * sqrt(z))); end
code[x_, y_, z_] := N[(0.5 * N[(x + N[(y * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(x + y \cdot \sqrt{z}\right)
\end{array}
Initial program 99.8%
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.8%
Simplified99.8%
(FPCore (x y z) :precision binary64 (if (<= z 2.25e+76) (* x 0.5) (* x (- (/ -1.0 (/ (/ x z) (* 0.5 (/ (* y y) x)))) -0.5))))
double code(double x, double y, double z) {
double tmp;
if (z <= 2.25e+76) {
tmp = x * 0.5;
} else {
tmp = x * ((-1.0 / ((x / z) / (0.5 * ((y * y) / x)))) - -0.5);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 2.25d+76) then
tmp = x * 0.5d0
else
tmp = x * (((-1.0d0) / ((x / z) / (0.5d0 * ((y * y) / x)))) - (-0.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 2.25e+76) {
tmp = x * 0.5;
} else {
tmp = x * ((-1.0 / ((x / z) / (0.5 * ((y * y) / x)))) - -0.5);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 2.25e+76: tmp = x * 0.5 else: tmp = x * ((-1.0 / ((x / z) / (0.5 * ((y * y) / x)))) - -0.5) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 2.25e+76) tmp = Float64(x * 0.5); else tmp = Float64(x * Float64(Float64(-1.0 / Float64(Float64(x / z) / Float64(0.5 * Float64(Float64(y * y) / x)))) - -0.5)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 2.25e+76) tmp = x * 0.5; else tmp = x * ((-1.0 / ((x / z) / (0.5 * ((y * y) / x)))) - -0.5); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 2.25e+76], N[(x * 0.5), $MachinePrecision], N[(x * N[(N[(-1.0 / N[(N[(x / z), $MachinePrecision] / N[(0.5 * N[(N[(y * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - -0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.25 \cdot 10^{+76}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{-1}{\frac{\frac{x}{z}}{0.5 \cdot \frac{y \cdot y}{x}}} - -0.5\right)\\
\end{array}
\end{array}
if z < 2.2499999999999999e76Initial program 99.8%
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.8%
Simplified99.8%
Taylor expanded in x around inf
*-lowering-*.f6460.3%
Simplified60.3%
if 2.2499999999999999e76 < z Initial program 99.7%
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.7%
Simplified99.7%
flip-+N/A
div-subN/A
frac-2negN/A
frac-2negN/A
sub-divN/A
/-lowering-/.f64N/A
Applied egg-rr41.2%
Taylor expanded in x around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6420.9%
Simplified20.9%
Taylor expanded in x around -inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
Simplified36.3%
clear-numN/A
/-lowering-/.f64N/A
associate-/l*N/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6438.0%
Applied egg-rr38.0%
Final simplification52.2%
(FPCore (x y z) :precision binary64 (* 0.5 (- x (/ (* y (* y z)) x))))
double code(double x, double y, double z) {
return 0.5 * (x - ((y * (y * z)) / x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 0.5d0 * (x - ((y * (y * z)) / x))
end function
public static double code(double x, double y, double z) {
return 0.5 * (x - ((y * (y * z)) / x));
}
def code(x, y, z): return 0.5 * (x - ((y * (y * z)) / x))
function code(x, y, z) return Float64(0.5 * Float64(x - Float64(Float64(y * Float64(y * z)) / x))) end
function tmp = code(x, y, z) tmp = 0.5 * (x - ((y * (y * z)) / x)); end
code[x_, y_, z_] := N[(0.5 * N[(x - N[(N[(y * N[(y * z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(x - \frac{y \cdot \left(y \cdot z\right)}{x}\right)
\end{array}
Initial program 99.8%
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.8%
Simplified99.8%
flip-+N/A
div-subN/A
frac-2negN/A
frac-2negN/A
sub-divN/A
/-lowering-/.f64N/A
Applied egg-rr47.1%
Taylor expanded in x around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6429.0%
Simplified29.0%
div-subN/A
frac-2negN/A
sub0-negN/A
remove-double-negN/A
clear-numN/A
frac-subN/A
/-lowering-/.f64N/A
Applied egg-rr7.7%
Taylor expanded in x around 0
+-commutativeN/A
mul-1-negN/A
sub-negN/A
div-subN/A
unpow2N/A
associate-/l*N/A
fmsub-defineN/A
*-inversesN/A
fmsub-defineN/A
*-rgt-identityN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6450.3%
Simplified50.3%
(FPCore (x y z) :precision binary64 (* x 0.5))
double code(double x, double y, double z) {
return x * 0.5;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x * 0.5d0
end function
public static double code(double x, double y, double z) {
return x * 0.5;
}
def code(x, y, z): return x * 0.5
function code(x, y, z) return Float64(x * 0.5) end
function tmp = code(x, y, z) tmp = x * 0.5; end
code[x_, y_, z_] := N[(x * 0.5), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5
\end{array}
Initial program 99.8%
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.8%
Simplified99.8%
Taylor expanded in x around inf
*-lowering-*.f6449.7%
Simplified49.7%
Final simplification49.7%
herbie shell --seed 2024150
(FPCore (x y z)
:name "Diagrams.Solve.Polynomial:quadForm from diagrams-solve-0.1, B"
:precision binary64
(* (/ 1.0 2.0) (+ x (* y (sqrt z)))))