
(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 (- y (* (/ x z) (+ y -1.0))))
double code(double x, double y, double z) {
return y - ((x / z) * (y + -1.0));
}
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 + (-1.0d0)))
end function
public static double code(double x, double y, double z) {
return y - ((x / z) * (y + -1.0));
}
def code(x, y, z): return y - ((x / z) * (y + -1.0))
function code(x, y, z) return Float64(y - Float64(Float64(x / z) * Float64(y + -1.0))) end
function tmp = code(x, y, z) tmp = y - ((x / z) * (y + -1.0)); end
code[x_, y_, z_] := N[(y - N[(N[(x / z), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y - \frac{x}{z} \cdot \left(y + -1\right)
\end{array}
Initial program 85.3%
Taylor expanded in x around -inf 95.2%
mul-1-neg95.2%
unsub-neg95.2%
associate-/l*96.3%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (if (<= y 1.2e+102) (+ y (/ x z)) (if (or (<= y 5.6e+235) (not (<= y 7.8e+275))) (/ (- y) (/ z x)) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.2e+102) {
tmp = y + (x / z);
} else if ((y <= 5.6e+235) || !(y <= 7.8e+275)) {
tmp = -y / (z / x);
} 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 <= 1.2d+102) then
tmp = y + (x / z)
else if ((y <= 5.6d+235) .or. (.not. (y <= 7.8d+275))) then
tmp = -y / (z / x)
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.2e+102) {
tmp = y + (x / z);
} else if ((y <= 5.6e+235) || !(y <= 7.8e+275)) {
tmp = -y / (z / x);
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.2e+102: tmp = y + (x / z) elif (y <= 5.6e+235) or not (y <= 7.8e+275): tmp = -y / (z / x) else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.2e+102) tmp = Float64(y + Float64(x / z)); elseif ((y <= 5.6e+235) || !(y <= 7.8e+275)) tmp = Float64(Float64(-y) / Float64(z / x)); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.2e+102) tmp = y + (x / z); elseif ((y <= 5.6e+235) || ~((y <= 7.8e+275))) tmp = -y / (z / x); else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.2e+102], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 5.6e+235], N[Not[LessEqual[y, 7.8e+275]], $MachinePrecision]], N[((-y) / N[(z / x), $MachinePrecision]), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.2 \cdot 10^{+102}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{+235} \lor \neg \left(y \leq 7.8 \cdot 10^{+275}\right):\\
\;\;\;\;\frac{-y}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < 1.19999999999999997e102Initial program 86.2%
Taylor expanded in x around -inf 95.6%
mul-1-neg95.6%
unsub-neg95.6%
associate-/l*96.9%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 84.4%
mul-1-neg84.4%
distribute-frac-neg84.4%
Simplified84.4%
Taylor expanded in y around 0 84.4%
+-commutative84.4%
Simplified84.4%
if 1.19999999999999997e102 < y < 5.60000000000000052e235 or 7.8e275 < y Initial program 86.8%
Taylor expanded in y around inf 86.8%
associate-/l*99.9%
associate-/r/92.1%
Simplified92.1%
Taylor expanded in z around 0 67.7%
mul-1-neg67.7%
associate-*r/63.4%
distribute-rgt-neg-in63.4%
Simplified63.4%
distribute-rgt-neg-out63.4%
clear-num63.4%
div-inv63.4%
associate-/r/71.2%
add-sqr-sqrt40.5%
sqrt-unprod40.0%
sqr-neg40.0%
sqrt-unprod0.3%
add-sqr-sqrt0.8%
*-commutative0.8%
clear-num0.8%
un-div-inv0.8%
add-sqr-sqrt0.3%
sqrt-unprod39.9%
sqr-neg39.9%
sqrt-unprod40.4%
add-sqr-sqrt71.1%
Applied egg-rr71.1%
if 5.60000000000000052e235 < y < 7.8e275Initial program 58.6%
Taylor expanded in x around 0 78.7%
Final simplification82.3%
(FPCore (x y z)
:precision binary64
(if (<= y 6.5e+99)
(+ y (/ x z))
(if (<= y 3.75e+233)
(* y (/ x (- z)))
(if (<= y 1.55e+274) y (/ (- y) (/ z x))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 6.5e+99) {
tmp = y + (x / z);
} else if (y <= 3.75e+233) {
tmp = y * (x / -z);
} else if (y <= 1.55e+274) {
tmp = y;
} else {
tmp = -y / (z / x);
}
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.5d+99) then
tmp = y + (x / z)
else if (y <= 3.75d+233) then
tmp = y * (x / -z)
else if (y <= 1.55d+274) then
tmp = y
else
tmp = -y / (z / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 6.5e+99) {
tmp = y + (x / z);
} else if (y <= 3.75e+233) {
tmp = y * (x / -z);
} else if (y <= 1.55e+274) {
tmp = y;
} else {
tmp = -y / (z / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 6.5e+99: tmp = y + (x / z) elif y <= 3.75e+233: tmp = y * (x / -z) elif y <= 1.55e+274: tmp = y else: tmp = -y / (z / x) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 6.5e+99) tmp = Float64(y + Float64(x / z)); elseif (y <= 3.75e+233) tmp = Float64(y * Float64(x / Float64(-z))); elseif (y <= 1.55e+274) tmp = y; else tmp = Float64(Float64(-y) / Float64(z / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 6.5e+99) tmp = y + (x / z); elseif (y <= 3.75e+233) tmp = y * (x / -z); elseif (y <= 1.55e+274) tmp = y; else tmp = -y / (z / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 6.5e+99], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.75e+233], N[(y * N[(x / (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.55e+274], y, N[((-y) / N[(z / x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.5 \cdot 10^{+99}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 3.75 \cdot 10^{+233}:\\
\;\;\;\;y \cdot \frac{x}{-z}\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{+274}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;\frac{-y}{\frac{z}{x}}\\
\end{array}
\end{array}
if y < 6.5000000000000004e99Initial program 86.2%
Taylor expanded in x around -inf 95.6%
mul-1-neg95.6%
unsub-neg95.6%
associate-/l*96.9%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 84.4%
mul-1-neg84.4%
distribute-frac-neg84.4%
Simplified84.4%
Taylor expanded in y around 0 84.4%
+-commutative84.4%
Simplified84.4%
if 6.5000000000000004e99 < y < 3.7499999999999998e233Initial program 85.1%
Taylor expanded in y around inf 85.1%
associate-/l*99.9%
associate-/r/91.1%
Simplified91.1%
Taylor expanded in z around 0 63.6%
mul-1-neg63.6%
associate-*r/58.9%
distribute-rgt-neg-in58.9%
Simplified58.9%
Taylor expanded in x around 0 63.6%
associate-*r/63.6%
neg-mul-163.6%
distribute-rgt-neg-out63.6%
associate-/l*58.8%
Simplified58.8%
Taylor expanded in x around 0 63.6%
associate-*r/63.6%
associate-*l/63.6%
metadata-eval63.6%
associate-/r*63.6%
neg-mul-163.6%
associate-*l/63.6%
*-lft-identity63.6%
*-commutative63.6%
associate-*r/67.6%
Simplified67.6%
if 3.7499999999999998e233 < y < 1.55e274Initial program 58.6%
Taylor expanded in x around 0 78.7%
if 1.55e274 < y Initial program 100.0%
Taylor expanded in y around inf 100.0%
associate-/l*100.0%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around 0 100.0%
mul-1-neg100.0%
associate-*r/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
distribute-rgt-neg-out100.0%
clear-num100.0%
div-inv100.0%
associate-/r/100.0%
add-sqr-sqrt75.0%
sqrt-unprod75.0%
sqr-neg75.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
*-commutative0.0%
clear-num0.0%
un-div-inv0.0%
add-sqr-sqrt0.0%
sqrt-unprod75.0%
sqr-neg75.0%
sqrt-unprod75.0%
add-sqr-sqrt100.0%
Applied egg-rr100.0%
Final simplification82.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -7.1e-84) (not (<= z 2.22e+18))) (+ y (/ x z)) (* (/ x z) (- 1.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7.1e-84) || !(z <= 2.22e+18)) {
tmp = y + (x / z);
} else {
tmp = (x / z) * (1.0 - 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 <= (-7.1d-84)) .or. (.not. (z <= 2.22d+18))) then
tmp = y + (x / z)
else
tmp = (x / z) * (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -7.1e-84) || !(z <= 2.22e+18)) {
tmp = y + (x / z);
} else {
tmp = (x / z) * (1.0 - y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -7.1e-84) or not (z <= 2.22e+18): tmp = y + (x / z) else: tmp = (x / z) * (1.0 - y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -7.1e-84) || !(z <= 2.22e+18)) tmp = Float64(y + Float64(x / z)); else tmp = Float64(Float64(x / z) * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -7.1e-84) || ~((z <= 2.22e+18))) tmp = y + (x / z); else tmp = (x / z) * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -7.1e-84], N[Not[LessEqual[z, 2.22e+18]], $MachinePrecision]], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.1 \cdot 10^{-84} \lor \neg \left(z \leq 2.22 \cdot 10^{+18}\right):\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if z < -7.0999999999999997e-84 or 2.22e18 < z Initial program 74.9%
Taylor expanded in x around -inf 91.7%
mul-1-neg91.7%
unsub-neg91.7%
associate-/l*99.9%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 86.0%
mul-1-neg86.0%
distribute-frac-neg86.0%
Simplified86.0%
Taylor expanded in y around 0 86.0%
+-commutative86.0%
Simplified86.0%
if -7.0999999999999997e-84 < z < 2.22e18Initial program 99.2%
Taylor expanded in x around inf 87.5%
associate-/l*81.7%
associate-/r/87.5%
mul-1-neg87.5%
unsub-neg87.5%
Simplified87.5%
Final simplification86.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -27000000.0) (not (<= y 4.2e-6))) (* (- z x) (/ y z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -27000000.0) || !(y <= 4.2e-6)) {
tmp = (z - 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 <= (-27000000.0d0)) .or. (.not. (y <= 4.2d-6))) then
tmp = (z - 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 <= -27000000.0) || !(y <= 4.2e-6)) {
tmp = (z - x) * (y / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -27000000.0) or not (y <= 4.2e-6): tmp = (z - x) * (y / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -27000000.0) || !(y <= 4.2e-6)) tmp = Float64(Float64(z - x) * 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 <= -27000000.0) || ~((y <= 4.2e-6))) tmp = (z - x) * (y / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -27000000.0], N[Not[LessEqual[y, 4.2e-6]], $MachinePrecision]], N[(N[(z - x), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -27000000 \lor \neg \left(y \leq 4.2 \cdot 10^{-6}\right):\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -2.7e7 or 4.1999999999999996e-6 < y Initial program 72.5%
Taylor expanded in y around inf 71.6%
associate-/l*99.1%
associate-/r/92.1%
Simplified92.1%
if -2.7e7 < y < 4.1999999999999996e-6Initial 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 99.3%
mul-1-neg99.3%
distribute-frac-neg99.3%
Simplified99.3%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
Simplified99.3%
Final simplification95.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -27000000.0) (not (<= y 4.2e-6))) (/ y (/ z (- z x))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -27000000.0) || !(y <= 4.2e-6)) {
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 <= (-27000000.0d0)) .or. (.not. (y <= 4.2d-6))) 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 <= -27000000.0) || !(y <= 4.2e-6)) {
tmp = y / (z / (z - x));
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -27000000.0) or not (y <= 4.2e-6): tmp = y / (z / (z - x)) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -27000000.0) || !(y <= 4.2e-6)) tmp = Float64(y / Float64(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 <= -27000000.0) || ~((y <= 4.2e-6))) tmp = y / (z / (z - x)); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -27000000.0], N[Not[LessEqual[y, 4.2e-6]], $MachinePrecision]], N[(y / N[(z / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -27000000 \lor \neg \left(y \leq 4.2 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{y}{\frac{z}{z - x}}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -2.7e7 or 4.1999999999999996e-6 < y Initial program 72.5%
Taylor expanded in y around inf 71.6%
associate-/l*99.1%
Simplified99.1%
if -2.7e7 < y < 4.1999999999999996e-6Initial 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 99.3%
mul-1-neg99.3%
distribute-frac-neg99.3%
Simplified99.3%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
Simplified99.3%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.15e-45) (not (<= y 1.9e-54))) (* z (/ y z)) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.15e-45) || !(y <= 1.9e-54)) {
tmp = z * (y / z);
} else {
tmp = 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 <= (-2.15d-45)) .or. (.not. (y <= 1.9d-54))) then
tmp = z * (y / z)
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.15e-45) || !(y <= 1.9e-54)) {
tmp = z * (y / z);
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.15e-45) or not (y <= 1.9e-54): tmp = z * (y / z) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.15e-45) || !(y <= 1.9e-54)) tmp = Float64(z * Float64(y / z)); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.15e-45) || ~((y <= 1.9e-54))) tmp = z * (y / z); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.15e-45], N[Not[LessEqual[y, 1.9e-54]], $MachinePrecision]], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.15 \cdot 10^{-45} \lor \neg \left(y \leq 1.9 \cdot 10^{-54}\right):\\
\;\;\;\;z \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -2.1499999999999999e-45 or 1.9000000000000001e-54 < y Initial program 76.4%
Taylor expanded in x around 0 34.8%
associate-/l*51.4%
associate-/r/54.1%
Applied egg-rr54.1%
if -2.1499999999999999e-45 < y < 1.9000000000000001e-54Initial program 99.9%
Taylor expanded in y around 0 72.0%
Final simplification60.9%
(FPCore (x y z) :precision binary64 (if (<= z -52000000.0) y (if (<= z 5.1e+64) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (z <= -52000000.0) {
tmp = y;
} else if (z <= 5.1e+64) {
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 <= (-52000000.0d0)) then
tmp = y
else if (z <= 5.1d+64) 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 <= -52000000.0) {
tmp = y;
} else if (z <= 5.1e+64) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -52000000.0: tmp = y elif z <= 5.1e+64: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (z <= -52000000.0) tmp = y; elseif (z <= 5.1e+64) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -52000000.0) tmp = y; elseif (z <= 5.1e+64) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -52000000.0], y, If[LessEqual[z, 5.1e+64], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -52000000:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 5.1 \cdot 10^{+64}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if z < -5.2e7 or 5.10000000000000024e64 < z Initial program 69.0%
Taylor expanded in x around 0 71.4%
if -5.2e7 < z < 5.10000000000000024e64Initial program 99.3%
Taylor expanded in y around 0 51.7%
Final simplification60.8%
(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 85.3%
Taylor expanded in x around -inf 95.2%
mul-1-neg95.2%
unsub-neg95.2%
associate-/l*96.3%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 76.4%
mul-1-neg76.4%
distribute-frac-neg76.4%
Simplified76.4%
Taylor expanded in y around 0 76.4%
+-commutative76.4%
Simplified76.4%
Final simplification76.4%
(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 85.3%
Taylor expanded in x around 0 43.1%
Final simplification43.1%
(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 2024027
(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))