
(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 (- z y)) (/ y (- y z))))
double code(double x, double y, double z) {
return (x / (z - y)) + (y / (y - 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 / (z - y)) + (y / (y - z))
end function
public static double code(double x, double y, double z) {
return (x / (z - y)) + (y / (y - z));
}
def code(x, y, z): return (x / (z - y)) + (y / (y - z))
function code(x, y, z) return Float64(Float64(x / Float64(z - y)) + Float64(y / Float64(y - z))) end
function tmp = code(x, y, z) tmp = (x / (z - y)) + (y / (y - z)); end
code[x_, y_, z_] := N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] + N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z - y} + \frac{y}{y - z}
\end{array}
Initial program 99.9%
div-sub99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -480.0)
t_0
(if (<= y 2.7e-74) (/ x (- z y)) (if (<= y 1.85e-28) (/ y (- z)) t_0)))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -480.0) {
tmp = t_0;
} else if (y <= 2.7e-74) {
tmp = x / (z - y);
} else if (y <= 1.85e-28) {
tmp = 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 <= (-480.0d0)) then
tmp = t_0
else if (y <= 2.7d-74) then
tmp = x / (z - y)
else if (y <= 1.85d-28) then
tmp = 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 <= -480.0) {
tmp = t_0;
} else if (y <= 2.7e-74) {
tmp = x / (z - y);
} else if (y <= 1.85e-28) {
tmp = y / -z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (x / y) tmp = 0 if y <= -480.0: tmp = t_0 elif y <= 2.7e-74: tmp = x / (z - y) elif y <= 1.85e-28: tmp = 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 <= -480.0) tmp = t_0; elseif (y <= 2.7e-74) tmp = Float64(x / Float64(z - y)); elseif (y <= 1.85e-28) tmp = Float64(y / Float64(-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 <= -480.0) tmp = t_0; elseif (y <= 2.7e-74) tmp = x / (z - y); elseif (y <= 1.85e-28) tmp = 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, -480.0], t$95$0, If[LessEqual[y, 2.7e-74], N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.85e-28], N[(y / (-z)), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -480:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-74}:\\
\;\;\;\;\frac{x}{z - y}\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{-28}:\\
\;\;\;\;\frac{y}{-z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -480 or 1.8500000000000001e-28 < y Initial program 99.9%
Taylor expanded in z around 0 75.4%
associate-*r/75.4%
neg-mul-175.4%
sub-neg75.4%
+-commutative75.4%
distribute-neg-in75.4%
remove-double-neg75.4%
sub-neg75.4%
div-sub75.4%
*-inverses75.4%
Simplified75.4%
if -480 < y < 2.70000000000000018e-74Initial program 99.9%
Taylor expanded in x around inf 80.6%
if 2.70000000000000018e-74 < y < 1.8500000000000001e-28Initial program 100.0%
Taylor expanded in x around 0 85.1%
neg-mul-185.1%
distribute-neg-frac285.1%
sub-neg85.1%
+-commutative85.1%
distribute-neg-in85.1%
remove-double-neg85.1%
sub-neg85.1%
Simplified85.1%
Taylor expanded in y around 0 77.5%
associate-*r/77.5%
neg-mul-177.5%
Simplified77.5%
Final simplification78.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -9.5e-104)
t_0
(if (<= y 9e-76) (/ x z) (if (<= y 2.2e-28) (/ y (- z)) t_0)))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -9.5e-104) {
tmp = t_0;
} else if (y <= 9e-76) {
tmp = x / z;
} else if (y <= 2.2e-28) {
tmp = 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 <= (-9.5d-104)) then
tmp = t_0
else if (y <= 9d-76) then
tmp = x / z
else if (y <= 2.2d-28) then
tmp = 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 <= -9.5e-104) {
tmp = t_0;
} else if (y <= 9e-76) {
tmp = x / z;
} else if (y <= 2.2e-28) {
tmp = y / -z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (x / y) tmp = 0 if y <= -9.5e-104: tmp = t_0 elif y <= 9e-76: tmp = x / z elif y <= 2.2e-28: tmp = 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 <= -9.5e-104) tmp = t_0; elseif (y <= 9e-76) tmp = Float64(x / z); elseif (y <= 2.2e-28) tmp = Float64(y / Float64(-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 <= -9.5e-104) tmp = t_0; elseif (y <= 9e-76) tmp = x / z; elseif (y <= 2.2e-28) tmp = 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, -9.5e-104], t$95$0, If[LessEqual[y, 9e-76], N[(x / z), $MachinePrecision], If[LessEqual[y, 2.2e-28], N[(y / (-z)), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -9.5 \cdot 10^{-104}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-76}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{-28}:\\
\;\;\;\;\frac{y}{-z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -9.5000000000000002e-104 or 2.19999999999999996e-28 < y Initial program 99.9%
Taylor expanded in z around 0 72.1%
associate-*r/72.1%
neg-mul-172.1%
sub-neg72.1%
+-commutative72.1%
distribute-neg-in72.1%
remove-double-neg72.1%
sub-neg72.1%
div-sub72.1%
*-inverses72.1%
Simplified72.1%
if -9.5000000000000002e-104 < y < 9.0000000000000001e-76Initial program 99.9%
Taylor expanded in y around 0 75.5%
if 9.0000000000000001e-76 < y < 2.19999999999999996e-28Initial program 100.0%
Taylor expanded in x around 0 85.1%
neg-mul-185.1%
distribute-neg-frac285.1%
sub-neg85.1%
+-commutative85.1%
distribute-neg-in85.1%
remove-double-neg85.1%
sub-neg85.1%
Simplified85.1%
Taylor expanded in y around 0 77.5%
associate-*r/77.5%
neg-mul-177.5%
Simplified77.5%
Final simplification73.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (/ z y))))
(if (<= y -0.8)
t_0
(if (<= y 3e-77) (/ x z) (if (<= y 1.38e+63) (/ y (- z)) t_0)))))
double code(double x, double y, double z) {
double t_0 = 1.0 + (z / y);
double tmp;
if (y <= -0.8) {
tmp = t_0;
} else if (y <= 3e-77) {
tmp = x / z;
} else if (y <= 1.38e+63) {
tmp = 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 + (z / y)
if (y <= (-0.8d0)) then
tmp = t_0
else if (y <= 3d-77) then
tmp = x / z
else if (y <= 1.38d+63) then
tmp = 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 + (z / y);
double tmp;
if (y <= -0.8) {
tmp = t_0;
} else if (y <= 3e-77) {
tmp = x / z;
} else if (y <= 1.38e+63) {
tmp = y / -z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + (z / y) tmp = 0 if y <= -0.8: tmp = t_0 elif y <= 3e-77: tmp = x / z elif y <= 1.38e+63: tmp = y / -z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(z / y)) tmp = 0.0 if (y <= -0.8) tmp = t_0; elseif (y <= 3e-77) tmp = Float64(x / z); elseif (y <= 1.38e+63) tmp = Float64(y / Float64(-z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + (z / y); tmp = 0.0; if (y <= -0.8) tmp = t_0; elseif (y <= 3e-77) tmp = x / z; elseif (y <= 1.38e+63) tmp = y / -z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(z / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.8], t$95$0, If[LessEqual[y, 3e-77], N[(x / z), $MachinePrecision], If[LessEqual[y, 1.38e+63], N[(y / (-z)), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{z}{y}\\
\mathbf{if}\;y \leq -0.8:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-77}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 1.38 \cdot 10^{+63}:\\
\;\;\;\;\frac{y}{-z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.80000000000000004 or 1.38e63 < y Initial program 99.9%
Taylor expanded in x around 0 82.0%
neg-mul-182.0%
distribute-neg-frac282.0%
sub-neg82.0%
+-commutative82.0%
distribute-neg-in82.0%
remove-double-neg82.0%
sub-neg82.0%
Simplified82.0%
Taylor expanded in y around inf 69.9%
if -0.80000000000000004 < y < 3.00000000000000016e-77Initial program 99.9%
Taylor expanded in y around 0 66.5%
if 3.00000000000000016e-77 < y < 1.38e63Initial program 99.9%
Taylor expanded in x around 0 75.0%
neg-mul-175.0%
distribute-neg-frac275.0%
sub-neg75.0%
+-commutative75.0%
distribute-neg-in75.0%
remove-double-neg75.0%
sub-neg75.0%
Simplified75.0%
Taylor expanded in y around 0 54.3%
associate-*r/54.3%
neg-mul-154.3%
Simplified54.3%
Final simplification66.4%
(FPCore (x y z) :precision binary64 (if (<= y -215.0) 1.0 (if (<= y 1.2e-74) (/ x z) (if (<= y 1.38e+63) (/ y (- z)) 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -215.0) {
tmp = 1.0;
} else if (y <= 1.2e-74) {
tmp = x / z;
} else if (y <= 1.38e+63) {
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 <= (-215.0d0)) then
tmp = 1.0d0
else if (y <= 1.2d-74) then
tmp = x / z
else if (y <= 1.38d+63) 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 <= -215.0) {
tmp = 1.0;
} else if (y <= 1.2e-74) {
tmp = x / z;
} else if (y <= 1.38e+63) {
tmp = y / -z;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -215.0: tmp = 1.0 elif y <= 1.2e-74: tmp = x / z elif y <= 1.38e+63: tmp = y / -z else: tmp = 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -215.0) tmp = 1.0; elseif (y <= 1.2e-74) tmp = Float64(x / z); elseif (y <= 1.38e+63) 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 <= -215.0) tmp = 1.0; elseif (y <= 1.2e-74) tmp = x / z; elseif (y <= 1.38e+63) tmp = y / -z; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -215.0], 1.0, If[LessEqual[y, 1.2e-74], N[(x / z), $MachinePrecision], If[LessEqual[y, 1.38e+63], N[(y / (-z)), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -215:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{-74}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 1.38 \cdot 10^{+63}:\\
\;\;\;\;\frac{y}{-z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -215 or 1.38e63 < y Initial program 99.9%
Taylor expanded in y around inf 69.5%
if -215 < y < 1.1999999999999999e-74Initial program 99.9%
Taylor expanded in y around 0 66.5%
if 1.1999999999999999e-74 < y < 1.38e63Initial program 99.9%
Taylor expanded in x around 0 75.0%
neg-mul-175.0%
distribute-neg-frac275.0%
sub-neg75.0%
+-commutative75.0%
distribute-neg-in75.0%
remove-double-neg75.0%
sub-neg75.0%
Simplified75.0%
Taylor expanded in y around 0 54.3%
associate-*r/54.3%
neg-mul-154.3%
Simplified54.3%
Final simplification66.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.045) (not (<= y 1.05e-108))) (/ y (- y z)) (/ x (- z y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.045) || !(y <= 1.05e-108)) {
tmp = y / (y - z);
} 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 <= (-0.045d0)) .or. (.not. (y <= 1.05d-108))) then
tmp = y / (y - z)
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 <= -0.045) || !(y <= 1.05e-108)) {
tmp = y / (y - z);
} else {
tmp = x / (z - y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.045) or not (y <= 1.05e-108): tmp = y / (y - z) else: tmp = x / (z - y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.045) || !(y <= 1.05e-108)) tmp = Float64(y / Float64(y - z)); else tmp = Float64(x / Float64(z - y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.045) || ~((y <= 1.05e-108))) tmp = y / (y - z); else tmp = x / (z - y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.045], N[Not[LessEqual[y, 1.05e-108]], $MachinePrecision]], N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.045 \lor \neg \left(y \leq 1.05 \cdot 10^{-108}\right):\\
\;\;\;\;\frac{y}{y - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z - y}\\
\end{array}
\end{array}
if y < -0.044999999999999998 or 1.05e-108 < y Initial program 99.9%
Taylor expanded in x around 0 79.3%
neg-mul-179.3%
distribute-neg-frac279.3%
sub-neg79.3%
+-commutative79.3%
distribute-neg-in79.3%
remove-double-neg79.3%
sub-neg79.3%
Simplified79.3%
if -0.044999999999999998 < y < 1.05e-108Initial program 99.9%
Taylor expanded in x around inf 82.4%
Final simplification80.7%
(FPCore (x y z) :precision binary64 (if (<= y -3.3) 1.0 (if (<= y 4.5e-39) (/ x z) 1.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.3) {
tmp = 1.0;
} else if (y <= 4.5e-39) {
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 <= (-3.3d0)) then
tmp = 1.0d0
else if (y <= 4.5d-39) 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 <= -3.3) {
tmp = 1.0;
} else if (y <= 4.5e-39) {
tmp = x / z;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.3: tmp = 1.0 elif y <= 4.5e-39: tmp = x / z else: tmp = 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.3) tmp = 1.0; elseif (y <= 4.5e-39) tmp = Float64(x / z); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.3) tmp = 1.0; elseif (y <= 4.5e-39) tmp = x / z; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.3], 1.0, If[LessEqual[y, 4.5e-39], N[(x / z), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-39}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.2999999999999998 or 4.5000000000000001e-39 < y Initial program 99.9%
Taylor expanded in y around inf 63.1%
if -3.2999999999999998 < y < 4.5000000000000001e-39Initial program 100.0%
Taylor expanded in y around 0 65.2%
(FPCore (x y z) :precision binary64 (/ (- y x) (- y z)))
double code(double x, double y, double z) {
return (y - x) / (y - 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) / (y - z)
end function
public static double code(double x, double y, double z) {
return (y - x) / (y - z);
}
def code(x, y, z): return (y - x) / (y - z)
function code(x, y, z) return Float64(Float64(y - x) / Float64(y - z)) end
function tmp = code(x, y, z) tmp = (y - x) / (y - z); end
code[x_, y_, z_] := N[(N[(y - x), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y - x}{y - z}
\end{array}
Initial program 99.9%
Final simplification99.9%
(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 99.9%
Taylor expanded in y around inf 38.0%
(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 2024145
(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)))