
(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 14 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 1.1e+79) (+ y (/ x (/ z (- 1.0 y)))) (* y (- 1.0 (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.1e+79) {
tmp = y + (x / (z / (1.0 - y)));
} else {
tmp = y * (1.0 - (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+79) then
tmp = y + (x / (z / (1.0d0 - y)))
else
tmp = y * (1.0d0 - (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.1e+79) {
tmp = y + (x / (z / (1.0 - y)));
} else {
tmp = y * (1.0 - (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.1e+79: tmp = y + (x / (z / (1.0 - y))) else: tmp = y * (1.0 - (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.1e+79) tmp = Float64(y + Float64(x / Float64(z / Float64(1.0 - y)))); else tmp = Float64(y * Float64(1.0 - Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.1e+79) tmp = y + (x / (z / (1.0 - y))); else tmp = y * (1.0 - (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.1e+79], N[(y + N[(x / N[(z / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.1 \cdot 10^{+79}:\\
\;\;\;\;y + \frac{x}{\frac{z}{1 - y}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\end{array}
\end{array}
if y < 1.0999999999999999e79Initial program 95.3%
Taylor expanded in x around 0 96.5%
+-commutative96.5%
mul-1-neg96.5%
sub-neg96.5%
div-sub96.5%
clear-num96.6%
un-div-inv98.7%
Applied egg-rr98.7%
if 1.0999999999999999e79 < y Initial program 67.7%
Taylor expanded in y around inf 67.7%
associate-/l*99.8%
div-sub99.9%
sub-neg99.9%
*-inverses99.9%
sub-neg99.9%
Simplified99.9%
Final simplification98.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ (- y) z))))
(if (<= y -3.8e+186)
t_0
(if (<= y 1.4e+38)
(+ y (/ x z))
(if (<= y 1.6e+144) t_0 (- y (/ x z)))))))
double code(double x, double y, double z) {
double t_0 = x * (-y / z);
double tmp;
if (y <= -3.8e+186) {
tmp = t_0;
} else if (y <= 1.4e+38) {
tmp = y + (x / z);
} else if (y <= 1.6e+144) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = x * (-y / z)
if (y <= (-3.8d+186)) then
tmp = t_0
else if (y <= 1.4d+38) then
tmp = y + (x / z)
else if (y <= 1.6d+144) then
tmp = t_0
else
tmp = y - (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (-y / z);
double tmp;
if (y <= -3.8e+186) {
tmp = t_0;
} else if (y <= 1.4e+38) {
tmp = y + (x / z);
} else if (y <= 1.6e+144) {
tmp = t_0;
} else {
tmp = y - (x / z);
}
return tmp;
}
def code(x, y, z): t_0 = x * (-y / z) tmp = 0 if y <= -3.8e+186: tmp = t_0 elif y <= 1.4e+38: tmp = y + (x / z) elif y <= 1.6e+144: tmp = t_0 else: tmp = y - (x / z) return tmp
function code(x, y, z) t_0 = Float64(x * Float64(Float64(-y) / z)) tmp = 0.0 if (y <= -3.8e+186) tmp = t_0; elseif (y <= 1.4e+38) tmp = Float64(y + Float64(x / z)); elseif (y <= 1.6e+144) tmp = t_0; else tmp = Float64(y - Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (-y / z); tmp = 0.0; if (y <= -3.8e+186) tmp = t_0; elseif (y <= 1.4e+38) tmp = y + (x / z); elseif (y <= 1.6e+144) tmp = t_0; else tmp = y - (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.8e+186], t$95$0, If[LessEqual[y, 1.4e+38], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e+144], t$95$0, N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-y}{z}\\
\mathbf{if}\;y \leq -3.8 \cdot 10^{+186}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+38}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+144}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y - \frac{x}{z}\\
\end{array}
\end{array}
if y < -3.7999999999999998e186 or 1.4e38 < y < 1.6e144Initial program 84.5%
Taylor expanded in y around inf 84.5%
Taylor expanded in z around 0 64.4%
mul-1-neg64.4%
distribute-lft-neg-out64.4%
*-commutative64.4%
Simplified64.4%
frac-2neg64.4%
distribute-frac-neg64.4%
add-sqr-sqrt33.4%
sqrt-unprod25.1%
sqr-neg25.1%
sqrt-unprod0.3%
add-sqr-sqrt1.1%
remove-double-neg1.1%
distribute-rgt-neg-out1.1%
frac-2neg1.1%
*-commutative1.1%
associate-/l*1.4%
add-sqr-sqrt1.0%
sqrt-unprod24.7%
sqr-neg24.7%
sqrt-unprod28.9%
add-sqr-sqrt63.2%
Applied egg-rr63.2%
if -3.7999999999999998e186 < y < 1.4e38Initial program 96.6%
Taylor expanded in x around 0 98.1%
Taylor expanded in y around 0 91.3%
if 1.6e144 < y Initial program 63.3%
Taylor expanded in x around 0 87.5%
Taylor expanded in y around 0 54.9%
frac-2neg54.9%
div-inv54.9%
add-sqr-sqrt27.9%
sqrt-unprod64.6%
sqr-neg64.6%
sqrt-unprod35.1%
add-sqr-sqrt70.8%
cancel-sign-sub-inv70.8%
div-inv70.8%
Applied egg-rr70.8%
Final simplification83.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ x z) (- y))))
(if (<= y -3.3e+186)
t_0
(if (<= y 1.75e+39)
(+ y (/ x z))
(if (<= y 1.2e+144) t_0 (- y (/ x z)))))))
double code(double x, double y, double z) {
double t_0 = (x / z) * -y;
double tmp;
if (y <= -3.3e+186) {
tmp = t_0;
} else if (y <= 1.75e+39) {
tmp = y + (x / z);
} else if (y <= 1.2e+144) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = (x / z) * -y
if (y <= (-3.3d+186)) then
tmp = t_0
else if (y <= 1.75d+39) then
tmp = y + (x / z)
else if (y <= 1.2d+144) then
tmp = t_0
else
tmp = y - (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x / z) * -y;
double tmp;
if (y <= -3.3e+186) {
tmp = t_0;
} else if (y <= 1.75e+39) {
tmp = y + (x / z);
} else if (y <= 1.2e+144) {
tmp = t_0;
} else {
tmp = y - (x / z);
}
return tmp;
}
def code(x, y, z): t_0 = (x / z) * -y tmp = 0 if y <= -3.3e+186: tmp = t_0 elif y <= 1.75e+39: tmp = y + (x / z) elif y <= 1.2e+144: tmp = t_0 else: tmp = y - (x / z) return tmp
function code(x, y, z) t_0 = Float64(Float64(x / z) * Float64(-y)) tmp = 0.0 if (y <= -3.3e+186) tmp = t_0; elseif (y <= 1.75e+39) tmp = Float64(y + Float64(x / z)); elseif (y <= 1.2e+144) tmp = t_0; else tmp = Float64(y - Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x / z) * -y; tmp = 0.0; if (y <= -3.3e+186) tmp = t_0; elseif (y <= 1.75e+39) tmp = y + (x / z); elseif (y <= 1.2e+144) tmp = t_0; else tmp = y - (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x / z), $MachinePrecision] * (-y)), $MachinePrecision]}, If[LessEqual[y, -3.3e+186], t$95$0, If[LessEqual[y, 1.75e+39], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e+144], t$95$0, N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{z} \cdot \left(-y\right)\\
\mathbf{if}\;y \leq -3.3 \cdot 10^{+186}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{+39}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+144}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y - \frac{x}{z}\\
\end{array}
\end{array}
if y < -3.30000000000000023e186 or 1.7500000000000001e39 < y < 1.2e144Initial program 84.5%
Taylor expanded in y around inf 84.5%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around 0 71.0%
neg-mul-171.0%
distribute-neg-frac271.0%
Simplified71.0%
if -3.30000000000000023e186 < y < 1.7500000000000001e39Initial program 96.6%
Taylor expanded in x around 0 98.1%
Taylor expanded in y around 0 91.3%
if 1.2e144 < y Initial program 63.3%
Taylor expanded in x around 0 87.5%
Taylor expanded in y around 0 54.9%
frac-2neg54.9%
div-inv54.9%
add-sqr-sqrt27.9%
sqrt-unprod64.6%
sqr-neg64.6%
sqrt-unprod35.1%
add-sqr-sqrt70.8%
cancel-sign-sub-inv70.8%
div-inv70.8%
Applied egg-rr70.8%
Final simplification84.9%
(FPCore (x y z)
:precision binary64
(if (<= y -2.8e+186)
(* (/ x z) (- y))
(if (<= y 1.55e+34)
(+ y (/ x z))
(if (<= y 2.1e+144) (/ (- y) (/ z x)) (- y (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.8e+186) {
tmp = (x / z) * -y;
} else if (y <= 1.55e+34) {
tmp = y + (x / z);
} else if (y <= 2.1e+144) {
tmp = -y / (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 <= (-2.8d+186)) then
tmp = (x / z) * -y
else if (y <= 1.55d+34) then
tmp = y + (x / z)
else if (y <= 2.1d+144) then
tmp = -y / (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 <= -2.8e+186) {
tmp = (x / z) * -y;
} else if (y <= 1.55e+34) {
tmp = y + (x / z);
} else if (y <= 2.1e+144) {
tmp = -y / (z / x);
} else {
tmp = y - (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.8e+186: tmp = (x / z) * -y elif y <= 1.55e+34: tmp = y + (x / z) elif y <= 2.1e+144: tmp = -y / (z / x) else: tmp = y - (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.8e+186) tmp = Float64(Float64(x / z) * Float64(-y)); elseif (y <= 1.55e+34) tmp = Float64(y + Float64(x / z)); elseif (y <= 2.1e+144) tmp = Float64(Float64(-y) / 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 <= -2.8e+186) tmp = (x / z) * -y; elseif (y <= 1.55e+34) tmp = y + (x / z); elseif (y <= 2.1e+144) tmp = -y / (z / x); else tmp = y - (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.8e+186], N[(N[(x / z), $MachinePrecision] * (-y)), $MachinePrecision], If[LessEqual[y, 1.55e+34], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.1e+144], N[((-y) / N[(z / x), $MachinePrecision]), $MachinePrecision], N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{+186}:\\
\;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{+34}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+144}:\\
\;\;\;\;\frac{-y}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;y - \frac{x}{z}\\
\end{array}
\end{array}
if y < -2.80000000000000018e186Initial program 87.4%
Taylor expanded in y around inf 87.4%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 70.9%
neg-mul-170.9%
distribute-neg-frac270.9%
Simplified70.9%
if -2.80000000000000018e186 < y < 1.54999999999999989e34Initial program 96.6%
Taylor expanded in x around 0 98.1%
Taylor expanded in y around 0 91.3%
if 1.54999999999999989e34 < y < 2.09999999999999996e144Initial program 81.6%
Taylor expanded in y around inf 81.6%
associate-/l*99.6%
Simplified99.6%
clear-num99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in z around 0 71.2%
associate-*r/71.2%
neg-mul-171.2%
Simplified71.2%
if 2.09999999999999996e144 < y Initial program 63.3%
Taylor expanded in x around 0 87.5%
Taylor expanded in y around 0 54.9%
frac-2neg54.9%
div-inv54.9%
add-sqr-sqrt27.9%
sqrt-unprod64.6%
sqr-neg64.6%
sqrt-unprod35.1%
add-sqr-sqrt70.8%
cancel-sign-sub-inv70.8%
div-inv70.8%
Applied egg-rr70.8%
Final simplification84.9%
(FPCore (x y z)
:precision binary64
(if (<= y -3.6e+186)
(/ (* x (- y)) z)
(if (<= y 2.45e+36)
(+ y (/ x z))
(if (<= y 1.25e+144) (/ (- y) (/ z x)) (- y (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.6e+186) {
tmp = (x * -y) / z;
} else if (y <= 2.45e+36) {
tmp = y + (x / z);
} else if (y <= 1.25e+144) {
tmp = -y / (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 <= (-3.6d+186)) then
tmp = (x * -y) / z
else if (y <= 2.45d+36) then
tmp = y + (x / z)
else if (y <= 1.25d+144) then
tmp = -y / (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 <= -3.6e+186) {
tmp = (x * -y) / z;
} else if (y <= 2.45e+36) {
tmp = y + (x / z);
} else if (y <= 1.25e+144) {
tmp = -y / (z / x);
} else {
tmp = y - (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.6e+186: tmp = (x * -y) / z elif y <= 2.45e+36: tmp = y + (x / z) elif y <= 1.25e+144: tmp = -y / (z / x) else: tmp = y - (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.6e+186) tmp = Float64(Float64(x * Float64(-y)) / z); elseif (y <= 2.45e+36) tmp = Float64(y + Float64(x / z)); elseif (y <= 1.25e+144) tmp = Float64(Float64(-y) / 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 <= -3.6e+186) tmp = (x * -y) / z; elseif (y <= 2.45e+36) tmp = y + (x / z); elseif (y <= 1.25e+144) tmp = -y / (z / x); else tmp = y - (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.6e+186], N[(N[(x * (-y)), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 2.45e+36], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.25e+144], N[((-y) / N[(z / x), $MachinePrecision]), $MachinePrecision], N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.6 \cdot 10^{+186}:\\
\;\;\;\;\frac{x \cdot \left(-y\right)}{z}\\
\mathbf{elif}\;y \leq 2.45 \cdot 10^{+36}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+144}:\\
\;\;\;\;\frac{-y}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;y - \frac{x}{z}\\
\end{array}
\end{array}
if y < -3.6000000000000002e186Initial program 87.4%
Taylor expanded in y around inf 87.4%
Taylor expanded in z around 0 71.0%
mul-1-neg71.0%
distribute-lft-neg-out71.0%
*-commutative71.0%
Simplified71.0%
if -3.6000000000000002e186 < y < 2.4499999999999999e36Initial program 96.6%
Taylor expanded in x around 0 98.1%
Taylor expanded in y around 0 91.3%
if 2.4499999999999999e36 < y < 1.25e144Initial program 81.6%
Taylor expanded in y around inf 81.6%
associate-/l*99.6%
Simplified99.6%
clear-num99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in z around 0 71.2%
associate-*r/71.2%
neg-mul-171.2%
Simplified71.2%
if 1.25e144 < y Initial program 63.3%
Taylor expanded in x around 0 87.5%
Taylor expanded in y around 0 54.9%
frac-2neg54.9%
div-inv54.9%
add-sqr-sqrt27.9%
sqrt-unprod64.6%
sqr-neg64.6%
sqrt-unprod35.1%
add-sqr-sqrt70.8%
cancel-sign-sub-inv70.8%
div-inv70.8%
Applied egg-rr70.8%
Final simplification84.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -5.8e+97) (not (<= x 7.6e-59))) (* x (/ (- 1.0 y) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5.8e+97) || !(x <= 7.6e-59)) {
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 <= (-5.8d+97)) .or. (.not. (x <= 7.6d-59))) 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 <= -5.8e+97) || !(x <= 7.6e-59)) {
tmp = x * ((1.0 - y) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5.8e+97) or not (x <= 7.6e-59): tmp = x * ((1.0 - y) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -5.8e+97) || !(x <= 7.6e-59)) 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 <= -5.8e+97) || ~((x <= 7.6e-59))) tmp = x * ((1.0 - y) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -5.8e+97], N[Not[LessEqual[x, 7.6e-59]], $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 -5.8 \cdot 10^{+97} \lor \neg \left(x \leq 7.6 \cdot 10^{-59}\right):\\
\;\;\;\;x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -5.79999999999999974e97 or 7.59999999999999966e-59 < x Initial program 90.9%
Taylor expanded in x around inf 83.5%
associate-/l*88.3%
mul-1-neg88.3%
unsub-neg88.3%
Simplified88.3%
if -5.79999999999999974e97 < x < 7.59999999999999966e-59Initial program 88.7%
Taylor expanded in x around 0 90.5%
Taylor expanded in y around 0 88.0%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.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 <= -1.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 <= (-1.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 <= -1.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 <= -1.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 <= -1.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 <= -1.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, -1.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 -1 \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 < -1 or 1 < y Initial program 79.6%
Taylor expanded in y around inf 77.9%
associate-/l*98.1%
div-sub98.1%
sub-neg98.1%
*-inverses98.1%
sub-neg98.1%
Simplified98.1%
if -1 < y < 1Initial program 99.9%
Taylor expanded in x around 0 99.7%
Taylor expanded in y around 0 98.4%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (if (<= y -1.0) (* y (/ (- z x) z)) (if (<= y 1.0) (+ y (/ x z)) (* y (- 1.0 (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.0) {
tmp = y * ((z - x) / z);
} else if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = y * (1.0 - (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 * ((z - x) / z)
else if (y <= 1.0d0) then
tmp = y + (x / z)
else
tmp = y * (1.0d0 - (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 * ((z - x) / z);
} else if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = y * (1.0 - (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.0: tmp = y * ((z - x) / z) elif y <= 1.0: tmp = y + (x / z) else: tmp = y * (1.0 - (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.0) tmp = Float64(y * Float64(Float64(z - x) / z)); elseif (y <= 1.0) tmp = Float64(y + Float64(x / z)); else tmp = Float64(y * Float64(1.0 - Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.0) tmp = y * ((z - x) / z); elseif (y <= 1.0) tmp = y + (x / z); else tmp = y * (1.0 - (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.0], N[(y * N[(N[(z - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;y \cdot \frac{z - x}{z}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\end{array}
\end{array}
if y < -1Initial program 88.4%
Taylor expanded in y around inf 85.8%
associate-/l*97.3%
Simplified97.3%
if -1 < y < 1Initial program 99.9%
Taylor expanded in x around 0 99.7%
Taylor expanded in y around 0 98.4%
if 1 < y Initial program 70.7%
Taylor expanded in y around inf 69.9%
associate-/l*99.0%
div-sub99.0%
sub-neg99.0%
*-inverses99.0%
sub-neg99.0%
Simplified99.0%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (if (<= y -1.0) (/ y (/ z (- z x))) (if (<= y 1.0) (+ y (/ x z)) (* y (- 1.0 (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.0) {
tmp = y / (z / (z - x));
} else if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = y * (1.0 - (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 / (z / (z - x))
else if (y <= 1.0d0) then
tmp = y + (x / z)
else
tmp = y * (1.0d0 - (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 / (z / (z - x));
} else if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = y * (1.0 - (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.0: tmp = y / (z / (z - x)) elif y <= 1.0: tmp = y + (x / z) else: tmp = y * (1.0 - (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.0) tmp = Float64(y / Float64(z / Float64(z - x))); elseif (y <= 1.0) tmp = Float64(y + Float64(x / z)); else tmp = Float64(y * Float64(1.0 - Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.0) tmp = y / (z / (z - x)); elseif (y <= 1.0) tmp = y + (x / z); else tmp = y * (1.0 - (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.0], N[(y / N[(z / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;\frac{y}{\frac{z}{z - x}}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\end{array}
\end{array}
if y < -1Initial program 88.4%
Taylor expanded in y around inf 85.8%
associate-/l*97.3%
Simplified97.3%
clear-num97.3%
un-div-inv97.3%
Applied egg-rr97.3%
if -1 < y < 1Initial program 99.9%
Taylor expanded in x around 0 99.7%
Taylor expanded in y around 0 98.4%
if 1 < y Initial program 70.7%
Taylor expanded in y around inf 69.9%
associate-/l*99.0%
div-sub99.0%
sub-neg99.0%
*-inverses99.0%
sub-neg99.0%
Simplified99.0%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (if (<= y -3.8e-8) y (if (<= y 2.1e-50) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.8e-8) {
tmp = y;
} else if (y <= 2.1e-50) {
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 <= (-3.8d-8)) then
tmp = y
else if (y <= 2.1d-50) 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 <= -3.8e-8) {
tmp = y;
} else if (y <= 2.1e-50) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.8e-8: tmp = y elif y <= 2.1e-50: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.8e-8) tmp = y; elseif (y <= 2.1e-50) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.8e-8) tmp = y; elseif (y <= 2.1e-50) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.8e-8], y, If[LessEqual[y, 2.1e-50], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{-8}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{-50}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -3.80000000000000028e-8 or 2.1000000000000001e-50 < y Initial program 81.0%
Taylor expanded in x around 0 51.2%
if -3.80000000000000028e-8 < y < 2.1000000000000001e-50Initial program 99.9%
Taylor expanded in y around 0 73.6%
Final simplification61.5%
(FPCore (x y z) :precision binary64 (if (<= y -2.8e-8) (* z (/ y z)) (if (<= y 1.4e-53) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.8e-8) {
tmp = z * (y / z);
} else if (y <= 1.4e-53) {
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 <= (-2.8d-8)) then
tmp = z * (y / z)
else if (y <= 1.4d-53) 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 <= -2.8e-8) {
tmp = z * (y / z);
} else if (y <= 1.4e-53) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.8e-8: tmp = z * (y / z) elif y <= 1.4e-53: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.8e-8) tmp = Float64(z * Float64(y / z)); elseif (y <= 1.4e-53) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.8e-8) tmp = z * (y / z); elseif (y <= 1.4e-53) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.8e-8], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e-53], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{-8}:\\
\;\;\;\;z \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-53}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -2.7999999999999999e-8Initial program 88.5%
Taylor expanded in y around inf 86.0%
Taylor expanded in z around inf 45.9%
*-commutative45.9%
associate-/l*56.8%
Applied egg-rr56.8%
if -2.7999999999999999e-8 < y < 1.39999999999999993e-53Initial program 99.9%
Taylor expanded in y around 0 73.6%
if 1.39999999999999993e-53 < y Initial program 74.2%
Taylor expanded in x around 0 49.2%
Final simplification62.3%
(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 96.0%
Taylor expanded in x around 0 96.3%
Taylor expanded in y around 0 85.7%
if 1 < y Initial program 70.7%
Taylor expanded in x around 0 89.5%
Taylor expanded in y around 0 48.9%
frac-2neg48.9%
div-inv48.9%
add-sqr-sqrt26.2%
sqrt-unprod54.9%
sqr-neg54.9%
sqrt-unprod27.9%
add-sqr-sqrt60.8%
cancel-sign-sub-inv60.8%
div-inv60.8%
Applied egg-rr60.8%
Final simplification79.5%
(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.7%
Taylor expanded in x around 0 94.6%
Taylor expanded in y around 0 76.5%
Final simplification76.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 89.7%
Taylor expanded in x around 0 40.9%
Final simplification40.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 2024115
(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))