
(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 7 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 (/ y (- y z))))
(if (<= z -4e+191)
(/ x z)
(if (<= z -6.4e+159)
t_0
(if (<= z -1.16e+64)
(/ x z)
(if (<= z 9.2e+29)
(- 1.0 (/ x y))
(if (or (<= z 1.12e+52)
(and (not (<= z 6.1e+116)) (<= z 1.26e+157)))
(/ x z)
t_0)))))))
double code(double x, double y, double z) {
double t_0 = y / (y - z);
double tmp;
if (z <= -4e+191) {
tmp = x / z;
} else if (z <= -6.4e+159) {
tmp = t_0;
} else if (z <= -1.16e+64) {
tmp = x / z;
} else if (z <= 9.2e+29) {
tmp = 1.0 - (x / y);
} else if ((z <= 1.12e+52) || (!(z <= 6.1e+116) && (z <= 1.26e+157))) {
tmp = x / 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 = y / (y - z)
if (z <= (-4d+191)) then
tmp = x / z
else if (z <= (-6.4d+159)) then
tmp = t_0
else if (z <= (-1.16d+64)) then
tmp = x / z
else if (z <= 9.2d+29) then
tmp = 1.0d0 - (x / y)
else if ((z <= 1.12d+52) .or. (.not. (z <= 6.1d+116)) .and. (z <= 1.26d+157)) then
tmp = x / z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y / (y - z);
double tmp;
if (z <= -4e+191) {
tmp = x / z;
} else if (z <= -6.4e+159) {
tmp = t_0;
} else if (z <= -1.16e+64) {
tmp = x / z;
} else if (z <= 9.2e+29) {
tmp = 1.0 - (x / y);
} else if ((z <= 1.12e+52) || (!(z <= 6.1e+116) && (z <= 1.26e+157))) {
tmp = x / z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y / (y - z) tmp = 0 if z <= -4e+191: tmp = x / z elif z <= -6.4e+159: tmp = t_0 elif z <= -1.16e+64: tmp = x / z elif z <= 9.2e+29: tmp = 1.0 - (x / y) elif (z <= 1.12e+52) or (not (z <= 6.1e+116) and (z <= 1.26e+157)): tmp = x / z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(y / Float64(y - z)) tmp = 0.0 if (z <= -4e+191) tmp = Float64(x / z); elseif (z <= -6.4e+159) tmp = t_0; elseif (z <= -1.16e+64) tmp = Float64(x / z); elseif (z <= 9.2e+29) tmp = Float64(1.0 - Float64(x / y)); elseif ((z <= 1.12e+52) || (!(z <= 6.1e+116) && (z <= 1.26e+157))) tmp = Float64(x / z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y / (y - z); tmp = 0.0; if (z <= -4e+191) tmp = x / z; elseif (z <= -6.4e+159) tmp = t_0; elseif (z <= -1.16e+64) tmp = x / z; elseif (z <= 9.2e+29) tmp = 1.0 - (x / y); elseif ((z <= 1.12e+52) || (~((z <= 6.1e+116)) && (z <= 1.26e+157))) tmp = x / z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4e+191], N[(x / z), $MachinePrecision], If[LessEqual[z, -6.4e+159], t$95$0, If[LessEqual[z, -1.16e+64], N[(x / z), $MachinePrecision], If[LessEqual[z, 9.2e+29], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 1.12e+52], And[N[Not[LessEqual[z, 6.1e+116]], $MachinePrecision], LessEqual[z, 1.26e+157]]], N[(x / z), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{y - z}\\
\mathbf{if}\;z \leq -4 \cdot 10^{+191}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq -6.4 \cdot 10^{+159}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.16 \cdot 10^{+64}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+29}:\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+52} \lor \neg \left(z \leq 6.1 \cdot 10^{+116}\right) \land z \leq 1.26 \cdot 10^{+157}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -4.00000000000000029e191 or -6.3999999999999997e159 < z < -1.16e64 or 9.2000000000000004e29 < z < 1.12000000000000002e52 or 6.10000000000000018e116 < z < 1.25999999999999996e157Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in y around 0 71.5%
if -4.00000000000000029e191 < z < -6.3999999999999997e159 or 1.12000000000000002e52 < z < 6.10000000000000018e116 or 1.25999999999999996e157 < z Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 73.7%
if -1.16e64 < z < 9.2000000000000004e29Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in z around 0 75.6%
div-sub75.6%
*-inverses75.6%
Simplified75.6%
Final simplification74.2%
(FPCore (x y z) :precision binary64 (if (<= y -18000000000000.0) 1.0 (if (<= y 1.7e+51) (/ x z) (if (<= y 2.3e+98) (/ (- x) y) 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -18000000000000.0) {
tmp = 1.0;
} else if (y <= 1.7e+51) {
tmp = x / z;
} else if (y <= 2.3e+98) {
tmp = -x / y;
} 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 <= (-18000000000000.0d0)) then
tmp = 1.0d0
else if (y <= 1.7d+51) then
tmp = x / z
else if (y <= 2.3d+98) then
tmp = -x / y
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -18000000000000.0) {
tmp = 1.0;
} else if (y <= 1.7e+51) {
tmp = x / z;
} else if (y <= 2.3e+98) {
tmp = -x / y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -18000000000000.0: tmp = 1.0 elif y <= 1.7e+51: tmp = x / z elif y <= 2.3e+98: tmp = -x / y else: tmp = 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -18000000000000.0) tmp = 1.0; elseif (y <= 1.7e+51) tmp = Float64(x / z); elseif (y <= 2.3e+98) tmp = Float64(Float64(-x) / y); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -18000000000000.0) tmp = 1.0; elseif (y <= 1.7e+51) tmp = x / z; elseif (y <= 2.3e+98) tmp = -x / y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -18000000000000.0], 1.0, If[LessEqual[y, 1.7e+51], N[(x / z), $MachinePrecision], If[LessEqual[y, 2.3e+98], N[((-x) / y), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -18000000000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{+51}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+98}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.8e13 or 2.30000000000000013e98 < y Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in y around inf 60.5%
if -1.8e13 < y < 1.69999999999999992e51Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in y around 0 61.5%
if 1.69999999999999992e51 < y < 2.30000000000000013e98Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
times-frac99.9%
metadata-eval99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in z around 0 58.0%
div-sub58.0%
*-inverses58.0%
Simplified58.0%
Taylor expanded in x around inf 51.8%
associate-*r/51.8%
mul-1-neg51.8%
Simplified51.8%
Final simplification60.5%
(FPCore (x y z) :precision binary64 (if (<= z -7.5e+63) (/ x z) (if (<= z 3.4e+31) (- 1.0 (/ x y)) (if (<= z 4e+217) (/ x z) (/ (- y) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -7.5e+63) {
tmp = x / z;
} else if (z <= 3.4e+31) {
tmp = 1.0 - (x / y);
} else if (z <= 4e+217) {
tmp = x / z;
} else {
tmp = -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 (z <= (-7.5d+63)) then
tmp = x / z
else if (z <= 3.4d+31) then
tmp = 1.0d0 - (x / y)
else if (z <= 4d+217) then
tmp = x / z
else
tmp = -y / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -7.5e+63) {
tmp = x / z;
} else if (z <= 3.4e+31) {
tmp = 1.0 - (x / y);
} else if (z <= 4e+217) {
tmp = x / z;
} else {
tmp = -y / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -7.5e+63: tmp = x / z elif z <= 3.4e+31: tmp = 1.0 - (x / y) elif z <= 4e+217: tmp = x / z else: tmp = -y / z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -7.5e+63) tmp = Float64(x / z); elseif (z <= 3.4e+31) tmp = Float64(1.0 - Float64(x / y)); elseif (z <= 4e+217) tmp = Float64(x / z); else tmp = Float64(Float64(-y) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -7.5e+63) tmp = x / z; elseif (z <= 3.4e+31) tmp = 1.0 - (x / y); elseif (z <= 4e+217) tmp = x / z; else tmp = -y / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -7.5e+63], N[(x / z), $MachinePrecision], If[LessEqual[z, 3.4e+31], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4e+217], N[(x / z), $MachinePrecision], N[((-y) / z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+63}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{+31}:\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+217}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{-y}{z}\\
\end{array}
\end{array}
if z < -7.5000000000000005e63 or 3.3999999999999998e31 < z < 3.99999999999999984e217Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in y around 0 57.6%
if -7.5000000000000005e63 < z < 3.3999999999999998e31Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in z around 0 75.6%
div-sub75.6%
*-inverses75.6%
Simplified75.6%
if 3.99999999999999984e217 < z Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 76.6%
Taylor expanded in y around 0 71.9%
associate-*r/71.9%
neg-mul-171.9%
Simplified71.9%
Final simplification68.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -7.5e+65) (not (<= z 3.5e+28))) (/ (- x y) z) (- 1.0 (/ x y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7.5e+65) || !(z <= 3.5e+28)) {
tmp = (x - y) / z;
} else {
tmp = 1.0 - (x / 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 <= (-7.5d+65)) .or. (.not. (z <= 3.5d+28))) then
tmp = (x - y) / z
else
tmp = 1.0d0 - (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -7.5e+65) || !(z <= 3.5e+28)) {
tmp = (x - y) / z;
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -7.5e+65) or not (z <= 3.5e+28): tmp = (x - y) / z else: tmp = 1.0 - (x / y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -7.5e+65) || !(z <= 3.5e+28)) tmp = Float64(Float64(x - y) / z); else tmp = Float64(1.0 - Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -7.5e+65) || ~((z <= 3.5e+28))) tmp = (x - y) / z; else tmp = 1.0 - (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -7.5e+65], N[Not[LessEqual[z, 3.5e+28]], $MachinePrecision]], N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+65} \lor \neg \left(z \leq 3.5 \cdot 10^{+28}\right):\\
\;\;\;\;\frac{x - y}{z}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y}\\
\end{array}
\end{array}
if z < -7.50000000000000006e65 or 3.5e28 < z Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in z around inf 83.0%
associate-*r/83.0%
neg-mul-183.0%
neg-sub083.0%
associate--r-83.0%
neg-sub083.0%
Simplified83.0%
Taylor expanded in y around 0 83.0%
+-commutative83.0%
mul-1-neg83.0%
sub-neg83.0%
div-sub83.0%
Simplified83.0%
if -7.50000000000000006e65 < z < 3.5e28Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in z around 0 75.6%
div-sub75.6%
*-inverses75.6%
Simplified75.6%
Final simplification78.9%
(FPCore (x y z) :precision binary64 (if (<= y -45000000000000.0) 1.0 (if (<= y 6.5e+95) (/ x z) 1.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -45000000000000.0) {
tmp = 1.0;
} else if (y <= 6.5e+95) {
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 <= (-45000000000000.0d0)) then
tmp = 1.0d0
else if (y <= 6.5d+95) 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 <= -45000000000000.0) {
tmp = 1.0;
} else if (y <= 6.5e+95) {
tmp = x / z;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -45000000000000.0: tmp = 1.0 elif y <= 6.5e+95: tmp = x / z else: tmp = 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -45000000000000.0) tmp = 1.0; elseif (y <= 6.5e+95) tmp = Float64(x / z); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -45000000000000.0) tmp = 1.0; elseif (y <= 6.5e+95) tmp = x / z; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -45000000000000.0], 1.0, If[LessEqual[y, 6.5e+95], N[(x / z), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -45000000000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+95}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -4.5e13 or 6.5e95 < y Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in y around inf 59.5%
if -4.5e13 < y < 6.5e95Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in y around 0 57.9%
Final simplification58.5%
(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%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in y around inf 30.1%
Final simplification30.1%
(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 2023257
(FPCore (x y z)
:name "Graphics.Rasterific.Shading:$sgradientColorAt from Rasterific-0.6.1"
:precision binary64
:herbie-target
(- (/ x (- z y)) (/ y (- z y)))
(/ (- x y) (- z y)))