
(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 (<= y 2e+31) (+ y (* x (/ (- 1.0 y) z))) (- y (* y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2e+31) {
tmp = y + (x * ((1.0 - y) / z));
} else {
tmp = y - (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 <= 2d+31) then
tmp = y + (x * ((1.0d0 - y) / z))
else
tmp = y - (y * (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2e+31) {
tmp = y + (x * ((1.0 - y) / z));
} else {
tmp = y - (y * (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2e+31: tmp = y + (x * ((1.0 - y) / z)) else: tmp = y - (y * (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2e+31) tmp = Float64(y + Float64(x * Float64(Float64(1.0 - y) / z))); else tmp = Float64(y - Float64(y * Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2e+31) tmp = y + (x * ((1.0 - y) / z)); else tmp = y - (y * (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2e+31], N[(y + N[(x * N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y - N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{+31}:\\
\;\;\;\;y + x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;y - y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < 1.9999999999999999e31Initial program 91.6%
add-cube-cbrt91.0%
pow391.0%
Applied egg-rr91.0%
Taylor expanded in x around 0 98.4%
neg-mul-198.4%
+-commutative98.4%
sub-neg98.4%
div-sub98.4%
Simplified98.4%
if 1.9999999999999999e31 < y Initial program 76.9%
Taylor expanded in y around inf 76.9%
associate-/l*99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in x around 0 85.6%
mul-1-neg85.6%
associate-*l/99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
distribute-neg-frac299.9%
Simplified99.9%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -78000000000000.0) (not (<= y 1.0))) (* y (- 1.0 (/ x z))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -78000000000000.0) || !(y <= 1.0)) {
tmp = y * (1.0 - (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 <= (-78000000000000.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = y * (1.0d0 - (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 <= -78000000000000.0) || !(y <= 1.0)) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -78000000000000.0) or not (y <= 1.0): tmp = y * (1.0 - (x / z)) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -78000000000000.0) || !(y <= 1.0)) tmp = Float64(y * Float64(1.0 - 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 <= -78000000000000.0) || ~((y <= 1.0))) tmp = y * (1.0 - (x / z)); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -78000000000000.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -78000000000000 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -7.8e13 or 1 < y Initial program 75.5%
Taylor expanded in y around inf 73.4%
associate-/l*97.7%
div-sub97.8%
*-inverses97.8%
Simplified97.8%
if -7.8e13 < y < 1Initial program 99.9%
add-cube-cbrt99.4%
pow399.4%
Applied egg-rr99.4%
Taylor expanded in x around 0 99.7%
neg-mul-199.7%
+-commutative99.7%
sub-neg99.7%
div-sub99.7%
Simplified99.7%
Taylor expanded in y around 0 99.0%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.8e-63) (not (<= z 6.2e+86))) (+ y (/ x z)) (* x (/ (- 1.0 y) z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.8e-63) || !(z <= 6.2e+86)) {
tmp = y + (x / z);
} else {
tmp = x * ((1.0 - y) / 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 ((z <= (-3.8d-63)) .or. (.not. (z <= 6.2d+86))) then
tmp = y + (x / z)
else
tmp = x * ((1.0d0 - y) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -3.8e-63) || !(z <= 6.2e+86)) {
tmp = y + (x / z);
} else {
tmp = x * ((1.0 - y) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.8e-63) or not (z <= 6.2e+86): tmp = y + (x / z) else: tmp = x * ((1.0 - y) / z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.8e-63) || !(z <= 6.2e+86)) tmp = Float64(y + Float64(x / z)); else tmp = Float64(x * Float64(Float64(1.0 - y) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.8e-63) || ~((z <= 6.2e+86))) tmp = y + (x / z); else tmp = x * ((1.0 - y) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.8e-63], N[Not[LessEqual[z, 6.2e+86]], $MachinePrecision]], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-63} \lor \neg \left(z \leq 6.2 \cdot 10^{+86}\right):\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1 - y}{z}\\
\end{array}
\end{array}
if z < -3.80000000000000017e-63 or 6.2000000000000004e86 < z Initial program 78.2%
add-cube-cbrt77.4%
pow377.4%
Applied egg-rr77.4%
Taylor expanded in x around 0 99.8%
neg-mul-199.8%
+-commutative99.8%
sub-neg99.8%
div-sub99.8%
Simplified99.8%
Taylor expanded in y around 0 85.6%
if -3.80000000000000017e-63 < z < 6.2000000000000004e86Initial program 98.5%
Taylor expanded in x around inf 86.5%
associate-/l*83.4%
mul-1-neg83.4%
unsub-neg83.4%
Simplified83.4%
Final simplification84.5%
(FPCore (x y z) :precision binary64 (if (<= y -78000000000000.0) (* y (- 1.0 (/ x z))) (if (<= y 1.0) (+ y (/ x z)) (- y (* y (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -78000000000000.0) {
tmp = y * (1.0 - (x / z));
} else if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = y - (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 <= (-78000000000000.0d0)) then
tmp = y * (1.0d0 - (x / z))
else if (y <= 1.0d0) then
tmp = y + (x / z)
else
tmp = y - (y * (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -78000000000000.0) {
tmp = y * (1.0 - (x / z));
} else if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = y - (y * (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -78000000000000.0: tmp = y * (1.0 - (x / z)) elif y <= 1.0: tmp = y + (x / z) else: tmp = y - (y * (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -78000000000000.0) tmp = Float64(y * Float64(1.0 - Float64(x / z))); elseif (y <= 1.0) tmp = Float64(y + Float64(x / z)); else tmp = Float64(y - Float64(y * Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -78000000000000.0) tmp = y * (1.0 - (x / z)); elseif (y <= 1.0) tmp = y + (x / z); else tmp = y - (y * (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -78000000000000.0], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y - N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -78000000000000:\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y - y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -7.8e13Initial program 70.9%
Taylor expanded in y around inf 70.9%
associate-/l*99.8%
div-sub99.8%
*-inverses99.8%
Simplified99.8%
if -7.8e13 < y < 1Initial program 99.9%
add-cube-cbrt99.4%
pow399.4%
Applied egg-rr99.4%
Taylor expanded in x around 0 99.7%
neg-mul-199.7%
+-commutative99.7%
sub-neg99.7%
div-sub99.7%
Simplified99.7%
Taylor expanded in y around 0 99.0%
if 1 < y Initial program 79.8%
Taylor expanded in y around inf 75.8%
associate-/l*95.8%
div-sub95.8%
*-inverses95.8%
Simplified95.8%
Taylor expanded in x around 0 83.4%
mul-1-neg83.4%
associate-*l/95.8%
*-commutative95.8%
distribute-rgt-neg-in95.8%
distribute-neg-frac295.8%
Simplified95.8%
Final simplification98.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.3e+174) (not (<= y 10.6))) (* y (/ x (- z))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.3e+174) || !(y <= 10.6)) {
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.3d+174)) .or. (.not. (y <= 10.6d0))) 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.3e+174) || !(y <= 10.6)) {
tmp = y * (x / -z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.3e+174) or not (y <= 10.6): tmp = y * (x / -z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.3e+174) || !(y <= 10.6)) tmp = Float64(y * Float64(x / Float64(-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.3e+174) || ~((y <= 10.6))) tmp = y * (x / -z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.3e+174], N[Not[LessEqual[y, 10.6]], $MachinePrecision]], 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.3 \cdot 10^{+174} \lor \neg \left(y \leq 10.6\right):\\
\;\;\;\;y \cdot \frac{x}{-z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -1.2999999999999999e174 or 10.5999999999999996 < y Initial program 75.0%
Taylor expanded in x around inf 59.0%
associate-/l*58.7%
mul-1-neg58.7%
unsub-neg58.7%
Simplified58.7%
Taylor expanded in y around inf 56.5%
neg-mul-156.5%
distribute-neg-frac56.5%
Simplified56.5%
Taylor expanded in x around 0 56.8%
mul-1-neg56.8%
distribute-neg-frac256.8%
*-commutative56.8%
associate-*r/62.2%
Simplified62.2%
if -1.2999999999999999e174 < y < 10.5999999999999996Initial program 95.4%
add-cube-cbrt94.8%
pow394.8%
Applied egg-rr94.8%
Taylor expanded in x around 0 99.2%
neg-mul-199.2%
+-commutative99.2%
sub-neg99.2%
div-sub99.2%
Simplified99.2%
Taylor expanded in y around 0 91.7%
Final simplification81.8%
(FPCore (x y z) :precision binary64 (if (<= y -6.2e-60) y (if (<= y 6e-38) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -6.2e-60) {
tmp = y;
} else if (y <= 6e-38) {
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 <= (-6.2d-60)) then
tmp = y
else if (y <= 6d-38) 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 <= -6.2e-60) {
tmp = y;
} else if (y <= 6e-38) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6.2e-60: tmp = y elif y <= 6e-38: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6.2e-60) tmp = y; elseif (y <= 6e-38) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -6.2e-60) tmp = y; elseif (y <= 6e-38) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6.2e-60], y, If[LessEqual[y, 6e-38], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{-60}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-38}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -6.19999999999999976e-60 or 5.99999999999999977e-38 < y Initial program 79.1%
Taylor expanded in x around 0 43.0%
if -6.19999999999999976e-60 < y < 5.99999999999999977e-38Initial program 99.9%
Taylor expanded in y around 0 78.2%
(FPCore (x y z) :precision binary64 (if (<= y 1.15e+107) (+ y (/ x z)) (* x (/ y (- z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.15e+107) {
tmp = y + (x / z);
} else {
tmp = x * (y / -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.15d+107) then
tmp = y + (x / z)
else
tmp = x * (y / -z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.15e+107) {
tmp = y + (x / z);
} else {
tmp = x * (y / -z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.15e+107: tmp = y + (x / z) else: tmp = x * (y / -z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.15e+107) tmp = Float64(y + Float64(x / z)); else tmp = Float64(x * Float64(y / Float64(-z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.15e+107) tmp = y + (x / z); else tmp = x * (y / -z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.15e+107], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / (-z)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.15 \cdot 10^{+107}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{-z}\\
\end{array}
\end{array}
if y < 1.15e107Initial program 90.8%
add-cube-cbrt90.2%
pow390.2%
Applied egg-rr90.2%
Taylor expanded in x around 0 97.2%
neg-mul-197.2%
+-commutative97.2%
sub-neg97.2%
div-sub97.2%
Simplified97.2%
Taylor expanded in y around 0 81.2%
if 1.15e107 < y Initial program 76.0%
Taylor expanded in x around inf 63.7%
associate-/l*63.4%
mul-1-neg63.4%
unsub-neg63.4%
Simplified63.4%
Taylor expanded in y around inf 63.4%
neg-mul-163.4%
distribute-neg-frac63.4%
Simplified63.4%
Final simplification78.5%
(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 91.3%
add-cube-cbrt90.7%
pow390.7%
Applied egg-rr90.7%
Taylor expanded in x around 0 98.3%
neg-mul-198.3%
+-commutative98.3%
sub-neg98.3%
div-sub98.3%
Simplified98.3%
Taylor expanded in y around 0 85.9%
if 1 < y Initial program 79.8%
add-cube-cbrt79.2%
pow379.2%
Applied egg-rr79.2%
Taylor expanded in x around 0 90.7%
neg-mul-190.7%
+-commutative90.7%
sub-neg90.7%
div-sub90.7%
Simplified90.7%
Taylor expanded in y around 0 34.0%
add-sqr-sqrt14.3%
sqrt-unprod40.4%
sqr-neg40.4%
sqrt-unprod22.2%
add-sqr-sqrt47.3%
distribute-frac-neg247.3%
sub-neg47.3%
Applied egg-rr47.3%
(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 88.6%
add-cube-cbrt88.0%
pow388.0%
Applied egg-rr88.0%
Taylor expanded in x around 0 96.5%
neg-mul-196.5%
+-commutative96.5%
sub-neg96.5%
div-sub96.5%
Simplified96.5%
Taylor expanded in y around 0 73.5%
(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 88.6%
Taylor expanded in x around 0 34.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 2024181
(FPCore (x y z)
:name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
:precision binary64
:alt
(! :herbie-platform default (- (+ y (/ x z)) (/ y (/ z x))))
(/ (+ x (* y (- z x))) z))