
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
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 - x))) / z
end function
public static double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
def code(x, y, z): return (x + (y * (z - x))) / z
function code(x, y, z) return Float64(Float64(x + Float64(y * Float64(z - x))) / z) end
function tmp = code(x, y, z) tmp = (x + (y * (z - x))) / z; end
code[x_, y_, z_] := N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y \cdot \left(z - x\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
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 - x))) / z
end function
public static double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
def code(x, y, z): return (x + (y * (z - x))) / z
function code(x, y, z) return Float64(Float64(x + Float64(y * Float64(z - x))) / z) end
function tmp = code(x, y, z) tmp = (x + (y * (z - x))) / z; end
code[x_, y_, z_] := N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y \cdot \left(z - x\right)}{z}
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= y -3.15e+15) (not (<= y 420000000.0))) (- y (* y (/ x z))) (/ (+ x (* y (- z x))) z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.15e+15) || !(y <= 420000000.0)) {
tmp = y - (y * (x / z));
} else {
tmp = (x + (y * (z - x))) / 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) :: tmp
if ((y <= (-3.15d+15)) .or. (.not. (y <= 420000000.0d0))) then
tmp = y - (y * (x / z))
else
tmp = (x + (y * (z - x))) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3.15e+15) || !(y <= 420000000.0)) {
tmp = y - (y * (x / z));
} else {
tmp = (x + (y * (z - x))) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.15e+15) or not (y <= 420000000.0): tmp = y - (y * (x / z)) else: tmp = (x + (y * (z - x))) / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.15e+15) || !(y <= 420000000.0)) tmp = Float64(y - Float64(y * Float64(x / z))); else tmp = Float64(Float64(x + Float64(y * Float64(z - x))) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.15e+15) || ~((y <= 420000000.0))) tmp = y - (y * (x / z)); else tmp = (x + (y * (z - x))) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.15e+15], N[Not[LessEqual[y, 420000000.0]], $MachinePrecision]], N[(y - N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.15 \cdot 10^{+15} \lor \neg \left(y \leq 420000000\right):\\
\;\;\;\;y - y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\
\end{array}
\end{array}
if y < -3.15e15 or 4.2e8 < y Initial program 77.2%
Taylor expanded in x around inf 93.4%
Taylor expanded in y around inf 93.4%
associate-*r*93.4%
mul-1-neg93.4%
Simplified93.4%
Taylor expanded in y around 0 99.9%
distribute-lft-in99.9%
mul-1-neg99.9%
distribute-rgt-neg-in99.9%
unsub-neg99.9%
*-rgt-identity99.9%
Simplified99.9%
if -3.15e15 < y < 4.2e8Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (/ y z))))
(if (<= y -2.25e-20)
t_0
(if (<= y 2.9e-81)
(/ x z)
(if (<= y 1.45e-46)
y
(if (<= y 7.2e-27) (/ x z) (if (<= y 2.5e+242) t_0 y)))))))
double code(double x, double y, double z) {
double t_0 = z * (y / z);
double tmp;
if (y <= -2.25e-20) {
tmp = t_0;
} else if (y <= 2.9e-81) {
tmp = x / z;
} else if (y <= 1.45e-46) {
tmp = y;
} else if (y <= 7.2e-27) {
tmp = x / z;
} else if (y <= 2.5e+242) {
tmp = t_0;
} else {
tmp = y;
}
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 = z * (y / z)
if (y <= (-2.25d-20)) then
tmp = t_0
else if (y <= 2.9d-81) then
tmp = x / z
else if (y <= 1.45d-46) then
tmp = y
else if (y <= 7.2d-27) then
tmp = x / z
else if (y <= 2.5d+242) then
tmp = t_0
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (y / z);
double tmp;
if (y <= -2.25e-20) {
tmp = t_0;
} else if (y <= 2.9e-81) {
tmp = x / z;
} else if (y <= 1.45e-46) {
tmp = y;
} else if (y <= 7.2e-27) {
tmp = x / z;
} else if (y <= 2.5e+242) {
tmp = t_0;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): t_0 = z * (y / z) tmp = 0 if y <= -2.25e-20: tmp = t_0 elif y <= 2.9e-81: tmp = x / z elif y <= 1.45e-46: tmp = y elif y <= 7.2e-27: tmp = x / z elif y <= 2.5e+242: tmp = t_0 else: tmp = y return tmp
function code(x, y, z) t_0 = Float64(z * Float64(y / z)) tmp = 0.0 if (y <= -2.25e-20) tmp = t_0; elseif (y <= 2.9e-81) tmp = Float64(x / z); elseif (y <= 1.45e-46) tmp = y; elseif (y <= 7.2e-27) tmp = Float64(x / z); elseif (y <= 2.5e+242) tmp = t_0; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (y / z); tmp = 0.0; if (y <= -2.25e-20) tmp = t_0; elseif (y <= 2.9e-81) tmp = x / z; elseif (y <= 1.45e-46) tmp = y; elseif (y <= 7.2e-27) tmp = x / z; elseif (y <= 2.5e+242) tmp = t_0; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.25e-20], t$95$0, If[LessEqual[y, 2.9e-81], N[(x / z), $MachinePrecision], If[LessEqual[y, 1.45e-46], y, If[LessEqual[y, 7.2e-27], N[(x / z), $MachinePrecision], If[LessEqual[y, 2.5e+242], t$95$0, y]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \frac{y}{z}\\
\mathbf{if}\;y \leq -2.25 \cdot 10^{-20}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{-81}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-46}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-27}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+242}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -2.2500000000000001e-20 or 7.1999999999999997e-27 < y < 2.5000000000000002e242Initial program 82.1%
Taylor expanded in z around inf 46.6%
Taylor expanded in x around 0 40.6%
*-commutative40.6%
Simplified40.6%
*-un-lft-identity40.6%
times-frac58.9%
/-rgt-identity58.9%
Applied egg-rr58.9%
if -2.2500000000000001e-20 < y < 2.89999999999999989e-81 or 1.45000000000000002e-46 < y < 7.1999999999999997e-27Initial program 99.9%
Taylor expanded in y around 0 80.0%
if 2.89999999999999989e-81 < y < 1.45000000000000002e-46 or 2.5000000000000002e242 < y Initial program 80.9%
Taylor expanded in x around 0 69.9%
Final simplification69.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.5e+67) (not (<= x 3.9e+40))) (* x (/ (- 1.0 y) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.5e+67) || !(x <= 3.9e+40)) {
tmp = x * ((1.0 - y) / z);
} else {
tmp = y + (x / 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) :: tmp
if ((x <= (-2.5d+67)) .or. (.not. (x <= 3.9d+40))) then
tmp = x * ((1.0d0 - y) / z)
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.5e+67) || !(x <= 3.9e+40)) {
tmp = x * ((1.0 - y) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.5e+67) or not (x <= 3.9e+40): tmp = x * ((1.0 - y) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.5e+67) || !(x <= 3.9e+40)) tmp = Float64(x * Float64(Float64(1.0 - y) / z)); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.5e+67) || ~((x <= 3.9e+40))) tmp = x * ((1.0 - y) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.5e+67], N[Not[LessEqual[x, 3.9e+40]], $MachinePrecision]], N[(x * N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{+67} \lor \neg \left(x \leq 3.9 \cdot 10^{+40}\right):\\
\;\;\;\;x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -2.49999999999999988e67 or 3.9000000000000001e40 < x Initial program 91.3%
Taylor expanded in x around inf 86.0%
associate-/l*87.7%
associate-/r/87.7%
mul-1-neg87.7%
unsub-neg87.7%
Simplified87.7%
if -2.49999999999999988e67 < x < 3.9000000000000001e40Initial program 88.6%
Taylor expanded in z around inf 79.3%
Taylor expanded in x around 0 90.6%
+-commutative90.6%
Simplified90.6%
Final simplification89.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -235000.0) (not (<= y 1.0))) (- y (* y (/ x z))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -235000.0) || !(y <= 1.0)) {
tmp = y - (y * (x / z));
} else {
tmp = y + (x / 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) :: tmp
if ((y <= (-235000.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = y - (y * (x / z))
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -235000.0) || !(y <= 1.0)) {
tmp = y - (y * (x / z));
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -235000.0) or not (y <= 1.0): tmp = y - (y * (x / z)) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -235000.0) || !(y <= 1.0)) tmp = Float64(y - Float64(y * Float64(x / z))); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -235000.0) || ~((y <= 1.0))) tmp = y - (y * (x / z)); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -235000.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(y - N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -235000 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y - y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -235000 or 1 < y Initial program 78.0%
Taylor expanded in x around inf 93.6%
Taylor expanded in y around inf 92.8%
associate-*r*92.8%
mul-1-neg92.8%
Simplified92.8%
Taylor expanded in y around 0 99.1%
distribute-lft-in99.2%
mul-1-neg99.2%
distribute-rgt-neg-in99.2%
unsub-neg99.2%
*-rgt-identity99.2%
Simplified99.2%
if -235000 < y < 1Initial program 100.0%
Taylor expanded in z around inf 99.7%
Taylor expanded in x around 0 99.7%
+-commutative99.7%
Simplified99.7%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (<= y 40000000000.0) (+ y (/ x z)) (if (<= y 2.6e+50) (* x (/ (- y) z)) (- y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 40000000000.0) {
tmp = y + (x / z);
} else if (y <= 2.6e+50) {
tmp = x * (-y / z);
} else {
tmp = y - (x / 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) :: tmp
if (y <= 40000000000.0d0) then
tmp = y + (x / z)
else if (y <= 2.6d+50) then
tmp = x * (-y / z)
else
tmp = y - (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 40000000000.0) {
tmp = y + (x / z);
} else if (y <= 2.6e+50) {
tmp = x * (-y / z);
} else {
tmp = y - (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 40000000000.0: tmp = y + (x / z) elif y <= 2.6e+50: tmp = x * (-y / z) else: tmp = y - (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 40000000000.0) tmp = Float64(y + Float64(x / z)); elseif (y <= 2.6e+50) tmp = Float64(x * Float64(Float64(-y) / z)); else tmp = Float64(y - Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 40000000000.0) tmp = y + (x / z); elseif (y <= 2.6e+50) tmp = x * (-y / z); else tmp = y - (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 40000000000.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6e+50], N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision], N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 40000000000:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+50}:\\
\;\;\;\;x \cdot \frac{-y}{z}\\
\mathbf{else}:\\
\;\;\;\;y - \frac{x}{z}\\
\end{array}
\end{array}
if y < 4e10Initial program 94.4%
Taylor expanded in z around inf 85.3%
Taylor expanded in x around 0 90.9%
+-commutative90.9%
Simplified90.9%
if 4e10 < y < 2.6000000000000002e50Initial program 99.7%
Taylor expanded in x around inf 78.3%
associate-/l*78.2%
associate-/r/78.4%
mul-1-neg78.4%
unsub-neg78.4%
Simplified78.4%
Taylor expanded in y around inf 78.4%
neg-mul-178.4%
distribute-neg-frac78.4%
Simplified78.4%
if 2.6000000000000002e50 < y Initial program 72.4%
Taylor expanded in z around inf 37.6%
Taylor expanded in x around 0 60.4%
+-commutative60.4%
Simplified60.4%
+-commutative60.4%
add-cube-cbrt59.1%
fma-def59.1%
frac-2neg59.1%
distribute-frac-neg59.1%
add-sqr-sqrt27.3%
sqrt-unprod61.4%
sqr-neg61.4%
sqrt-unprod34.4%
add-sqr-sqrt65.5%
fma-neg65.5%
add-cube-cbrt66.8%
Applied egg-rr66.8%
Final simplification84.9%
(FPCore (x y z) :precision binary64 (+ y (/ (* (- 1.0 y) x) z)))
double code(double x, double y, double z) {
return y + (((1.0 - y) * x) / z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y + (((1.0d0 - y) * x) / z)
end function
public static double code(double x, double y, double z) {
return y + (((1.0 - y) * x) / z);
}
def code(x, y, z): return y + (((1.0 - y) * x) / z)
function code(x, y, z) return Float64(y + Float64(Float64(Float64(1.0 - y) * x) / z)) end
function tmp = code(x, y, z) tmp = y + (((1.0 - y) * x) / z); end
code[x_, y_, z_] := N[(y + N[(N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y + \frac{\left(1 - y\right) \cdot x}{z}
\end{array}
Initial program 89.7%
Taylor expanded in x around inf 97.0%
Final simplification97.0%
(FPCore (x y z) :precision binary64 (if (<= y -3.8e-22) y (if (<= y 2.8e-81) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.8e-22) {
tmp = y;
} else if (y <= 2.8e-81) {
tmp = x / z;
} else {
tmp = y;
}
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 (y <= (-3.8d-22)) then
tmp = y
else if (y <= 2.8d-81) then
tmp = x / z
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.8e-22) {
tmp = y;
} else if (y <= 2.8e-81) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.8e-22: tmp = y elif y <= 2.8e-81: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.8e-22) tmp = y; elseif (y <= 2.8e-81) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.8e-22) tmp = y; elseif (y <= 2.8e-81) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.8e-22], y, If[LessEqual[y, 2.8e-81], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{-22}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{-81}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -3.80000000000000023e-22 or 2.7999999999999999e-81 < y Initial program 82.7%
Taylor expanded in x around 0 57.4%
if -3.80000000000000023e-22 < y < 2.7999999999999999e-81Initial program 99.9%
Taylor expanded in y around 0 80.4%
Final simplification66.6%
(FPCore (x y z) :precision binary64 (if (<= y 1.0) (+ y (/ x z)) (- y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = y - (x / 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) :: tmp
if (y <= 1.0d0) then
tmp = y + (x / z)
else
tmp = y - (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = y - (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.0: tmp = y + (x / z) else: tmp = y - (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.0) tmp = Float64(y + Float64(x / z)); else tmp = Float64(y - Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.0) tmp = y + (x / z); else tmp = y - (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y - \frac{x}{z}\\
\end{array}
\end{array}
if y < 1Initial program 94.3%
Taylor expanded in z around inf 85.6%
Taylor expanded in x around 0 91.3%
+-commutative91.3%
Simplified91.3%
if 1 < y Initial program 78.0%
Taylor expanded in z around inf 35.6%
Taylor expanded in x around 0 53.8%
+-commutative53.8%
Simplified53.8%
+-commutative53.8%
add-cube-cbrt52.6%
fma-def52.6%
frac-2neg52.6%
distribute-frac-neg52.6%
add-sqr-sqrt25.8%
sqrt-unprod56.5%
sqr-neg56.5%
sqrt-unprod31.0%
add-sqr-sqrt60.1%
fma-neg60.1%
add-cube-cbrt61.2%
Applied egg-rr61.2%
Final simplification82.7%
(FPCore (x y z) :precision binary64 (+ y (/ x z)))
double code(double x, double y, double z) {
return y + (x / z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y + (x / z)
end function
public static double code(double x, double y, double z) {
return y + (x / z);
}
def code(x, y, z): return y + (x / z)
function code(x, y, z) return Float64(y + Float64(x / z)) end
function tmp = code(x, y, z) tmp = y + (x / z); end
code[x_, y_, z_] := N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y + \frac{x}{z}
\end{array}
Initial program 89.7%
Taylor expanded in z around inf 71.4%
Taylor expanded in x around 0 80.6%
+-commutative80.6%
Simplified80.6%
Final simplification80.6%
(FPCore (x y z) :precision binary64 y)
double code(double x, double y, double z) {
return y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y
end function
public static double code(double x, double y, double z) {
return y;
}
def code(x, y, z): return y
function code(x, y, z) return y end
function tmp = code(x, y, z) tmp = y; end
code[x_, y_, z_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 89.7%
Taylor expanded in x around 0 43.2%
Final simplification43.2%
(FPCore (x y z) :precision binary64 (- (+ y (/ x z)) (/ y (/ z x))))
double code(double x, double y, double z) {
return (y + (x / z)) - (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 = (y + (x / z)) - (y / (z / x))
end function
public static double code(double x, double y, double z) {
return (y + (x / z)) - (y / (z / x));
}
def code(x, y, z): return (y + (x / z)) - (y / (z / x))
function code(x, y, z) return Float64(Float64(y + Float64(x / z)) - Float64(y / Float64(z / x))) end
function tmp = code(x, y, z) tmp = (y + (x / z)) - (y / (z / x)); end
code[x_, y_, z_] := N[(N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision] - N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y + \frac{x}{z}\right) - \frac{y}{\frac{z}{x}}
\end{array}
herbie shell --seed 2023185
(FPCore (x y z)
:name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
:precision binary64
:herbie-target
(- (+ y (/ x z)) (/ y (/ z x)))
(/ (+ x (* y (- z x))) z))