
(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 (- 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}
Initial program 99.9%
div-sub100.0%
Applied egg-rr100.0%
(FPCore (x y z)
:precision binary64
(if (<= y -7.5e+54)
1.0
(if (<= y -1.42e-130)
(/ x z)
(if (<= y -4.5e-165)
(/ x (- y))
(if (<= y 1.1e-11) (/ x z) (if (<= y 1.38e+141) (/ y (- z)) 1.0))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7.5e+54) {
tmp = 1.0;
} else if (y <= -1.42e-130) {
tmp = x / z;
} else if (y <= -4.5e-165) {
tmp = x / -y;
} else if (y <= 1.1e-11) {
tmp = x / z;
} else if (y <= 1.38e+141) {
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 <= (-7.5d+54)) then
tmp = 1.0d0
else if (y <= (-1.42d-130)) then
tmp = x / z
else if (y <= (-4.5d-165)) then
tmp = x / -y
else if (y <= 1.1d-11) then
tmp = x / z
else if (y <= 1.38d+141) 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 <= -7.5e+54) {
tmp = 1.0;
} else if (y <= -1.42e-130) {
tmp = x / z;
} else if (y <= -4.5e-165) {
tmp = x / -y;
} else if (y <= 1.1e-11) {
tmp = x / z;
} else if (y <= 1.38e+141) {
tmp = y / -z;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7.5e+54: tmp = 1.0 elif y <= -1.42e-130: tmp = x / z elif y <= -4.5e-165: tmp = x / -y elif y <= 1.1e-11: tmp = x / z elif y <= 1.38e+141: tmp = y / -z else: tmp = 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7.5e+54) tmp = 1.0; elseif (y <= -1.42e-130) tmp = Float64(x / z); elseif (y <= -4.5e-165) tmp = Float64(x / Float64(-y)); elseif (y <= 1.1e-11) tmp = Float64(x / z); elseif (y <= 1.38e+141) 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 <= -7.5e+54) tmp = 1.0; elseif (y <= -1.42e-130) tmp = x / z; elseif (y <= -4.5e-165) tmp = x / -y; elseif (y <= 1.1e-11) tmp = x / z; elseif (y <= 1.38e+141) tmp = y / -z; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7.5e+54], 1.0, If[LessEqual[y, -1.42e-130], N[(x / z), $MachinePrecision], If[LessEqual[y, -4.5e-165], N[(x / (-y)), $MachinePrecision], If[LessEqual[y, 1.1e-11], N[(x / z), $MachinePrecision], If[LessEqual[y, 1.38e+141], N[(y / (-z)), $MachinePrecision], 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+54}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1.42 \cdot 10^{-130}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq -4.5 \cdot 10^{-165}:\\
\;\;\;\;\frac{x}{-y}\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-11}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 1.38 \cdot 10^{+141}:\\
\;\;\;\;\frac{y}{-z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -7.50000000000000042e54 or 1.38e141 < y Initial program 99.9%
Taylor expanded in y around inf 73.5%
if -7.50000000000000042e54 < y < -1.4199999999999999e-130 or -4.49999999999999992e-165 < y < 1.1000000000000001e-11Initial program 99.9%
Taylor expanded in y around 0 62.2%
if -1.4199999999999999e-130 < y < -4.49999999999999992e-165Initial program 100.0%
Taylor expanded in x around inf 79.5%
Taylor expanded in z around 0 79.1%
mul-1-neg79.1%
distribute-frac-neg279.1%
Simplified79.1%
if 1.1000000000000001e-11 < y < 1.38e141Initial program 100.0%
Taylor expanded in z around inf 68.0%
Taylor expanded in x around 0 45.8%
neg-mul-145.8%
distribute-neg-frac245.8%
Simplified45.8%
(FPCore (x y z)
:precision binary64
(if (or (<= y -3.05e+43)
(and (not (<= y -4.3e-63))
(or (<= y -4.5e-165) (not (<= y 1.55e-43)))))
(- 1.0 (/ x y))
(/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.05e+43) || (!(y <= -4.3e-63) && ((y <= -4.5e-165) || !(y <= 1.55e-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 <= (-3.05d+43)) .or. (.not. (y <= (-4.3d-63))) .and. (y <= (-4.5d-165)) .or. (.not. (y <= 1.55d-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 <= -3.05e+43) || (!(y <= -4.3e-63) && ((y <= -4.5e-165) || !(y <= 1.55e-43)))) {
tmp = 1.0 - (x / y);
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.05e+43) or (not (y <= -4.3e-63) and ((y <= -4.5e-165) or not (y <= 1.55e-43))): tmp = 1.0 - (x / y) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.05e+43) || (!(y <= -4.3e-63) && ((y <= -4.5e-165) || !(y <= 1.55e-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 <= -3.05e+43) || (~((y <= -4.3e-63)) && ((y <= -4.5e-165) || ~((y <= 1.55e-43))))) tmp = 1.0 - (x / y); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.05e+43], And[N[Not[LessEqual[y, -4.3e-63]], $MachinePrecision], Or[LessEqual[y, -4.5e-165], N[Not[LessEqual[y, 1.55e-43]], $MachinePrecision]]]], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.05 \cdot 10^{+43} \lor \neg \left(y \leq -4.3 \cdot 10^{-63}\right) \land \left(y \leq -4.5 \cdot 10^{-165} \lor \neg \left(y \leq 1.55 \cdot 10^{-43}\right)\right):\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -3.0499999999999999e43 or -4.2999999999999999e-63 < y < -4.49999999999999992e-165 or 1.55e-43 < y Initial program 100.0%
Taylor expanded in z around 0 76.2%
mul-1-neg76.2%
div-sub76.2%
sub-neg76.2%
*-inverses76.2%
metadata-eval76.2%
distribute-neg-in76.2%
mul-1-neg76.2%
metadata-eval76.2%
+-commutative76.2%
mul-1-neg76.2%
unsub-neg76.2%
Simplified76.2%
if -3.0499999999999999e43 < y < -4.2999999999999999e-63 or -4.49999999999999992e-165 < y < 1.55e-43Initial program 99.9%
Taylor expanded in y around 0 67.7%
Final simplification73.0%
(FPCore (x y z)
:precision binary64
(if (<= y -7.5e+54)
1.0
(if (<= y -2.8e-130)
(/ x z)
(if (<= y -4.5e-165) (/ x (- y)) (if (<= y 1.55e+67) (/ x z) 1.0)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7.5e+54) {
tmp = 1.0;
} else if (y <= -2.8e-130) {
tmp = x / z;
} else if (y <= -4.5e-165) {
tmp = x / -y;
} else if (y <= 1.55e+67) {
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 <= (-7.5d+54)) then
tmp = 1.0d0
else if (y <= (-2.8d-130)) then
tmp = x / z
else if (y <= (-4.5d-165)) then
tmp = x / -y
else if (y <= 1.55d+67) 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 <= -7.5e+54) {
tmp = 1.0;
} else if (y <= -2.8e-130) {
tmp = x / z;
} else if (y <= -4.5e-165) {
tmp = x / -y;
} else if (y <= 1.55e+67) {
tmp = x / z;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7.5e+54: tmp = 1.0 elif y <= -2.8e-130: tmp = x / z elif y <= -4.5e-165: tmp = x / -y elif y <= 1.55e+67: tmp = x / z else: tmp = 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7.5e+54) tmp = 1.0; elseif (y <= -2.8e-130) tmp = Float64(x / z); elseif (y <= -4.5e-165) tmp = Float64(x / Float64(-y)); elseif (y <= 1.55e+67) tmp = Float64(x / z); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -7.5e+54) tmp = 1.0; elseif (y <= -2.8e-130) tmp = x / z; elseif (y <= -4.5e-165) tmp = x / -y; elseif (y <= 1.55e+67) tmp = x / z; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7.5e+54], 1.0, If[LessEqual[y, -2.8e-130], N[(x / z), $MachinePrecision], If[LessEqual[y, -4.5e-165], N[(x / (-y)), $MachinePrecision], If[LessEqual[y, 1.55e+67], N[(x / z), $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+54}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -2.8 \cdot 10^{-130}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq -4.5 \cdot 10^{-165}:\\
\;\;\;\;\frac{x}{-y}\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{+67}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -7.50000000000000042e54 or 1.54999999999999998e67 < y Initial program 99.9%
Taylor expanded in y around inf 67.1%
if -7.50000000000000042e54 < y < -2.80000000000000016e-130 or -4.49999999999999992e-165 < y < 1.54999999999999998e67Initial program 99.9%
Taylor expanded in y around 0 59.1%
if -2.80000000000000016e-130 < y < -4.49999999999999992e-165Initial program 100.0%
Taylor expanded in x around inf 79.5%
Taylor expanded in z around 0 79.1%
mul-1-neg79.1%
distribute-frac-neg279.1%
Simplified79.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.2e+43) (not (<= y 1.55e+67))) (- 1.0 (/ x y)) (/ x (- z y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.2e+43) || !(y <= 1.55e+67)) {
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 <= (-3.2d+43)) .or. (.not. (y <= 1.55d+67))) 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 <= -3.2e+43) || !(y <= 1.55e+67)) {
tmp = 1.0 - (x / y);
} else {
tmp = x / (z - y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.2e+43) or not (y <= 1.55e+67): tmp = 1.0 - (x / y) else: tmp = x / (z - y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.2e+43) || !(y <= 1.55e+67)) 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 <= -3.2e+43) || ~((y <= 1.55e+67))) tmp = 1.0 - (x / y); else tmp = x / (z - y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.2e+43], N[Not[LessEqual[y, 1.55e+67]], $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 -3.2 \cdot 10^{+43} \lor \neg \left(y \leq 1.55 \cdot 10^{+67}\right):\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z - y}\\
\end{array}
\end{array}
if y < -3.20000000000000014e43 or 1.54999999999999998e67 < y Initial program 100.0%
Taylor expanded in z around 0 83.0%
mul-1-neg83.0%
div-sub83.0%
sub-neg83.0%
*-inverses83.0%
metadata-eval83.0%
distribute-neg-in83.0%
mul-1-neg83.0%
metadata-eval83.0%
+-commutative83.0%
mul-1-neg83.0%
unsub-neg83.0%
Simplified83.0%
if -3.20000000000000014e43 < y < 1.54999999999999998e67Initial program 99.9%
Taylor expanded in x around inf 75.8%
Final simplification79.3%
(FPCore (x y z) :precision binary64 (if (<= y -2.3e+44) (- 1.0 (/ x y)) (if (<= y 6.6e+43) (/ x (- z y)) (/ y (- y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.3e+44) {
tmp = 1.0 - (x / y);
} else if (y <= 6.6e+43) {
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.3d+44)) then
tmp = 1.0d0 - (x / y)
else if (y <= 6.6d+43) 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.3e+44) {
tmp = 1.0 - (x / y);
} else if (y <= 6.6e+43) {
tmp = x / (z - y);
} else {
tmp = y / (y - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.3e+44: tmp = 1.0 - (x / y) elif y <= 6.6e+43: tmp = x / (z - y) else: tmp = y / (y - z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.3e+44) tmp = Float64(1.0 - Float64(x / y)); elseif (y <= 6.6e+43) 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.3e+44) tmp = 1.0 - (x / y); elseif (y <= 6.6e+43) tmp = x / (z - y); else tmp = y / (y - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.3e+44], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.6e+43], 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.3 \cdot 10^{+44}:\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{+43}:\\
\;\;\;\;\frac{x}{z - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y - z}\\
\end{array}
\end{array}
if y < -2.30000000000000004e44Initial program 99.9%
Taylor expanded in z around 0 92.2%
mul-1-neg92.2%
div-sub92.3%
sub-neg92.3%
*-inverses92.3%
metadata-eval92.3%
distribute-neg-in92.3%
mul-1-neg92.3%
metadata-eval92.3%
+-commutative92.3%
mul-1-neg92.3%
unsub-neg92.3%
Simplified92.3%
if -2.30000000000000004e44 < y < 6.6000000000000003e43Initial program 99.9%
Taylor expanded in x around inf 76.7%
if 6.6000000000000003e43 < y Initial program 100.0%
clear-num99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 82.7%
associate-*r/82.7%
neg-mul-182.7%
Simplified82.7%
frac-2neg82.7%
div-inv82.5%
remove-double-neg82.5%
sub-neg82.5%
distribute-neg-in82.5%
remove-double-neg82.5%
Applied egg-rr82.5%
associate-*r/82.7%
*-rgt-identity82.7%
+-commutative82.7%
unsub-neg82.7%
Simplified82.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -8e+54) (not (<= y 1.55e+67))) 1.0 (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -8e+54) || !(y <= 1.55e+67)) {
tmp = 1.0;
} 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 <= (-8d+54)) .or. (.not. (y <= 1.55d+67))) then
tmp = 1.0d0
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -8e+54) || !(y <= 1.55e+67)) {
tmp = 1.0;
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -8e+54) or not (y <= 1.55e+67): tmp = 1.0 else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -8e+54) || !(y <= 1.55e+67)) tmp = 1.0; else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -8e+54) || ~((y <= 1.55e+67))) tmp = 1.0; else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -8e+54], N[Not[LessEqual[y, 1.55e+67]], $MachinePrecision]], 1.0, N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{+54} \lor \neg \left(y \leq 1.55 \cdot 10^{+67}\right):\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -8.0000000000000006e54 or 1.54999999999999998e67 < y Initial program 99.9%
Taylor expanded in y around inf 67.1%
if -8.0000000000000006e54 < y < 1.54999999999999998e67Initial program 99.9%
Taylor expanded in y around 0 55.3%
Final simplification61.0%
(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 99.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.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 2024096
(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)))