
(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 8 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 (+ (/ y (- y z)) (/ x (- z y))))
double code(double x, double y, double z) {
return (y / (y - z)) + (x / (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 = (y / (y - z)) + (x / (z - y))
end function
public static double code(double x, double y, double z) {
return (y / (y - z)) + (x / (z - y));
}
def code(x, y, z): return (y / (y - z)) + (x / (z - y))
function code(x, y, z) return Float64(Float64(y / Float64(y - z)) + Float64(x / Float64(z - y))) end
function tmp = code(x, y, z) tmp = (y / (y - z)) + (x / (z - y)); end
code[x_, y_, z_] := N[(N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision] + N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{y - z} + \frac{x}{z - y}
\end{array}
Initial program 100.0%
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
sub-negN/A
+-commutativeN/A
distribute-neg-outN/A
remove-double-negN/A
sub-negN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f64100.0%
Simplified100.0%
div-subN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
--lowering--.f64100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (if (<= z -5.1e-52) (- (/ x z) (/ y z)) (if (<= z 5.2e-83) (- 1.0 (/ x y)) (/ (- x y) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.1e-52) {
tmp = (x / z) - (y / z);
} else if (z <= 5.2e-83) {
tmp = 1.0 - (x / y);
} 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) :: tmp
if (z <= (-5.1d-52)) then
tmp = (x / z) - (y / z)
else if (z <= 5.2d-83) then
tmp = 1.0d0 - (x / y)
else
tmp = (x - y) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5.1e-52) {
tmp = (x / z) - (y / z);
} else if (z <= 5.2e-83) {
tmp = 1.0 - (x / y);
} else {
tmp = (x - y) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.1e-52: tmp = (x / z) - (y / z) elif z <= 5.2e-83: tmp = 1.0 - (x / y) else: tmp = (x - y) / z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.1e-52) tmp = Float64(Float64(x / z) - Float64(y / z)); elseif (z <= 5.2e-83) tmp = Float64(1.0 - Float64(x / y)); else tmp = Float64(Float64(x - y) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.1e-52) tmp = (x / z) - (y / z); elseif (z <= 5.2e-83) tmp = 1.0 - (x / y); else tmp = (x - y) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.1e-52], N[(N[(x / z), $MachinePrecision] - N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.2e-83], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.1 \cdot 10^{-52}:\\
\;\;\;\;\frac{x}{z} - \frac{y}{z}\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-83}:\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{z}\\
\end{array}
\end{array}
if z < -5.09999999999999989e-52Initial program 99.9%
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
sub-negN/A
+-commutativeN/A
distribute-neg-outN/A
remove-double-negN/A
sub-negN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6499.9%
Simplified99.9%
Taylor expanded in z around inf
associate-*r/N/A
/-lowering-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6486.3%
Simplified86.3%
div-subN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6486.3%
Applied egg-rr86.3%
if -5.09999999999999989e-52 < z < 5.20000000000000018e-83Initial program 100.0%
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
sub-negN/A
+-commutativeN/A
distribute-neg-outN/A
remove-double-negN/A
sub-negN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in z around 0
div-subN/A
*-inversesN/A
--lowering--.f64N/A
/-lowering-/.f6484.7%
Simplified84.7%
if 5.20000000000000018e-83 < z Initial program 100.0%
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
sub-negN/A
+-commutativeN/A
distribute-neg-outN/A
remove-double-negN/A
sub-negN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in z around inf
associate-*r/N/A
/-lowering-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6473.6%
Simplified73.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (- x y) z))) (if (<= z -1.9e-49) t_0 (if (<= z 2.7e-83) (- 1.0 (/ x y)) t_0))))
double code(double x, double y, double z) {
double t_0 = (x - y) / z;
double tmp;
if (z <= -1.9e-49) {
tmp = t_0;
} else if (z <= 2.7e-83) {
tmp = 1.0 - (x / y);
} 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 = (x - y) / z
if (z <= (-1.9d-49)) then
tmp = t_0
else if (z <= 2.7d-83) then
tmp = 1.0d0 - (x / y)
else
tmp = t_0
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 (z <= -1.9e-49) {
tmp = t_0;
} else if (z <= 2.7e-83) {
tmp = 1.0 - (x / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x - y) / z tmp = 0 if z <= -1.9e-49: tmp = t_0 elif z <= 2.7e-83: tmp = 1.0 - (x / y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(x - y) / z) tmp = 0.0 if (z <= -1.9e-49) tmp = t_0; elseif (z <= 2.7e-83) tmp = Float64(1.0 - Float64(x / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x - y) / z; tmp = 0.0; if (z <= -1.9e-49) tmp = t_0; elseif (z <= 2.7e-83) tmp = 1.0 - (x / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[z, -1.9e-49], t$95$0, If[LessEqual[z, 2.7e-83], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x - y}{z}\\
\mathbf{if}\;z \leq -1.9 \cdot 10^{-49}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-83}:\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.8999999999999999e-49 or 2.69999999999999991e-83 < z Initial program 100.0%
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
sub-negN/A
+-commutativeN/A
distribute-neg-outN/A
remove-double-negN/A
sub-negN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in z around inf
associate-*r/N/A
/-lowering-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6479.8%
Simplified79.8%
if -1.8999999999999999e-49 < z < 2.69999999999999991e-83Initial program 100.0%
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
sub-negN/A
+-commutativeN/A
distribute-neg-outN/A
remove-double-negN/A
sub-negN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in z around 0
div-subN/A
*-inversesN/A
--lowering--.f64N/A
/-lowering-/.f6484.7%
Simplified84.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ y (- y z)))) (if (<= y -1.45e-71) t_0 (if (<= y 2.8e+86) (/ x z) t_0))))
double code(double x, double y, double z) {
double t_0 = y / (y - z);
double tmp;
if (y <= -1.45e-71) {
tmp = t_0;
} else if (y <= 2.8e+86) {
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 (y <= (-1.45d-71)) then
tmp = t_0
else if (y <= 2.8d+86) 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 (y <= -1.45e-71) {
tmp = t_0;
} else if (y <= 2.8e+86) {
tmp = x / z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y / (y - z) tmp = 0 if y <= -1.45e-71: tmp = t_0 elif y <= 2.8e+86: 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 (y <= -1.45e-71) tmp = t_0; elseif (y <= 2.8e+86) 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 (y <= -1.45e-71) tmp = t_0; elseif (y <= 2.8e+86) 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[y, -1.45e-71], t$95$0, If[LessEqual[y, 2.8e+86], N[(x / z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{y - z}\\
\mathbf{if}\;y \leq -1.45 \cdot 10^{-71}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+86}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.4499999999999999e-71 or 2.80000000000000004e86 < y Initial program 99.9%
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
sub-negN/A
+-commutativeN/A
distribute-neg-outN/A
remove-double-negN/A
sub-negN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6499.9%
Simplified99.9%
Taylor expanded in x around 0
/-lowering-/.f64N/A
--lowering--.f6472.7%
Simplified72.7%
if -1.4499999999999999e-71 < y < 2.80000000000000004e86Initial program 100.0%
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
sub-negN/A
+-commutativeN/A
distribute-neg-outN/A
remove-double-negN/A
sub-negN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in y around 0
/-lowering-/.f6470.8%
Simplified70.8%
(FPCore (x y z) :precision binary64 (if (<= z -3.65e+18) (/ x z) (if (<= z 9.2e-83) (- 1.0 (/ x y)) (/ x z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.65e+18) {
tmp = x / z;
} else if (z <= 9.2e-83) {
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 (z <= (-3.65d+18)) then
tmp = x / z
else if (z <= 9.2d-83) 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 (z <= -3.65e+18) {
tmp = x / z;
} else if (z <= 9.2e-83) {
tmp = 1.0 - (x / y);
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.65e+18: tmp = x / z elif z <= 9.2e-83: tmp = 1.0 - (x / y) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.65e+18) tmp = Float64(x / z); elseif (z <= 9.2e-83) 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 (z <= -3.65e+18) tmp = x / z; elseif (z <= 9.2e-83) tmp = 1.0 - (x / y); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.65e+18], N[(x / z), $MachinePrecision], If[LessEqual[z, 9.2e-83], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.65 \cdot 10^{+18}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-83}:\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if z < -3.65e18 or 9.19999999999999959e-83 < z Initial program 99.9%
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
sub-negN/A
+-commutativeN/A
distribute-neg-outN/A
remove-double-negN/A
sub-negN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6499.9%
Simplified99.9%
Taylor expanded in y around 0
/-lowering-/.f6462.8%
Simplified62.8%
if -3.65e18 < z < 9.19999999999999959e-83Initial program 100.0%
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
sub-negN/A
+-commutativeN/A
distribute-neg-outN/A
remove-double-negN/A
sub-negN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in z around 0
div-subN/A
*-inversesN/A
--lowering--.f64N/A
/-lowering-/.f6481.3%
Simplified81.3%
(FPCore (x y z) :precision binary64 (if (<= y -4.5e+56) 1.0 (if (<= y 3.5e+63) (/ x z) 1.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.5e+56) {
tmp = 1.0;
} else if (y <= 3.5e+63) {
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 <= (-4.5d+56)) then
tmp = 1.0d0
else if (y <= 3.5d+63) 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 <= -4.5e+56) {
tmp = 1.0;
} else if (y <= 3.5e+63) {
tmp = x / z;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.5e+56: tmp = 1.0 elif y <= 3.5e+63: tmp = x / z else: tmp = 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.5e+56) tmp = 1.0; elseif (y <= 3.5e+63) tmp = Float64(x / z); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4.5e+56) tmp = 1.0; elseif (y <= 3.5e+63) tmp = x / z; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.5e+56], 1.0, If[LessEqual[y, 3.5e+63], N[(x / z), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+56}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+63}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -4.5000000000000003e56 or 3.50000000000000029e63 < y Initial program 99.9%
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
sub-negN/A
+-commutativeN/A
distribute-neg-outN/A
remove-double-negN/A
sub-negN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6499.9%
Simplified99.9%
Taylor expanded in y around inf
Simplified65.4%
if -4.5000000000000003e56 < y < 3.50000000000000029e63Initial program 100.0%
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
sub-negN/A
+-commutativeN/A
distribute-neg-outN/A
remove-double-negN/A
sub-negN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in y around 0
/-lowering-/.f6464.9%
Simplified64.9%
(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 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-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
sub-negN/A
+-commutativeN/A
distribute-neg-outN/A
remove-double-negN/A
sub-negN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in y around inf
Simplified31.6%
(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 2024161
(FPCore (x y z)
:name "Graphics.Rasterific.Shading:$sgradientColorAt from Rasterific-0.6.1"
:precision binary64
:alt
(! :herbie-platform default (- (/ x (- z y)) (/ y (- z y))))
(/ (- x y) (- z y)))