
(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 11 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 -1e+92) (not (<= y 2600000.0))) (* y (/ (- z x) z)) (/ (fma y (- z x) x) z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1e+92) || !(y <= 2600000.0)) {
tmp = y * ((z - x) / z);
} else {
tmp = fma(y, (z - x), x) / z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -1e+92) || !(y <= 2600000.0)) tmp = Float64(y * Float64(Float64(z - x) / z)); else tmp = Float64(fma(y, Float64(z - x), x) / z); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -1e+92], N[Not[LessEqual[y, 2600000.0]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(z - x), $MachinePrecision] + x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+92} \lor \neg \left(y \leq 2600000\right):\\
\;\;\;\;y \cdot \frac{z - x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, z - x, x\right)}{z}\\
\end{array}
\end{array}
if y < -1e92 or 2.6e6 < y Initial program 78.2%
Taylor expanded in y around inf 78.2%
associate-/l*99.9%
Simplified99.9%
if -1e92 < y < 2.6e6Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -9.5e+91) (not (<= y 2400000.0))) (* y (/ (- z x) z)) (/ (+ x (* y (- z x))) z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -9.5e+91) || !(y <= 2400000.0)) {
tmp = y * ((z - 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 <= (-9.5d+91)) .or. (.not. (y <= 2400000.0d0))) then
tmp = y * ((z - 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 <= -9.5e+91) || !(y <= 2400000.0)) {
tmp = y * ((z - x) / z);
} else {
tmp = (x + (y * (z - x))) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -9.5e+91) or not (y <= 2400000.0): tmp = y * ((z - x) / z) else: tmp = (x + (y * (z - x))) / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -9.5e+91) || !(y <= 2400000.0)) tmp = Float64(y * Float64(Float64(z - 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 <= -9.5e+91) || ~((y <= 2400000.0))) tmp = y * ((z - x) / z); else tmp = (x + (y * (z - x))) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -9.5e+91], N[Not[LessEqual[y, 2400000.0]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / z), $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 -9.5 \cdot 10^{+91} \lor \neg \left(y \leq 2400000\right):\\
\;\;\;\;y \cdot \frac{z - x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\
\end{array}
\end{array}
if y < -9.5000000000000001e91 or 2.4e6 < y Initial program 78.2%
Taylor expanded in y around inf 78.2%
associate-/l*99.9%
Simplified99.9%
if -9.5000000000000001e91 < y < 2.4e6Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -5.5e+142) (not (<= y 2600000.0))) (* y (/ (- z x) z)) (+ y (* x (/ (- 1.0 y) z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5.5e+142) || !(y <= 2600000.0)) {
tmp = y * ((z - 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 <= (-5.5d+142)) .or. (.not. (y <= 2600000.0d0))) then
tmp = y * ((z - 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 <= -5.5e+142) || !(y <= 2600000.0)) {
tmp = y * ((z - x) / z);
} else {
tmp = y + (x * ((1.0 - y) / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5.5e+142) or not (y <= 2600000.0): tmp = y * ((z - x) / z) else: tmp = y + (x * ((1.0 - y) / z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5.5e+142) || !(y <= 2600000.0)) tmp = Float64(y * Float64(Float64(z - x) / z)); else tmp = Float64(y + Float64(x * Float64(Float64(1.0 - y) / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5.5e+142) || ~((y <= 2600000.0))) tmp = y * ((z - x) / z); else tmp = y + (x * ((1.0 - y) / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5.5e+142], N[Not[LessEqual[y, 2600000.0]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x * N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+142} \lor \neg \left(y \leq 2600000\right):\\
\;\;\;\;y \cdot \frac{z - x}{z}\\
\mathbf{else}:\\
\;\;\;\;y + x \cdot \frac{1 - y}{z}\\
\end{array}
\end{array}
if y < -5.50000000000000035e142 or 2.6e6 < y Initial program 76.9%
Taylor expanded in y around inf 76.9%
associate-/l*99.9%
Simplified99.9%
if -5.50000000000000035e142 < y < 2.6e6Initial program 98.7%
add-sqr-sqrt54.7%
pow254.7%
Applied egg-rr54.7%
Taylor expanded in x around 0 99.8%
+-commutative99.8%
neg-mul-199.8%
sub-neg99.8%
div-sub99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.3e+23) (not (<= y 1.0))) (* y (/ (- z x) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.3e+23) || !(y <= 1.0)) {
tmp = y * ((z - 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 <= (-2.3d+23)) .or. (.not. (y <= 1.0d0))) then
tmp = y * ((z - 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 <= -2.3e+23) || !(y <= 1.0)) {
tmp = y * ((z - x) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.3e+23) or not (y <= 1.0): tmp = y * ((z - x) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.3e+23) || !(y <= 1.0)) tmp = Float64(y * Float64(Float64(z - 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 <= -2.3e+23) || ~((y <= 1.0))) tmp = y * ((z - x) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.3e+23], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{+23} \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y \cdot \frac{z - x}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -2.3e23 or 1 < y Initial program 79.9%
Taylor expanded in y around inf 79.0%
associate-/l*99.0%
Simplified99.0%
if -2.3e23 < y < 1Initial program 99.9%
Taylor expanded in z around inf 97.4%
Taylor expanded in x around 0 97.5%
+-commutative97.5%
Simplified97.5%
Final simplification98.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -6.8e+25) (not (<= x 2.15e+98))) (* x (/ (- 1.0 y) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -6.8e+25) || !(x <= 2.15e+98)) {
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+25)) .or. (.not. (x <= 2.15d+98))) 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+25) || !(x <= 2.15e+98)) {
tmp = x * ((1.0 - y) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -6.8e+25) or not (x <= 2.15e+98): 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+25) || !(x <= 2.15e+98)) 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+25) || ~((x <= 2.15e+98))) 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+25], N[Not[LessEqual[x, 2.15e+98]], $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^{+25} \lor \neg \left(x \leq 2.15 \cdot 10^{+98}\right):\\
\;\;\;\;x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -6.79999999999999967e25 or 2.1500000000000001e98 < x Initial program 93.5%
Taylor expanded in x around inf 87.9%
associate-/l*90.1%
mul-1-neg90.1%
unsub-neg90.1%
Simplified90.1%
if -6.79999999999999967e25 < x < 2.1500000000000001e98Initial program 87.7%
Taylor expanded in z around inf 69.1%
Taylor expanded in x around 0 81.3%
+-commutative81.3%
Simplified81.3%
Final simplification84.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.45e+150) (not (<= y 1.55e+96))) (/ (* y x) (- z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.45e+150) || !(y <= 1.55e+96)) {
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.45d+150)) .or. (.not. (y <= 1.55d+96))) 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.45e+150) || !(y <= 1.55e+96)) {
tmp = (y * x) / -z;
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.45e+150) or not (y <= 1.55e+96): tmp = (y * x) / -z else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.45e+150) || !(y <= 1.55e+96)) tmp = Float64(Float64(y * 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.45e+150) || ~((y <= 1.55e+96))) tmp = (y * x) / -z; else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.45e+150], N[Not[LessEqual[y, 1.55e+96]], $MachinePrecision]], N[(N[(y * x), $MachinePrecision] / (-z)), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{+150} \lor \neg \left(y \leq 1.55 \cdot 10^{+96}\right):\\
\;\;\;\;\frac{y \cdot x}{-z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -1.45000000000000005e150 or 1.5499999999999999e96 < y Initial program 74.8%
Taylor expanded in x around inf 63.5%
associate-/l*53.5%
mul-1-neg53.5%
unsub-neg53.5%
Simplified53.5%
Taylor expanded in y around inf 63.5%
associate-*r/63.5%
mul-1-neg63.5%
distribute-rgt-neg-out63.5%
Simplified63.5%
if -1.45000000000000005e150 < y < 1.5499999999999999e96Initial program 97.6%
Taylor expanded in z around inf 88.4%
Taylor expanded in x around 0 89.6%
+-commutative89.6%
Simplified89.6%
Final simplification81.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.1e+217) (not (<= y 1.8e+72))) (* x (/ y (- z))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.1e+217) || !(y <= 1.8e+72)) {
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 <= (-1.1d+217)) .or. (.not. (y <= 1.8d+72))) 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 <= -1.1e+217) || !(y <= 1.8e+72)) {
tmp = x * (y / -z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.1e+217) or not (y <= 1.8e+72): tmp = x * (y / -z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.1e+217) || !(y <= 1.8e+72)) tmp = Float64(x * Float64(y / 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.1e+217) || ~((y <= 1.8e+72))) tmp = x * (y / -z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.1e+217], N[Not[LessEqual[y, 1.8e+72]], $MachinePrecision]], N[(x * N[(y / (-z)), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{+217} \lor \neg \left(y \leq 1.8 \cdot 10^{+72}\right):\\
\;\;\;\;x \cdot \frac{y}{-z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -1.1e217 or 1.80000000000000017e72 < y Initial program 73.6%
Taylor expanded in x around inf 62.1%
associate-/l*56.9%
mul-1-neg56.9%
unsub-neg56.9%
Simplified56.9%
Taylor expanded in y around inf 62.1%
mul-1-neg62.1%
associate-/l*56.9%
distribute-rgt-neg-in56.9%
distribute-neg-frac56.9%
Simplified56.9%
if -1.1e217 < y < 1.80000000000000017e72Initial program 96.7%
Taylor expanded in z around inf 84.4%
Taylor expanded in x around 0 87.1%
+-commutative87.1%
Simplified87.1%
Final simplification78.4%
(FPCore (x y z) :precision binary64 (if (<= y -1.85e-34) (* z (/ y z)) (if (<= y 7.2e-178) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.85e-34) {
tmp = z * (y / z);
} else if (y <= 7.2e-178) {
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 <= (-1.85d-34)) then
tmp = z * (y / z)
else if (y <= 7.2d-178) 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 <= -1.85e-34) {
tmp = z * (y / z);
} else if (y <= 7.2e-178) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.85e-34: tmp = z * (y / z) elif y <= 7.2e-178: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.85e-34) tmp = Float64(z * Float64(y / z)); elseif (y <= 7.2e-178) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.85e-34) tmp = z * (y / z); elseif (y <= 7.2e-178) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.85e-34], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e-178], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.85 \cdot 10^{-34}:\\
\;\;\;\;z \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-178}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -1.84999999999999994e-34Initial program 82.9%
Taylor expanded in y around inf 82.9%
Taylor expanded in z around inf 33.3%
*-commutative33.3%
associate-/l*59.2%
Applied egg-rr59.2%
if -1.84999999999999994e-34 < y < 7.19999999999999987e-178Initial program 99.9%
Taylor expanded in y around 0 79.1%
if 7.19999999999999987e-178 < y Initial program 87.1%
Taylor expanded in x around 0 47.2%
(FPCore (x y z) :precision binary64 (if (<= z -2.3e-118) y (if (<= z 23500.0) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.3e-118) {
tmp = y;
} else if (z <= 23500.0) {
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.3d-118)) then
tmp = y
else if (z <= 23500.0d0) 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.3e-118) {
tmp = y;
} else if (z <= 23500.0) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.3e-118: tmp = y elif z <= 23500.0: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.3e-118) tmp = y; elseif (z <= 23500.0) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.3e-118) tmp = y; elseif (z <= 23500.0) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.3e-118], y, If[LessEqual[z, 23500.0], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{-118}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 23500:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if z < -2.30000000000000021e-118 or 23500 < z Initial program 82.3%
Taylor expanded in x around 0 62.7%
if -2.30000000000000021e-118 < z < 23500Initial program 99.9%
Taylor expanded in y around 0 53.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 90.1%
Taylor expanded in z around inf 65.2%
Taylor expanded in x around 0 73.2%
+-commutative73.2%
Simplified73.2%
Final simplification73.2%
(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.1%
Taylor expanded in x around 0 39.9%
(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 2024172
(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))