
(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 9 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 (+ y (* (/ x z) (- 1.0 y))))
double code(double x, double y, double z) {
return y + ((x / z) * (1.0 - 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 + ((x / z) * (1.0d0 - y))
end function
public static double code(double x, double y, double z) {
return y + ((x / z) * (1.0 - y));
}
def code(x, y, z): return y + ((x / z) * (1.0 - y))
function code(x, y, z) return Float64(y + Float64(Float64(x / z) * Float64(1.0 - y))) end
function tmp = code(x, y, z) tmp = y + ((x / z) * (1.0 - y)); end
code[x_, y_, z_] := N[(y + N[(N[(x / z), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y + \frac{x}{z} \cdot \left(1 - y\right)
\end{array}
Initial program 90.4%
Taylor expanded in x around -inf 97.7%
mul-1-neg97.7%
unsub-neg97.7%
associate-/l*95.1%
associate-/r/99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ y (/ x z))))
(if (<= z -2.7e-40)
t_0
(if (<= z 9e-62)
(* (/ x z) (- 1.0 y))
(if (or (<= z 6.5e-10) (not (<= z 1.7e+54)))
t_0
(* x (/ (- 1.0 y) z)))))))
double code(double x, double y, double z) {
double t_0 = y + (x / z);
double tmp;
if (z <= -2.7e-40) {
tmp = t_0;
} else if (z <= 9e-62) {
tmp = (x / z) * (1.0 - y);
} else if ((z <= 6.5e-10) || !(z <= 1.7e+54)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = y + (x / z)
if (z <= (-2.7d-40)) then
tmp = t_0
else if (z <= 9d-62) then
tmp = (x / z) * (1.0d0 - y)
else if ((z <= 6.5d-10) .or. (.not. (z <= 1.7d+54))) then
tmp = t_0
else
tmp = x * ((1.0d0 - y) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y + (x / z);
double tmp;
if (z <= -2.7e-40) {
tmp = t_0;
} else if (z <= 9e-62) {
tmp = (x / z) * (1.0 - y);
} else if ((z <= 6.5e-10) || !(z <= 1.7e+54)) {
tmp = t_0;
} else {
tmp = x * ((1.0 - y) / z);
}
return tmp;
}
def code(x, y, z): t_0 = y + (x / z) tmp = 0 if z <= -2.7e-40: tmp = t_0 elif z <= 9e-62: tmp = (x / z) * (1.0 - y) elif (z <= 6.5e-10) or not (z <= 1.7e+54): tmp = t_0 else: tmp = x * ((1.0 - y) / z) return tmp
function code(x, y, z) t_0 = Float64(y + Float64(x / z)) tmp = 0.0 if (z <= -2.7e-40) tmp = t_0; elseif (z <= 9e-62) tmp = Float64(Float64(x / z) * Float64(1.0 - y)); elseif ((z <= 6.5e-10) || !(z <= 1.7e+54)) tmp = t_0; else tmp = Float64(x * Float64(Float64(1.0 - y) / z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y + (x / z); tmp = 0.0; if (z <= -2.7e-40) tmp = t_0; elseif (z <= 9e-62) tmp = (x / z) * (1.0 - y); elseif ((z <= 6.5e-10) || ~((z <= 1.7e+54))) tmp = t_0; else tmp = x * ((1.0 - y) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.7e-40], t$95$0, If[LessEqual[z, 9e-62], N[(N[(x / z), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 6.5e-10], N[Not[LessEqual[z, 1.7e+54]], $MachinePrecision]], t$95$0, N[(x * N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + \frac{x}{z}\\
\mathbf{if}\;z \leq -2.7 \cdot 10^{-40}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-62}:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 - y\right)\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-10} \lor \neg \left(z \leq 1.7 \cdot 10^{+54}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1 - y}{z}\\
\end{array}
\end{array}
if z < -2.7e-40 or 9.00000000000000036e-62 < z < 6.5000000000000003e-10 or 1.7e54 < z Initial program 81.7%
Taylor expanded in x around -inf 95.8%
mul-1-neg95.8%
unsub-neg95.8%
associate-/l*99.2%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 91.3%
mul-1-neg91.3%
distribute-frac-neg91.3%
Simplified91.3%
if -2.7e-40 < z < 9.00000000000000036e-62Initial program 99.8%
Taylor expanded in x around inf 93.1%
associate-/l*88.2%
associate-/r/93.1%
mul-1-neg93.1%
unsub-neg93.1%
Simplified93.1%
if 6.5000000000000003e-10 < z < 1.7e54Initial program 100.0%
Taylor expanded in x around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
associate-/l*99.8%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
sub-neg100.0%
distribute-rgt-in100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
neg-mul-1100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-out100.0%
associate-*l/100.0%
associate-*r/100.0%
distribute-rgt-in100.0%
+-commutative100.0%
associate-*l/100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*r/100.0%
distribute-neg-in100.0%
metadata-eval100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification92.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -6.8e+50) (not (<= x 8.5e+24))) (* x (/ (- 1.0 y) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -6.8e+50) || !(x <= 8.5e+24)) {
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 <= (-6.8d+50)) .or. (.not. (x <= 8.5d+24))) 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 <= -6.8e+50) || !(x <= 8.5e+24)) {
tmp = x * ((1.0 - y) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -6.8e+50) or not (x <= 8.5e+24): tmp = x * ((1.0 - y) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -6.8e+50) || !(x <= 8.5e+24)) 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 <= -6.8e+50) || ~((x <= 8.5e+24))) tmp = x * ((1.0 - y) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -6.8e+50], N[Not[LessEqual[x, 8.5e+24]], $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 -6.8 \cdot 10^{+50} \lor \neg \left(x \leq 8.5 \cdot 10^{+24}\right):\\
\;\;\;\;x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -6.7999999999999997e50 or 8.49999999999999959e24 < x Initial program 94.6%
Taylor expanded in x around -inf 94.7%
mul-1-neg94.7%
unsub-neg94.7%
associate-/l*100.0%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 92.6%
sub-neg92.6%
distribute-rgt-in86.1%
associate-*l/86.2%
*-lft-identity86.2%
remove-double-neg86.2%
distribute-frac-neg86.2%
neg-mul-186.2%
distribute-lft-neg-in86.2%
distribute-rgt-neg-out86.2%
associate-*l/84.4%
associate-*r/76.8%
distribute-rgt-in92.8%
+-commutative92.8%
associate-*l/91.0%
distribute-lft-neg-in91.0%
distribute-rgt-neg-in91.0%
associate-*r/92.6%
distribute-neg-in92.6%
metadata-eval92.6%
+-commutative92.6%
unsub-neg92.6%
Simplified92.6%
if -6.7999999999999997e50 < x < 8.49999999999999959e24Initial program 87.3%
Taylor expanded in x around -inf 99.9%
mul-1-neg99.9%
unsub-neg99.9%
associate-/l*91.7%
associate-/r/99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 85.5%
mul-1-neg85.5%
distribute-frac-neg85.5%
Simplified85.5%
Final simplification88.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.0) (not (<= y 0.0152))) (* (/ y z) (- z x)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 0.0152)) {
tmp = (y / z) * (z - x);
} 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)) .or. (.not. (y <= 0.0152d0))) then
tmp = (y / z) * (z - x)
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) || !(y <= 0.0152)) {
tmp = (y / z) * (z - x);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.0) or not (y <= 0.0152): tmp = (y / z) * (z - x) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.0) || !(y <= 0.0152)) tmp = Float64(Float64(y / z) * Float64(z - x)); 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) || ~((y <= 0.0152))) tmp = (y / z) * (z - x); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 0.0152]], $MachinePrecision]], N[(N[(y / z), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 0.0152\right):\\
\;\;\;\;\frac{y}{z} \cdot \left(z - x\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -1 or 0.0152 < y Initial program 78.8%
Taylor expanded in y around inf 77.4%
associate-/l*98.4%
associate-/r/86.5%
Simplified86.5%
if -1 < y < 0.0152Initial program 99.9%
Taylor expanded in x around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
associate-/l*100.0%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.5%
mul-1-neg98.5%
distribute-frac-neg98.5%
Simplified98.5%
Final simplification93.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.0) (not (<= y 0.00012))) (- y (/ (* y x) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 0.00012)) {
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 <= (-1.0d0)) .or. (.not. (y <= 0.00012d0))) 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 <= -1.0) || !(y <= 0.00012)) {
tmp = y - ((y * x) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.0) or not (y <= 0.00012): tmp = y - ((y * x) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.0) || !(y <= 0.00012)) tmp = Float64(y - Float64(Float64(y * 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) || ~((y <= 0.00012))) tmp = y - ((y * x) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 0.00012]], $MachinePrecision]], N[(y - N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 0.00012\right):\\
\;\;\;\;y - \frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -1 or 1.20000000000000003e-4 < y Initial program 79.3%
Taylor expanded in x around -inf 95.2%
mul-1-neg95.2%
unsub-neg95.2%
associate-/l*89.5%
associate-/r/99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 93.8%
if -1 < y < 1.20000000000000003e-4Initial program 99.9%
Taylor expanded in x around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
associate-/l*100.0%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.4%
mul-1-neg98.4%
distribute-frac-neg98.4%
Simplified98.4%
Final simplification96.3%
(FPCore (x y z) :precision binary64 (if (<= y 3.3e+69) (+ y (/ x z)) (/ (* y (- x)) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.3e+69) {
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 <= 3.3d+69) 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 <= 3.3e+69) {
tmp = y + (x / z);
} else {
tmp = (y * -x) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.3e+69: tmp = y + (x / z) else: tmp = (y * -x) / z return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.3e+69) tmp = Float64(y + Float64(x / z)); else tmp = Float64(Float64(y * Float64(-x)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.3e+69) tmp = y + (x / z); else tmp = (y * -x) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.3e+69], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(y * (-x)), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.3 \cdot 10^{+69}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(-x\right)}{z}\\
\end{array}
\end{array}
if y < 3.2999999999999999e69Initial program 93.3%
Taylor expanded in x around -inf 98.2%
mul-1-neg98.2%
unsub-neg98.2%
associate-/l*96.5%
associate-/r/99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 86.3%
mul-1-neg86.3%
distribute-frac-neg86.3%
Simplified86.3%
if 3.2999999999999999e69 < y Initial program 75.6%
Taylor expanded in y around inf 75.6%
Taylor expanded in z around 0 56.4%
mul-1-neg56.4%
distribute-lft-neg-out56.4%
*-commutative56.4%
Simplified56.4%
Final simplification81.4%
(FPCore (x y z) :precision binary64 (if (<= z -1.35e-7) y (if (<= z 1.85e+119) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.35e-7) {
tmp = y;
} else if (z <= 1.85e+119) {
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 (z <= (-1.35d-7)) then
tmp = y
else if (z <= 1.85d+119) 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 (z <= -1.35e-7) {
tmp = y;
} else if (z <= 1.85e+119) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.35e-7: tmp = y elif z <= 1.85e+119: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.35e-7) tmp = y; elseif (z <= 1.85e+119) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.35e-7) tmp = y; elseif (z <= 1.85e+119) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.35e-7], y, If[LessEqual[z, 1.85e+119], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{-7}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+119}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if z < -1.35000000000000004e-7 or 1.85e119 < z Initial program 76.7%
Taylor expanded in x around 0 70.7%
if -1.35000000000000004e-7 < z < 1.85e119Initial program 99.9%
Taylor expanded in y around 0 59.6%
Final simplification64.1%
(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 90.4%
Taylor expanded in x around -inf 97.7%
mul-1-neg97.7%
unsub-neg97.7%
associate-/l*95.1%
associate-/r/99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 79.8%
mul-1-neg79.8%
distribute-frac-neg79.8%
Simplified79.8%
Final simplification79.8%
(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 90.4%
Taylor expanded in x around 0 37.8%
Final simplification37.8%
(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 2024010
(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))