
(FPCore (x y z) :precision binary64 (/ (- x y) (- z y)))
double code(double x, double y, double z) {
return (x - y) / (z - y);
}
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 - y)
end function
public static double code(double x, double y, double z) {
return (x - y) / (z - y);
}
def code(x, y, z): return (x - y) / (z - y)
function code(x, y, z) return Float64(Float64(x - y) / Float64(z - y)) end
function tmp = code(x, y, z) tmp = (x - y) / (z - y); end
code[x_, y_, z_] := N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (- x y) (- z y)))
double code(double x, double y, double z) {
return (x - y) / (z - y);
}
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 - y)
end function
public static double code(double x, double y, double z) {
return (x - y) / (z - y);
}
def code(x, y, z): return (x - y) / (z - y)
function code(x, y, z) return Float64(Float64(x - y) / Float64(z - y)) end
function tmp = code(x, y, z) tmp = (x - y) / (z - y); end
code[x_, y_, z_] := N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y}
\end{array}
(FPCore (x y z) :precision binary64 (/ (- x y) (- z y)))
double code(double x, double y, double z) {
return (x - y) / (z - y);
}
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 - y)
end function
public static double code(double x, double y, double z) {
return (x - y) / (z - y);
}
def code(x, y, z): return (x - y) / (z - y)
function code(x, y, z) return Float64(Float64(x - y) / Float64(z - y)) end
function tmp = code(x, y, z) tmp = (x - y) / (z - y); end
code[x_, y_, z_] := N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y}
\end{array}
Initial program 100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -3.1e+111)
t_0
(if (<= y -2.4e-27)
(/ y (- y z))
(if (or (<= y -2.55e-80) (not (<= y 1.32e+29))) t_0 (/ (- x y) z))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -3.1e+111) {
tmp = t_0;
} else if (y <= -2.4e-27) {
tmp = y / (y - z);
} else if ((y <= -2.55e-80) || !(y <= 1.32e+29)) {
tmp = t_0;
} else {
tmp = (x - y) / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x / y)
if (y <= (-3.1d+111)) then
tmp = t_0
else if (y <= (-2.4d-27)) then
tmp = y / (y - z)
else if ((y <= (-2.55d-80)) .or. (.not. (y <= 1.32d+29))) then
tmp = t_0
else
tmp = (x - y) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -3.1e+111) {
tmp = t_0;
} else if (y <= -2.4e-27) {
tmp = y / (y - z);
} else if ((y <= -2.55e-80) || !(y <= 1.32e+29)) {
tmp = t_0;
} else {
tmp = (x - y) / z;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (x / y) tmp = 0 if y <= -3.1e+111: tmp = t_0 elif y <= -2.4e-27: tmp = y / (y - z) elif (y <= -2.55e-80) or not (y <= 1.32e+29): tmp = t_0 else: tmp = (x - y) / z return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(x / y)) tmp = 0.0 if (y <= -3.1e+111) tmp = t_0; elseif (y <= -2.4e-27) tmp = Float64(y / Float64(y - z)); elseif ((y <= -2.55e-80) || !(y <= 1.32e+29)) tmp = t_0; else tmp = Float64(Float64(x - y) / z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (x / y); tmp = 0.0; if (y <= -3.1e+111) tmp = t_0; elseif (y <= -2.4e-27) tmp = y / (y - z); elseif ((y <= -2.55e-80) || ~((y <= 1.32e+29))) tmp = t_0; else tmp = (x - y) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.1e+111], t$95$0, If[LessEqual[y, -2.4e-27], N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -2.55e-80], N[Not[LessEqual[y, 1.32e+29]], $MachinePrecision]], t$95$0, N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -3.1 \cdot 10^{+111}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -2.4 \cdot 10^{-27}:\\
\;\;\;\;\frac{y}{y - z}\\
\mathbf{elif}\;y \leq -2.55 \cdot 10^{-80} \lor \neg \left(y \leq 1.32 \cdot 10^{+29}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{z}\\
\end{array}
\end{array}
if y < -3.1e111 or -2.40000000000000002e-27 < y < -2.55000000000000004e-80 or 1.32e29 < y Initial program 100.0%
Taylor expanded in z around 0 83.2%
div-sub83.2%
sub-neg83.2%
*-inverses83.2%
metadata-eval83.2%
distribute-lft-in83.2%
metadata-eval83.2%
+-commutative83.2%
mul-1-neg83.2%
unsub-neg83.2%
Simplified83.2%
if -3.1e111 < y < -2.40000000000000002e-27Initial program 99.9%
Taylor expanded in x around 0 79.0%
neg-mul-179.0%
distribute-neg-frac79.0%
Simplified79.0%
if -2.55000000000000004e-80 < y < 1.32e29Initial program 100.0%
Taylor expanded in z around inf 83.3%
Final simplification82.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -4.6e+110)
t_0
(if (<= y -3.6e-28)
(/ y (- y z))
(if (or (<= y -1.45e-81) (not (<= y 1.9e+30))) t_0 (/ (- x y) z))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -4.6e+110) {
tmp = t_0;
} else if (y <= -3.6e-28) {
tmp = y / (y - z);
} else if ((y <= -1.45e-81) || !(y <= 1.9e+30)) {
tmp = t_0;
} else {
tmp = (x - y) / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x / y)
if (y <= (-4.6d+110)) then
tmp = t_0
else if (y <= (-3.6d-28)) then
tmp = y / (y - z)
else if ((y <= (-1.45d-81)) .or. (.not. (y <= 1.9d+30))) then
tmp = t_0
else
tmp = (x - y) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -4.6e+110) {
tmp = t_0;
} else if (y <= -3.6e-28) {
tmp = y / (y - z);
} else if ((y <= -1.45e-81) || !(y <= 1.9e+30)) {
tmp = t_0;
} else {
tmp = (x - y) / z;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (x / y) tmp = 0 if y <= -4.6e+110: tmp = t_0 elif y <= -3.6e-28: tmp = y / (y - z) elif (y <= -1.45e-81) or not (y <= 1.9e+30): tmp = t_0 else: tmp = (x - y) / z return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(x / y)) tmp = 0.0 if (y <= -4.6e+110) tmp = t_0; elseif (y <= -3.6e-28) tmp = Float64(y / Float64(y - z)); elseif ((y <= -1.45e-81) || !(y <= 1.9e+30)) tmp = t_0; else tmp = Float64(Float64(x - y) / z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (x / y); tmp = 0.0; if (y <= -4.6e+110) tmp = t_0; elseif (y <= -3.6e-28) tmp = y / (y - z); elseif ((y <= -1.45e-81) || ~((y <= 1.9e+30))) tmp = t_0; else tmp = (x - y) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.6e+110], t$95$0, If[LessEqual[y, -3.6e-28], N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -1.45e-81], N[Not[LessEqual[y, 1.9e+30]], $MachinePrecision]], t$95$0, N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -4.6 \cdot 10^{+110}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{-28}:\\
\;\;\;\;\frac{y}{y - z}\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{-81} \lor \neg \left(y \leq 1.9 \cdot 10^{+30}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{z}\\
\end{array}
\end{array}
if y < -4.6e110 or -3.5999999999999999e-28 < y < -1.44999999999999994e-81 or 1.9000000000000001e30 < y Initial program 100.0%
Taylor expanded in z around 0 83.2%
div-sub83.2%
sub-neg83.2%
*-inverses83.2%
metadata-eval83.2%
distribute-lft-in83.2%
metadata-eval83.2%
+-commutative83.2%
mul-1-neg83.2%
unsub-neg83.2%
Simplified83.2%
if -4.6e110 < y < -3.5999999999999999e-28Initial program 99.9%
clear-num99.6%
associate-/r/99.4%
Applied egg-rr99.4%
associate-*l/99.9%
*-un-lft-identity99.9%
clear-num99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 79.0%
mul-1-neg79.0%
distribute-neg-frac279.0%
neg-sub079.0%
associate-+l-79.0%
neg-sub079.0%
+-commutative79.0%
unsub-neg79.0%
Simplified79.0%
if -1.44999999999999994e-81 < y < 1.9000000000000001e30Initial program 100.0%
Taylor expanded in z around inf 83.3%
Final simplification82.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -1.16e+110)
t_0
(if (<= y -3.2e-27)
(/ y (- y z))
(if (<= y -2.55e-80)
(- 1.0 (/ (- x z) y))
(if (<= y 1.1e+35) (/ (- x y) z) t_0))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -1.16e+110) {
tmp = t_0;
} else if (y <= -3.2e-27) {
tmp = y / (y - z);
} else if (y <= -2.55e-80) {
tmp = 1.0 - ((x - z) / y);
} else if (y <= 1.1e+35) {
tmp = (x - y) / z;
} else {
tmp = t_0;
}
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 = 1.0d0 - (x / y)
if (y <= (-1.16d+110)) then
tmp = t_0
else if (y <= (-3.2d-27)) then
tmp = y / (y - z)
else if (y <= (-2.55d-80)) then
tmp = 1.0d0 - ((x - z) / y)
else if (y <= 1.1d+35) then
tmp = (x - y) / z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -1.16e+110) {
tmp = t_0;
} else if (y <= -3.2e-27) {
tmp = y / (y - z);
} else if (y <= -2.55e-80) {
tmp = 1.0 - ((x - z) / y);
} else if (y <= 1.1e+35) {
tmp = (x - y) / z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (x / y) tmp = 0 if y <= -1.16e+110: tmp = t_0 elif y <= -3.2e-27: tmp = y / (y - z) elif y <= -2.55e-80: tmp = 1.0 - ((x - z) / y) elif y <= 1.1e+35: tmp = (x - y) / z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(x / y)) tmp = 0.0 if (y <= -1.16e+110) tmp = t_0; elseif (y <= -3.2e-27) tmp = Float64(y / Float64(y - z)); elseif (y <= -2.55e-80) tmp = Float64(1.0 - Float64(Float64(x - z) / y)); elseif (y <= 1.1e+35) tmp = Float64(Float64(x - y) / z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (x / y); tmp = 0.0; if (y <= -1.16e+110) tmp = t_0; elseif (y <= -3.2e-27) tmp = y / (y - z); elseif (y <= -2.55e-80) tmp = 1.0 - ((x - z) / y); elseif (y <= 1.1e+35) tmp = (x - y) / z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.16e+110], t$95$0, If[LessEqual[y, -3.2e-27], N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.55e-80], N[(1.0 - N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e+35], N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -1.16 \cdot 10^{+110}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -3.2 \cdot 10^{-27}:\\
\;\;\;\;\frac{y}{y - z}\\
\mathbf{elif}\;y \leq -2.55 \cdot 10^{-80}:\\
\;\;\;\;1 - \frac{x - z}{y}\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+35}:\\
\;\;\;\;\frac{x - y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.16e110 or 1.0999999999999999e35 < y Initial program 100.0%
Taylor expanded in z around 0 84.7%
div-sub84.7%
sub-neg84.7%
*-inverses84.7%
metadata-eval84.7%
distribute-lft-in84.7%
metadata-eval84.7%
+-commutative84.7%
mul-1-neg84.7%
unsub-neg84.7%
Simplified84.7%
if -1.16e110 < y < -3.19999999999999991e-27Initial program 99.9%
Taylor expanded in x around 0 79.0%
neg-mul-179.0%
distribute-neg-frac79.0%
Simplified79.0%
if -3.19999999999999991e-27 < y < -2.55000000000000004e-80Initial program 99.9%
Taylor expanded in y around inf 72.9%
associate-+r-72.9%
distribute-lft-out--72.9%
div-sub72.9%
mul-1-neg72.9%
unsub-neg72.9%
Simplified72.9%
if -2.55000000000000004e-80 < y < 1.0999999999999999e35Initial program 100.0%
Taylor expanded in z around inf 83.3%
Final simplification82.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))) (t_1 (/ y (- y z))))
(if (<= y -3.15e+109)
t_0
(if (<= y -1.12e-44)
t_1
(if (<= y 4.2e-50) (/ x (- z y)) (if (<= y 7.2e+117) t_1 t_0))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (x / y);
double t_1 = y / (y - z);
double tmp;
if (y <= -3.15e+109) {
tmp = t_0;
} else if (y <= -1.12e-44) {
tmp = t_1;
} else if (y <= 4.2e-50) {
tmp = x / (z - y);
} else if (y <= 7.2e+117) {
tmp = t_1;
} else {
tmp = t_0;
}
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) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (x / y)
t_1 = y / (y - z)
if (y <= (-3.15d+109)) then
tmp = t_0
else if (y <= (-1.12d-44)) then
tmp = t_1
else if (y <= 4.2d-50) then
tmp = x / (z - y)
else if (y <= 7.2d+117) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 - (x / y);
double t_1 = y / (y - z);
double tmp;
if (y <= -3.15e+109) {
tmp = t_0;
} else if (y <= -1.12e-44) {
tmp = t_1;
} else if (y <= 4.2e-50) {
tmp = x / (z - y);
} else if (y <= 7.2e+117) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (x / y) t_1 = y / (y - z) tmp = 0 if y <= -3.15e+109: tmp = t_0 elif y <= -1.12e-44: tmp = t_1 elif y <= 4.2e-50: tmp = x / (z - y) elif y <= 7.2e+117: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(x / y)) t_1 = Float64(y / Float64(y - z)) tmp = 0.0 if (y <= -3.15e+109) tmp = t_0; elseif (y <= -1.12e-44) tmp = t_1; elseif (y <= 4.2e-50) tmp = Float64(x / Float64(z - y)); elseif (y <= 7.2e+117) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (x / y); t_1 = y / (y - z); tmp = 0.0; if (y <= -3.15e+109) tmp = t_0; elseif (y <= -1.12e-44) tmp = t_1; elseif (y <= 4.2e-50) tmp = x / (z - y); elseif (y <= 7.2e+117) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.15e+109], t$95$0, If[LessEqual[y, -1.12e-44], t$95$1, If[LessEqual[y, 4.2e-50], N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e+117], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
t_1 := \frac{y}{y - z}\\
\mathbf{if}\;y \leq -3.15 \cdot 10^{+109}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1.12 \cdot 10^{-44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-50}:\\
\;\;\;\;\frac{x}{z - y}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+117}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -3.14999999999999981e109 or 7.20000000000000025e117 < y Initial program 100.0%
Taylor expanded in z around 0 89.1%
div-sub89.1%
sub-neg89.1%
*-inverses89.1%
metadata-eval89.1%
distribute-lft-in89.1%
metadata-eval89.1%
+-commutative89.1%
mul-1-neg89.1%
unsub-neg89.1%
Simplified89.1%
if -3.14999999999999981e109 < y < -1.1200000000000001e-44 or 4.2000000000000002e-50 < y < 7.20000000000000025e117Initial program 99.9%
clear-num99.7%
associate-/r/99.6%
Applied egg-rr99.6%
associate-*l/99.9%
*-un-lft-identity99.9%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 75.2%
mul-1-neg75.2%
distribute-neg-frac275.2%
neg-sub075.2%
associate-+l-75.2%
neg-sub075.2%
+-commutative75.2%
unsub-neg75.2%
Simplified75.2%
if -1.1200000000000001e-44 < y < 4.2000000000000002e-50Initial program 100.0%
Taylor expanded in x around inf 79.9%
(FPCore (x y z) :precision binary64 (if (<= y -1.12e-44) 1.0 (if (<= y 3.4e-38) (/ x z) (if (<= y 2.5e+88) (/ y (- z)) 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.12e-44) {
tmp = 1.0;
} else if (y <= 3.4e-38) {
tmp = x / z;
} else if (y <= 2.5e+88) {
tmp = y / -z;
} else {
tmp = 1.0;
}
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.12d-44)) then
tmp = 1.0d0
else if (y <= 3.4d-38) then
tmp = x / z
else if (y <= 2.5d+88) then
tmp = y / -z
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.12e-44) {
tmp = 1.0;
} else if (y <= 3.4e-38) {
tmp = x / z;
} else if (y <= 2.5e+88) {
tmp = y / -z;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.12e-44: tmp = 1.0 elif y <= 3.4e-38: tmp = x / z elif y <= 2.5e+88: tmp = y / -z else: tmp = 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.12e-44) tmp = 1.0; elseif (y <= 3.4e-38) tmp = Float64(x / z); elseif (y <= 2.5e+88) tmp = Float64(y / Float64(-z)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.12e-44) tmp = 1.0; elseif (y <= 3.4e-38) tmp = x / z; elseif (y <= 2.5e+88) tmp = y / -z; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.12e-44], 1.0, If[LessEqual[y, 3.4e-38], N[(x / z), $MachinePrecision], If[LessEqual[y, 2.5e+88], N[(y / (-z)), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.12 \cdot 10^{-44}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{-38}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+88}:\\
\;\;\;\;\frac{y}{-z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.1200000000000001e-44 or 2.49999999999999999e88 < y Initial program 99.9%
Taylor expanded in y around inf 61.6%
if -1.1200000000000001e-44 < y < 3.4000000000000002e-38Initial program 100.0%
Taylor expanded in y around 0 69.2%
if 3.4000000000000002e-38 < y < 2.49999999999999999e88Initial program 100.0%
Taylor expanded in z around inf 58.6%
Taylor expanded in x around 0 47.1%
neg-mul-147.1%
distribute-neg-frac47.1%
Simplified47.1%
Final simplification64.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.95e-44) (not (<= y 5.9e+32))) (- 1.0 (/ x y)) (/ x (- z y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.95e-44) || !(y <= 5.9e+32)) {
tmp = 1.0 - (x / y);
} else {
tmp = x / (z - 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.95d-44)) .or. (.not. (y <= 5.9d+32))) then
tmp = 1.0d0 - (x / y)
else
tmp = x / (z - y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.95e-44) || !(y <= 5.9e+32)) {
tmp = 1.0 - (x / y);
} else {
tmp = x / (z - y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.95e-44) or not (y <= 5.9e+32): tmp = 1.0 - (x / y) else: tmp = x / (z - y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.95e-44) || !(y <= 5.9e+32)) tmp = Float64(1.0 - Float64(x / y)); else tmp = Float64(x / Float64(z - y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.95e-44) || ~((y <= 5.9e+32))) tmp = 1.0 - (x / y); else tmp = x / (z - y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.95e-44], N[Not[LessEqual[y, 5.9e+32]], $MachinePrecision]], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{-44} \lor \neg \left(y \leq 5.9 \cdot 10^{+32}\right):\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z - y}\\
\end{array}
\end{array}
if y < -1.9500000000000001e-44 or 5.89999999999999965e32 < y Initial program 100.0%
Taylor expanded in z around 0 79.3%
div-sub79.3%
sub-neg79.3%
*-inverses79.3%
metadata-eval79.3%
distribute-lft-in79.3%
metadata-eval79.3%
+-commutative79.3%
mul-1-neg79.3%
unsub-neg79.3%
Simplified79.3%
if -1.9500000000000001e-44 < y < 5.89999999999999965e32Initial program 100.0%
Taylor expanded in x around inf 76.6%
Final simplification78.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -5.6e-99) (not (<= y 5.5e-74))) (- 1.0 (/ x y)) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5.6e-99) || !(y <= 5.5e-74)) {
tmp = 1.0 - (x / y);
} 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 <= (-5.6d-99)) .or. (.not. (y <= 5.5d-74))) then
tmp = 1.0d0 - (x / y)
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -5.6e-99) || !(y <= 5.5e-74)) {
tmp = 1.0 - (x / y);
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5.6e-99) or not (y <= 5.5e-74): tmp = 1.0 - (x / y) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5.6e-99) || !(y <= 5.5e-74)) tmp = Float64(1.0 - Float64(x / y)); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5.6e-99) || ~((y <= 5.5e-74))) tmp = 1.0 - (x / y); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5.6e-99], N[Not[LessEqual[y, 5.5e-74]], $MachinePrecision]], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.6 \cdot 10^{-99} \lor \neg \left(y \leq 5.5 \cdot 10^{-74}\right):\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -5.6000000000000001e-99 or 5.5000000000000001e-74 < y Initial program 99.9%
Taylor expanded in z around 0 73.4%
div-sub73.4%
sub-neg73.4%
*-inverses73.4%
metadata-eval73.4%
distribute-lft-in73.4%
metadata-eval73.4%
+-commutative73.4%
mul-1-neg73.4%
unsub-neg73.4%
Simplified73.4%
if -5.6000000000000001e-99 < y < 5.5000000000000001e-74Initial program 100.0%
Taylor expanded in y around 0 76.9%
Final simplification74.7%
(FPCore (x y z) :precision binary64 (if (<= y -2.9e-44) 1.0 (if (<= y 1.05e+88) (/ x z) 1.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.9e-44) {
tmp = 1.0;
} else if (y <= 1.05e+88) {
tmp = x / z;
} else {
tmp = 1.0;
}
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.9d-44)) then
tmp = 1.0d0
else if (y <= 1.05d+88) then
tmp = x / z
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.9e-44) {
tmp = 1.0;
} else if (y <= 1.05e+88) {
tmp = x / z;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.9e-44: tmp = 1.0 elif y <= 1.05e+88: tmp = x / z else: tmp = 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.9e-44) tmp = 1.0; elseif (y <= 1.05e+88) tmp = Float64(x / z); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.9e-44) tmp = 1.0; elseif (y <= 1.05e+88) tmp = x / z; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.9e-44], 1.0, If[LessEqual[y, 1.05e+88], N[(x / z), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{-44}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+88}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.9000000000000001e-44 or 1.05e88 < y Initial program 99.9%
Taylor expanded in y around inf 61.6%
if -2.9000000000000001e-44 < y < 1.05e88Initial program 100.0%
Taylor expanded in y around 0 63.4%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 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 = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
Taylor expanded in y around inf 35.9%
(FPCore (x y z) :precision binary64 (- (/ x (- z y)) (/ y (- z y))))
double code(double x, double y, double z) {
return (x / (z - y)) - (y / (z - y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x / (z - y)) - (y / (z - y))
end function
public static double code(double x, double y, double z) {
return (x / (z - y)) - (y / (z - y));
}
def code(x, y, z): return (x / (z - y)) - (y / (z - y))
function code(x, y, z) return Float64(Float64(x / Float64(z - y)) - Float64(y / Float64(z - y))) end
function tmp = code(x, y, z) tmp = (x / (z - y)) - (y / (z - y)); end
code[x_, y_, z_] := N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] - N[(y / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z - y} - \frac{y}{z - y}
\end{array}
herbie shell --seed 2024103
(FPCore (x y z)
:name "Graphics.Rasterific.Shading:$sgradientColorAt from Rasterific-0.6.1"
:precision binary64
:alt
(- (/ x (- z y)) (/ y (- z y)))
(/ (- x y) (- z y)))