
(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 9 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%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ x (- z y))))
(if (<= y -2.7e+79)
(- 1.0 (/ x y))
(if (<= y -2e-154)
t_0
(if (<= y 1.06e-190)
(/ (- x y) z)
(if (<= y 6.5e-20) t_0 (/ y (- y z))))))))
double code(double x, double y, double z) {
double t_0 = x / (z - y);
double tmp;
if (y <= -2.7e+79) {
tmp = 1.0 - (x / y);
} else if (y <= -2e-154) {
tmp = t_0;
} else if (y <= 1.06e-190) {
tmp = (x - y) / z;
} else if (y <= 6.5e-20) {
tmp = t_0;
} else {
tmp = y / (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 = x / (z - y)
if (y <= (-2.7d+79)) then
tmp = 1.0d0 - (x / y)
else if (y <= (-2d-154)) then
tmp = t_0
else if (y <= 1.06d-190) then
tmp = (x - y) / z
else if (y <= 6.5d-20) then
tmp = t_0
else
tmp = y / (y - 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 <= -2.7e+79) {
tmp = 1.0 - (x / y);
} else if (y <= -2e-154) {
tmp = t_0;
} else if (y <= 1.06e-190) {
tmp = (x - y) / z;
} else if (y <= 6.5e-20) {
tmp = t_0;
} else {
tmp = y / (y - z);
}
return tmp;
}
def code(x, y, z): t_0 = x / (z - y) tmp = 0 if y <= -2.7e+79: tmp = 1.0 - (x / y) elif y <= -2e-154: tmp = t_0 elif y <= 1.06e-190: tmp = (x - y) / z elif y <= 6.5e-20: tmp = t_0 else: tmp = y / (y - z) return tmp
function code(x, y, z) t_0 = Float64(x / Float64(z - y)) tmp = 0.0 if (y <= -2.7e+79) tmp = Float64(1.0 - Float64(x / y)); elseif (y <= -2e-154) tmp = t_0; elseif (y <= 1.06e-190) tmp = Float64(Float64(x - y) / z); elseif (y <= 6.5e-20) tmp = t_0; else tmp = Float64(y / Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x / (z - y); tmp = 0.0; if (y <= -2.7e+79) tmp = 1.0 - (x / y); elseif (y <= -2e-154) tmp = t_0; elseif (y <= 1.06e-190) tmp = (x - y) / z; elseif (y <= 6.5e-20) tmp = t_0; else tmp = y / (y - z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.7e+79], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2e-154], t$95$0, If[LessEqual[y, 1.06e-190], N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 6.5e-20], t$95$0, N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{z - y}\\
\mathbf{if}\;y \leq -2.7 \cdot 10^{+79}:\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{elif}\;y \leq -2 \cdot 10^{-154}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.06 \cdot 10^{-190}:\\
\;\;\;\;\frac{x - y}{z}\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{-20}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y - z}\\
\end{array}
\end{array}
if y < -2.7e79Initial program 100.0%
Taylor expanded in z around 0 90.7%
div-sub90.7%
sub-neg90.7%
*-inverses90.7%
metadata-eval90.7%
distribute-lft-in90.7%
metadata-eval90.7%
+-commutative90.7%
mul-1-neg90.7%
unsub-neg90.7%
Simplified90.7%
if -2.7e79 < y < -1.9999999999999999e-154 or 1.05999999999999997e-190 < y < 6.50000000000000032e-20Initial program 100.0%
Taylor expanded in x around inf 75.1%
if -1.9999999999999999e-154 < y < 1.05999999999999997e-190Initial program 100.0%
Taylor expanded in z around inf 92.0%
if 6.50000000000000032e-20 < y Initial program 99.9%
Taylor expanded in x around 0 79.8%
neg-mul-179.8%
distribute-neg-frac79.8%
Simplified79.8%
frac-2neg79.8%
div-inv79.7%
remove-double-neg79.7%
sub-neg79.7%
distribute-neg-in79.7%
neg-mul-179.7%
remove-double-neg79.7%
fma-define79.7%
Applied egg-rr79.7%
associate-*r/79.8%
*-rgt-identity79.8%
fma-undefine79.8%
neg-mul-179.8%
+-commutative79.8%
unsub-neg79.8%
Simplified79.8%
Final simplification83.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ x (- z y))))
(if (<= y -2.7e+79)
(+ 1.0 (/ (- z x) y))
(if (<= y -2.05e-154)
t_0
(if (<= y 1.25e-189)
(/ (- x y) z)
(if (<= y 1.25e-20) t_0 (/ y (- y z))))))))
double code(double x, double y, double z) {
double t_0 = x / (z - y);
double tmp;
if (y <= -2.7e+79) {
tmp = 1.0 + ((z - x) / y);
} else if (y <= -2.05e-154) {
tmp = t_0;
} else if (y <= 1.25e-189) {
tmp = (x - y) / z;
} else if (y <= 1.25e-20) {
tmp = t_0;
} else {
tmp = y / (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 = x / (z - y)
if (y <= (-2.7d+79)) then
tmp = 1.0d0 + ((z - x) / y)
else if (y <= (-2.05d-154)) then
tmp = t_0
else if (y <= 1.25d-189) then
tmp = (x - y) / z
else if (y <= 1.25d-20) then
tmp = t_0
else
tmp = y / (y - 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 <= -2.7e+79) {
tmp = 1.0 + ((z - x) / y);
} else if (y <= -2.05e-154) {
tmp = t_0;
} else if (y <= 1.25e-189) {
tmp = (x - y) / z;
} else if (y <= 1.25e-20) {
tmp = t_0;
} else {
tmp = y / (y - z);
}
return tmp;
}
def code(x, y, z): t_0 = x / (z - y) tmp = 0 if y <= -2.7e+79: tmp = 1.0 + ((z - x) / y) elif y <= -2.05e-154: tmp = t_0 elif y <= 1.25e-189: tmp = (x - y) / z elif y <= 1.25e-20: tmp = t_0 else: tmp = y / (y - z) return tmp
function code(x, y, z) t_0 = Float64(x / Float64(z - y)) tmp = 0.0 if (y <= -2.7e+79) tmp = Float64(1.0 + Float64(Float64(z - x) / y)); elseif (y <= -2.05e-154) tmp = t_0; elseif (y <= 1.25e-189) tmp = Float64(Float64(x - y) / z); elseif (y <= 1.25e-20) tmp = t_0; else tmp = Float64(y / Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x / (z - y); tmp = 0.0; if (y <= -2.7e+79) tmp = 1.0 + ((z - x) / y); elseif (y <= -2.05e-154) tmp = t_0; elseif (y <= 1.25e-189) tmp = (x - y) / z; elseif (y <= 1.25e-20) tmp = t_0; else tmp = y / (y - z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.7e+79], N[(1.0 + N[(N[(z - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.05e-154], t$95$0, If[LessEqual[y, 1.25e-189], N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 1.25e-20], t$95$0, N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{z - y}\\
\mathbf{if}\;y \leq -2.7 \cdot 10^{+79}:\\
\;\;\;\;1 + \frac{z - x}{y}\\
\mathbf{elif}\;y \leq -2.05 \cdot 10^{-154}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{-189}:\\
\;\;\;\;\frac{x - y}{z}\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{-20}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y - z}\\
\end{array}
\end{array}
if y < -2.7e79Initial program 100.0%
Taylor expanded in y around inf 90.8%
associate-+r-90.8%
distribute-lft-out--90.8%
div-sub90.8%
mul-1-neg90.8%
unsub-neg90.8%
Simplified90.8%
if -2.7e79 < y < -2.05e-154 or 1.2499999999999999e-189 < y < 1.25e-20Initial program 100.0%
Taylor expanded in x around inf 75.1%
if -2.05e-154 < y < 1.2499999999999999e-189Initial program 100.0%
Taylor expanded in z around inf 92.0%
if 1.25e-20 < y Initial program 99.9%
Taylor expanded in x around 0 79.8%
neg-mul-179.8%
distribute-neg-frac79.8%
Simplified79.8%
frac-2neg79.8%
div-inv79.7%
remove-double-neg79.7%
sub-neg79.7%
distribute-neg-in79.7%
neg-mul-179.7%
remove-double-neg79.7%
fma-define79.7%
Applied egg-rr79.7%
associate-*r/79.8%
*-rgt-identity79.8%
fma-undefine79.8%
neg-mul-179.8%
+-commutative79.8%
unsub-neg79.8%
Simplified79.8%
Final simplification83.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.4e-14) (not (<= y 1.28e-43))) (- 1.0 (/ x y)) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.4e-14) || !(y <= 1.28e-43)) {
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 <= (-1.4d-14)) .or. (.not. (y <= 1.28d-43))) 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 <= -1.4e-14) || !(y <= 1.28e-43)) {
tmp = 1.0 - (x / y);
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.4e-14) or not (y <= 1.28e-43): tmp = 1.0 - (x / y) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.4e-14) || !(y <= 1.28e-43)) 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 <= -1.4e-14) || ~((y <= 1.28e-43))) tmp = 1.0 - (x / y); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.4e-14], N[Not[LessEqual[y, 1.28e-43]], $MachinePrecision]], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{-14} \lor \neg \left(y \leq 1.28 \cdot 10^{-43}\right):\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -1.4e-14 or 1.27999999999999998e-43 < y Initial program 99.9%
Taylor expanded in z around 0 80.2%
div-sub80.2%
sub-neg80.2%
*-inverses80.2%
metadata-eval80.2%
distribute-lft-in80.2%
metadata-eval80.2%
+-commutative80.2%
mul-1-neg80.2%
unsub-neg80.2%
Simplified80.2%
if -1.4e-14 < y < 1.27999999999999998e-43Initial program 100.0%
Taylor expanded in y around 0 69.7%
Final simplification75.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.7e+79) (not (<= y 7.5e-11))) (- 1.0 (/ x y)) (/ x (- z y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.7e+79) || !(y <= 7.5e-11)) {
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 <= (-2.7d+79)) .or. (.not. (y <= 7.5d-11))) 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 <= -2.7e+79) || !(y <= 7.5e-11)) {
tmp = 1.0 - (x / y);
} else {
tmp = x / (z - y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.7e+79) or not (y <= 7.5e-11): tmp = 1.0 - (x / y) else: tmp = x / (z - y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.7e+79) || !(y <= 7.5e-11)) 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 <= -2.7e+79) || ~((y <= 7.5e-11))) tmp = 1.0 - (x / y); else tmp = x / (z - y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.7e+79], N[Not[LessEqual[y, 7.5e-11]], $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 -2.7 \cdot 10^{+79} \lor \neg \left(y \leq 7.5 \cdot 10^{-11}\right):\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z - y}\\
\end{array}
\end{array}
if y < -2.7e79 or 7.5e-11 < y Initial program 99.9%
Taylor expanded in z around 0 84.8%
div-sub84.8%
sub-neg84.8%
*-inverses84.8%
metadata-eval84.8%
distribute-lft-in84.8%
metadata-eval84.8%
+-commutative84.8%
mul-1-neg84.8%
unsub-neg84.8%
Simplified84.8%
if -2.7e79 < y < 7.5e-11Initial program 100.0%
Taylor expanded in x around inf 78.4%
Final simplification81.4%
(FPCore (x y z) :precision binary64 (if (<= y -2.7e+79) 1.0 (if (<= y 1.4e-13) (/ x z) (+ 1.0 (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.7e+79) {
tmp = 1.0;
} else if (y <= 1.4e-13) {
tmp = x / z;
} else {
tmp = 1.0 + (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 <= (-2.7d+79)) then
tmp = 1.0d0
else if (y <= 1.4d-13) then
tmp = x / z
else
tmp = 1.0d0 + (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.7e+79) {
tmp = 1.0;
} else if (y <= 1.4e-13) {
tmp = x / z;
} else {
tmp = 1.0 + (z / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.7e+79: tmp = 1.0 elif y <= 1.4e-13: tmp = x / z else: tmp = 1.0 + (z / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.7e+79) tmp = 1.0; elseif (y <= 1.4e-13) tmp = Float64(x / z); else tmp = Float64(1.0 + Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.7e+79) tmp = 1.0; elseif (y <= 1.4e-13) tmp = x / z; else tmp = 1.0 + (z / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.7e+79], 1.0, If[LessEqual[y, 1.4e-13], N[(x / z), $MachinePrecision], N[(1.0 + N[(z / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+79}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-13}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{z}{y}\\
\end{array}
\end{array}
if y < -2.7e79Initial program 100.0%
Taylor expanded in y around inf 75.3%
if -2.7e79 < y < 1.4000000000000001e-13Initial program 100.0%
Taylor expanded in y around 0 61.6%
if 1.4000000000000001e-13 < y Initial program 99.9%
Taylor expanded in y around inf 80.8%
associate-+r-80.8%
distribute-lft-out--80.8%
div-sub80.8%
mul-1-neg80.8%
unsub-neg80.8%
Simplified80.8%
Taylor expanded in x around 0 68.6%
Final simplification66.4%
(FPCore (x y z) :precision binary64 (if (<= y -2.7e+79) (- 1.0 (/ x y)) (if (<= y 3e-21) (/ x (- z y)) (/ y (- y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.7e+79) {
tmp = 1.0 - (x / y);
} else if (y <= 3e-21) {
tmp = x / (z - y);
} else {
tmp = y / (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 <= (-2.7d+79)) then
tmp = 1.0d0 - (x / y)
else if (y <= 3d-21) then
tmp = x / (z - y)
else
tmp = y / (y - z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.7e+79) {
tmp = 1.0 - (x / y);
} else if (y <= 3e-21) {
tmp = x / (z - y);
} else {
tmp = y / (y - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.7e+79: tmp = 1.0 - (x / y) elif y <= 3e-21: tmp = x / (z - y) else: tmp = y / (y - z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.7e+79) tmp = Float64(1.0 - Float64(x / y)); elseif (y <= 3e-21) tmp = Float64(x / Float64(z - y)); else tmp = Float64(y / Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.7e+79) tmp = 1.0 - (x / y); elseif (y <= 3e-21) tmp = x / (z - y); else tmp = y / (y - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.7e+79], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3e-21], N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision], N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+79}:\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-21}:\\
\;\;\;\;\frac{x}{z - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y - z}\\
\end{array}
\end{array}
if y < -2.7e79Initial program 100.0%
Taylor expanded in z around 0 90.7%
div-sub90.7%
sub-neg90.7%
*-inverses90.7%
metadata-eval90.7%
distribute-lft-in90.7%
metadata-eval90.7%
+-commutative90.7%
mul-1-neg90.7%
unsub-neg90.7%
Simplified90.7%
if -2.7e79 < y < 2.99999999999999991e-21Initial program 100.0%
Taylor expanded in x around inf 78.9%
if 2.99999999999999991e-21 < y Initial program 99.9%
Taylor expanded in x around 0 79.8%
neg-mul-179.8%
distribute-neg-frac79.8%
Simplified79.8%
frac-2neg79.8%
div-inv79.7%
remove-double-neg79.7%
sub-neg79.7%
distribute-neg-in79.7%
neg-mul-179.7%
remove-double-neg79.7%
fma-define79.7%
Applied egg-rr79.7%
associate-*r/79.8%
*-rgt-identity79.8%
fma-undefine79.8%
neg-mul-179.8%
+-commutative79.8%
unsub-neg79.8%
Simplified79.8%
Final simplification81.7%
(FPCore (x y z) :precision binary64 (if (<= y -2.7e+79) 1.0 (if (<= y 1.18e-18) (/ x z) 1.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.7e+79) {
tmp = 1.0;
} else if (y <= 1.18e-18) {
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.7d+79)) then
tmp = 1.0d0
else if (y <= 1.18d-18) 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.7e+79) {
tmp = 1.0;
} else if (y <= 1.18e-18) {
tmp = x / z;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.7e+79: tmp = 1.0 elif y <= 1.18e-18: tmp = x / z else: tmp = 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.7e+79) tmp = 1.0; elseif (y <= 1.18e-18) 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.7e+79) tmp = 1.0; elseif (y <= 1.18e-18) tmp = x / z; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.7e+79], 1.0, If[LessEqual[y, 1.18e-18], N[(x / z), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+79}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.18 \cdot 10^{-18}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.7e79 or 1.18000000000000008e-18 < y Initial program 99.9%
Taylor expanded in y around inf 71.2%
if -2.7e79 < y < 1.18000000000000008e-18Initial program 100.0%
Taylor expanded in y around 0 61.6%
Final simplification66.2%
(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 39.2%
Final simplification39.2%
(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 2024130
(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)))