
(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 (if (or (<= y -7.2e+15) (not (<= y 2e+141))) (* y (- 1.0 (/ x z))) (+ y (/ (* x (- 1.0 y)) z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7.2e+15) || !(y <= 2e+141)) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y + ((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 ((y <= (-7.2d+15)) .or. (.not. (y <= 2d+141))) then
tmp = y * (1.0d0 - (x / z))
else
tmp = y + ((x * (1.0d0 - y)) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -7.2e+15) || !(y <= 2e+141)) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y + ((x * (1.0 - y)) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7.2e+15) or not (y <= 2e+141): tmp = y * (1.0 - (x / z)) else: tmp = y + ((x * (1.0 - y)) / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7.2e+15) || !(y <= 2e+141)) tmp = Float64(y * Float64(1.0 - Float64(x / z))); else tmp = Float64(y + Float64(Float64(x * Float64(1.0 - y)) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -7.2e+15) || ~((y <= 2e+141))) tmp = y * (1.0 - (x / z)); else tmp = y + ((x * (1.0 - y)) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7.2e+15], N[Not[LessEqual[y, 2e+141]], $MachinePrecision]], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{+15} \lor \neg \left(y \leq 2 \cdot 10^{+141}\right):\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x \cdot \left(1 - y\right)}{z}\\
\end{array}
\end{array}
if y < -7.2e15 or 2.00000000000000003e141 < y Initial program 70.9%
Taylor expanded in y around inf 70.9%
associate-/l*99.8%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
if -7.2e15 < y < 2.00000000000000003e141Initial program 99.3%
Taylor expanded in x around inf 97.4%
associate-+r+97.4%
+-commutative97.4%
mul-1-neg97.4%
unsub-neg97.4%
div-sub97.5%
Simplified97.5%
Taylor expanded in z around inf 100.0%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ (- x) z))))
(if (<= y 4.6e+14)
(+ y (/ x z))
(if (<= y 1.45e+192)
t_0
(if (<= y 1.16e+260) (/ (* x y) x) (if (<= y 2.5e+279) t_0 y))))))
double code(double x, double y, double z) {
double t_0 = y * (-x / z);
double tmp;
if (y <= 4.6e+14) {
tmp = y + (x / z);
} else if (y <= 1.45e+192) {
tmp = t_0;
} else if (y <= 1.16e+260) {
tmp = (x * y) / x;
} else if (y <= 2.5e+279) {
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 = y * (-x / z)
if (y <= 4.6d+14) then
tmp = y + (x / z)
else if (y <= 1.45d+192) then
tmp = t_0
else if (y <= 1.16d+260) then
tmp = (x * y) / x
else if (y <= 2.5d+279) 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 = y * (-x / z);
double tmp;
if (y <= 4.6e+14) {
tmp = y + (x / z);
} else if (y <= 1.45e+192) {
tmp = t_0;
} else if (y <= 1.16e+260) {
tmp = (x * y) / x;
} else if (y <= 2.5e+279) {
tmp = t_0;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): t_0 = y * (-x / z) tmp = 0 if y <= 4.6e+14: tmp = y + (x / z) elif y <= 1.45e+192: tmp = t_0 elif y <= 1.16e+260: tmp = (x * y) / x elif y <= 2.5e+279: tmp = t_0 else: tmp = y return tmp
function code(x, y, z) t_0 = Float64(y * Float64(Float64(-x) / z)) tmp = 0.0 if (y <= 4.6e+14) tmp = Float64(y + Float64(x / z)); elseif (y <= 1.45e+192) tmp = t_0; elseif (y <= 1.16e+260) tmp = Float64(Float64(x * y) / x); elseif (y <= 2.5e+279) tmp = t_0; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (-x / z); tmp = 0.0; if (y <= 4.6e+14) tmp = y + (x / z); elseif (y <= 1.45e+192) tmp = t_0; elseif (y <= 1.16e+260) tmp = (x * y) / x; elseif (y <= 2.5e+279) tmp = t_0; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[((-x) / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 4.6e+14], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.45e+192], t$95$0, If[LessEqual[y, 1.16e+260], N[(N[(x * y), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 2.5e+279], t$95$0, y]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{-x}{z}\\
\mathbf{if}\;y \leq 4.6 \cdot 10^{+14}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+192}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.16 \cdot 10^{+260}:\\
\;\;\;\;\frac{x \cdot y}{x}\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+279}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < 4.6e14Initial program 90.8%
Taylor expanded in x around inf 90.6%
associate-+r+90.6%
+-commutative90.6%
mul-1-neg90.6%
unsub-neg90.6%
div-sub90.6%
Simplified90.6%
Taylor expanded in z around inf 97.2%
Taylor expanded in y around 0 87.2%
if 4.6e14 < y < 1.4500000000000001e192 or 1.16e260 < y < 2.5000000000000001e279Initial program 92.3%
Taylor expanded in y around inf 92.3%
associate-/l*99.8%
div-sub99.8%
*-inverses99.8%
Simplified99.8%
Taylor expanded in x around inf 86.5%
mul-1-neg86.5%
distribute-neg-frac286.5%
Simplified86.5%
if 1.4500000000000001e192 < y < 1.16e260Initial program 57.4%
Taylor expanded in x around inf 57.0%
associate-+r+57.0%
+-commutative57.0%
mul-1-neg57.0%
unsub-neg57.0%
div-sub57.0%
Simplified57.0%
Taylor expanded in z around inf 27.1%
associate-*r/76.4%
Applied egg-rr76.4%
if 2.5000000000000001e279 < y Initial program 40.5%
Taylor expanded in x around 0 100.0%
Final simplification86.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -2e+38) (not (<= x 1.8e-30))) (* x (/ (- 1.0 y) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2e+38) || !(x <= 1.8e-30)) {
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 <= (-2d+38)) .or. (.not. (x <= 1.8d-30))) 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 <= -2e+38) || !(x <= 1.8e-30)) {
tmp = x * ((1.0 - y) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2e+38) or not (x <= 1.8e-30): tmp = x * ((1.0 - y) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2e+38) || !(x <= 1.8e-30)) 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 <= -2e+38) || ~((x <= 1.8e-30))) tmp = x * ((1.0 - y) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2e+38], N[Not[LessEqual[x, 1.8e-30]], $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 \cdot 10^{+38} \lor \neg \left(x \leq 1.8 \cdot 10^{-30}\right):\\
\;\;\;\;x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -1.99999999999999995e38 or 1.8000000000000002e-30 < x Initial program 89.7%
Taylor expanded in x around inf 98.9%
associate-+r+98.9%
+-commutative98.9%
mul-1-neg98.9%
unsub-neg98.9%
div-sub99.0%
Simplified99.0%
Taylor expanded in z around 0 86.8%
if -1.99999999999999995e38 < x < 1.8000000000000002e-30Initial program 88.4%
Taylor expanded in x around inf 78.1%
associate-+r+78.1%
+-commutative78.1%
mul-1-neg78.1%
unsub-neg78.1%
div-sub78.1%
Simplified78.1%
Taylor expanded in z around inf 99.3%
Taylor expanded in y around 0 88.5%
Final simplification87.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -24.0) (not (<= y 2.1e-14))) (* y (- 1.0 (/ x z))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -24.0) || !(y <= 2.1e-14)) {
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 <= (-24.0d0)) .or. (.not. (y <= 2.1d-14))) 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 <= -24.0) || !(y <= 2.1e-14)) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -24.0) or not (y <= 2.1e-14): tmp = y * (1.0 - (x / z)) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -24.0) || !(y <= 2.1e-14)) 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 <= -24.0) || ~((y <= 2.1e-14))) tmp = y * (1.0 - (x / z)); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -24.0], N[Not[LessEqual[y, 2.1e-14]], $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 -24 \lor \neg \left(y \leq 2.1 \cdot 10^{-14}\right):\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -24 or 2.0999999999999999e-14 < y Initial program 77.4%
Taylor expanded in y around inf 76.4%
associate-/l*98.9%
div-sub98.9%
*-inverses98.9%
Simplified98.9%
if -24 < y < 2.0999999999999999e-14Initial program 99.9%
Taylor expanded in x around inf 99.8%
associate-+r+99.8%
+-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
div-sub99.8%
Simplified99.8%
Taylor expanded in z around inf 100.0%
Taylor expanded in y around 0 99.5%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (<= y 4.6e+14) (+ y (/ x z)) (if (<= y 2.45e+191) (* x (/ (- y) z)) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= 4.6e+14) {
tmp = y + (x / z);
} else if (y <= 2.45e+191) {
tmp = x * (-y / 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 <= 4.6d+14) then
tmp = y + (x / z)
else if (y <= 2.45d+191) then
tmp = x * (-y / z)
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 4.6e+14) {
tmp = y + (x / z);
} else if (y <= 2.45e+191) {
tmp = x * (-y / z);
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 4.6e+14: tmp = y + (x / z) elif y <= 2.45e+191: tmp = x * (-y / z) else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 4.6e+14) tmp = Float64(y + Float64(x / z)); elseif (y <= 2.45e+191) tmp = Float64(x * Float64(Float64(-y) / z)); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 4.6e+14) tmp = y + (x / z); elseif (y <= 2.45e+191) tmp = x * (-y / z); else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 4.6e+14], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.45e+191], N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.6 \cdot 10^{+14}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 2.45 \cdot 10^{+191}:\\
\;\;\;\;x \cdot \frac{-y}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < 4.6e14Initial program 90.8%
Taylor expanded in x around inf 90.6%
associate-+r+90.6%
+-commutative90.6%
mul-1-neg90.6%
unsub-neg90.6%
div-sub90.6%
Simplified90.6%
Taylor expanded in z around inf 97.2%
Taylor expanded in y around 0 87.2%
if 4.6e14 < y < 2.45e191Initial program 91.5%
Taylor expanded in y around inf 91.5%
associate-/l*99.8%
div-sub99.8%
*-inverses99.8%
Simplified99.8%
Taylor expanded in x around inf 79.5%
mul-1-neg79.5%
distribute-neg-frac279.5%
associate-*r/70.8%
Simplified70.8%
if 2.45e191 < y Initial program 64.0%
Taylor expanded in x around 0 59.9%
Final simplification83.2%
(FPCore (x y z) :precision binary64 (if (<= x 4.2e-20) (+ y (/ (* x (- 1.0 y)) z)) (* x (+ (/ (- 1.0 y) z) (/ y x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 4.2e-20) {
tmp = y + ((x * (1.0 - y)) / z);
} else {
tmp = x * (((1.0 - y) / z) + (y / 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 (x <= 4.2d-20) then
tmp = y + ((x * (1.0d0 - y)) / z)
else
tmp = x * (((1.0d0 - y) / z) + (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 4.2e-20) {
tmp = y + ((x * (1.0 - y)) / z);
} else {
tmp = x * (((1.0 - y) / z) + (y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 4.2e-20: tmp = y + ((x * (1.0 - y)) / z) else: tmp = x * (((1.0 - y) / z) + (y / x)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 4.2e-20) tmp = Float64(y + Float64(Float64(x * Float64(1.0 - y)) / z)); else tmp = Float64(x * Float64(Float64(Float64(1.0 - y) / z) + Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 4.2e-20) tmp = y + ((x * (1.0 - y)) / z); else tmp = x * (((1.0 - y) / z) + (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 4.2e-20], N[(y + N[(N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision] + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.2 \cdot 10^{-20}:\\
\;\;\;\;y + \frac{x \cdot \left(1 - y\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{1 - y}{z} + \frac{y}{x}\right)\\
\end{array}
\end{array}
if x < 4.1999999999999998e-20Initial program 89.8%
Taylor expanded in x around inf 82.9%
associate-+r+82.9%
+-commutative82.9%
mul-1-neg82.9%
unsub-neg82.9%
div-sub82.9%
Simplified82.9%
Taylor expanded in z around inf 98.0%
if 4.1999999999999998e-20 < x Initial program 86.6%
Taylor expanded in x around inf 99.8%
associate-+r+99.8%
+-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
div-sub99.8%
Simplified99.8%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (if (<= z -2.1e-59) y (if (<= z 2.65e+23) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.1e-59) {
tmp = y;
} else if (z <= 2.65e+23) {
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 <= (-2.1d-59)) then
tmp = y
else if (z <= 2.65d+23) 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 <= -2.1e-59) {
tmp = y;
} else if (z <= 2.65e+23) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.1e-59: tmp = y elif z <= 2.65e+23: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.1e-59) tmp = y; elseif (z <= 2.65e+23) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.1e-59) tmp = y; elseif (z <= 2.65e+23) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.1e-59], y, If[LessEqual[z, 2.65e+23], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{-59}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 2.65 \cdot 10^{+23}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if z < -2.09999999999999997e-59 or 2.6500000000000001e23 < z Initial program 76.2%
Taylor expanded in x around 0 72.6%
if -2.09999999999999997e-59 < z < 2.6500000000000001e23Initial program 99.9%
Taylor expanded in y around 0 54.2%
Final simplification62.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.0%
Taylor expanded in x around inf 87.0%
associate-+r+87.0%
+-commutative87.0%
mul-1-neg87.0%
unsub-neg87.0%
div-sub87.0%
Simplified87.0%
Taylor expanded in z around inf 95.9%
Taylor expanded in y around 0 76.1%
Final simplification76.1%
(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.0%
Taylor expanded in x around 0 40.0%
Final simplification40.0%
(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 2024053
(FPCore (x y z)
:name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
:precision binary64
:alt
(- (+ y (/ x z)) (/ y (/ z x)))
(/ (+ x (* y (- z x))) z))