
(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%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (- x y) z)))
(if (<= z -2.05e-12)
t_0
(if (<= z -1.9e-38)
(/ y (- y z))
(if (or (<= z -3.3e-82) (not (<= z 3.8e+25))) t_0 (/ (- y x) y))))))
double code(double x, double y, double z) {
double t_0 = (x - y) / z;
double tmp;
if (z <= -2.05e-12) {
tmp = t_0;
} else if (z <= -1.9e-38) {
tmp = y / (y - z);
} else if ((z <= -3.3e-82) || !(z <= 3.8e+25)) {
tmp = t_0;
} else {
tmp = (y - 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) :: t_0
real(8) :: tmp
t_0 = (x - y) / z
if (z <= (-2.05d-12)) then
tmp = t_0
else if (z <= (-1.9d-38)) then
tmp = y / (y - z)
else if ((z <= (-3.3d-82)) .or. (.not. (z <= 3.8d+25))) then
tmp = t_0
else
tmp = (y - x) / y
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 <= -2.05e-12) {
tmp = t_0;
} else if (z <= -1.9e-38) {
tmp = y / (y - z);
} else if ((z <= -3.3e-82) || !(z <= 3.8e+25)) {
tmp = t_0;
} else {
tmp = (y - x) / y;
}
return tmp;
}
def code(x, y, z): t_0 = (x - y) / z tmp = 0 if z <= -2.05e-12: tmp = t_0 elif z <= -1.9e-38: tmp = y / (y - z) elif (z <= -3.3e-82) or not (z <= 3.8e+25): tmp = t_0 else: tmp = (y - x) / y return tmp
function code(x, y, z) t_0 = Float64(Float64(x - y) / z) tmp = 0.0 if (z <= -2.05e-12) tmp = t_0; elseif (z <= -1.9e-38) tmp = Float64(y / Float64(y - z)); elseif ((z <= -3.3e-82) || !(z <= 3.8e+25)) tmp = t_0; else tmp = Float64(Float64(y - x) / y); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x - y) / z; tmp = 0.0; if (z <= -2.05e-12) tmp = t_0; elseif (z <= -1.9e-38) tmp = y / (y - z); elseif ((z <= -3.3e-82) || ~((z <= 3.8e+25))) tmp = t_0; else tmp = (y - x) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[z, -2.05e-12], t$95$0, If[LessEqual[z, -1.9e-38], N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -3.3e-82], N[Not[LessEqual[z, 3.8e+25]], $MachinePrecision]], t$95$0, N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x - y}{z}\\
\mathbf{if}\;z \leq -2.05 \cdot 10^{-12}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{-38}:\\
\;\;\;\;\frac{y}{y - z}\\
\mathbf{elif}\;z \leq -3.3 \cdot 10^{-82} \lor \neg \left(z \leq 3.8 \cdot 10^{+25}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{y - x}{y}\\
\end{array}
\end{array}
if z < -2.04999999999999995e-12 or -1.9e-38 < z < -3.30000000000000022e-82 or 3.8e25 < z Initial program 100.0%
Taylor expanded in z around inf 77.9%
if -2.04999999999999995e-12 < z < -1.9e-38Initial program 99.7%
Taylor expanded in x around 0 99.7%
neg-mul-199.7%
distribute-neg-frac299.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
remove-double-neg99.7%
sub-neg99.7%
Simplified99.7%
if -3.30000000000000022e-82 < z < 3.8e25Initial program 100.0%
Taylor expanded in z around 0 86.1%
associate-*r/86.1%
neg-mul-186.1%
sub-neg86.1%
+-commutative86.1%
distribute-neg-in86.1%
remove-double-neg86.1%
sub-neg86.1%
Simplified86.1%
Final simplification82.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (- x y) z)))
(if (<= z -1.55e-12)
t_0
(if (<= z -5.4e-38)
(/ y (- y z))
(if (or (<= z -1.85e-84) (not (<= z 5.2e+25))) t_0 (- 1.0 (/ x y)))))))
double code(double x, double y, double z) {
double t_0 = (x - y) / z;
double tmp;
if (z <= -1.55e-12) {
tmp = t_0;
} else if (z <= -5.4e-38) {
tmp = y / (y - z);
} else if ((z <= -1.85e-84) || !(z <= 5.2e+25)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = (x - y) / z
if (z <= (-1.55d-12)) then
tmp = t_0
else if (z <= (-5.4d-38)) then
tmp = y / (y - z)
else if ((z <= (-1.85d-84)) .or. (.not. (z <= 5.2d+25))) then
tmp = t_0
else
tmp = 1.0d0 - (x / y)
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.55e-12) {
tmp = t_0;
} else if (z <= -5.4e-38) {
tmp = y / (y - z);
} else if ((z <= -1.85e-84) || !(z <= 5.2e+25)) {
tmp = t_0;
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
def code(x, y, z): t_0 = (x - y) / z tmp = 0 if z <= -1.55e-12: tmp = t_0 elif z <= -5.4e-38: tmp = y / (y - z) elif (z <= -1.85e-84) or not (z <= 5.2e+25): tmp = t_0 else: tmp = 1.0 - (x / y) return tmp
function code(x, y, z) t_0 = Float64(Float64(x - y) / z) tmp = 0.0 if (z <= -1.55e-12) tmp = t_0; elseif (z <= -5.4e-38) tmp = Float64(y / Float64(y - z)); elseif ((z <= -1.85e-84) || !(z <= 5.2e+25)) tmp = t_0; else tmp = Float64(1.0 - Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x - y) / z; tmp = 0.0; if (z <= -1.55e-12) tmp = t_0; elseif (z <= -5.4e-38) tmp = y / (y - z); elseif ((z <= -1.85e-84) || ~((z <= 5.2e+25))) tmp = t_0; else tmp = 1.0 - (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[z, -1.55e-12], t$95$0, If[LessEqual[z, -5.4e-38], N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.85e-84], N[Not[LessEqual[z, 5.2e+25]], $MachinePrecision]], t$95$0, N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x - y}{z}\\
\mathbf{if}\;z \leq -1.55 \cdot 10^{-12}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -5.4 \cdot 10^{-38}:\\
\;\;\;\;\frac{y}{y - z}\\
\mathbf{elif}\;z \leq -1.85 \cdot 10^{-84} \lor \neg \left(z \leq 5.2 \cdot 10^{+25}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y}\\
\end{array}
\end{array}
if z < -1.5500000000000001e-12 or -5.40000000000000011e-38 < z < -1.85e-84 or 5.1999999999999997e25 < z Initial program 100.0%
Taylor expanded in z around inf 77.9%
if -1.5500000000000001e-12 < z < -5.40000000000000011e-38Initial program 99.7%
Taylor expanded in x around 0 99.7%
neg-mul-199.7%
distribute-neg-frac299.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
remove-double-neg99.7%
sub-neg99.7%
Simplified99.7%
if -1.85e-84 < z < 5.1999999999999997e25Initial program 100.0%
Taylor expanded in z around 0 86.1%
associate-*r/86.1%
neg-mul-186.1%
sub-neg86.1%
+-commutative86.1%
distribute-neg-in86.1%
remove-double-neg86.1%
sub-neg86.1%
div-sub86.1%
*-inverses86.1%
Simplified86.1%
Final simplification82.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -8.6e-23) (not (<= x 3.5e-31))) (/ x (- z y)) (/ y (- y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -8.6e-23) || !(x <= 3.5e-31)) {
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 ((x <= (-8.6d-23)) .or. (.not. (x <= 3.5d-31))) 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 ((x <= -8.6e-23) || !(x <= 3.5e-31)) {
tmp = x / (z - y);
} else {
tmp = y / (y - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -8.6e-23) or not (x <= 3.5e-31): tmp = x / (z - y) else: tmp = y / (y - z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -8.6e-23) || !(x <= 3.5e-31)) 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 ((x <= -8.6e-23) || ~((x <= 3.5e-31))) tmp = x / (z - y); else tmp = y / (y - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -8.6e-23], N[Not[LessEqual[x, 3.5e-31]], $MachinePrecision]], N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision], N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.6 \cdot 10^{-23} \lor \neg \left(x \leq 3.5 \cdot 10^{-31}\right):\\
\;\;\;\;\frac{x}{z - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y - z}\\
\end{array}
\end{array}
if x < -8.60000000000000004e-23 or 3.49999999999999985e-31 < x Initial program 100.0%
Taylor expanded in x around inf 74.6%
if -8.60000000000000004e-23 < x < 3.49999999999999985e-31Initial program 100.0%
Taylor expanded in x around 0 84.0%
neg-mul-184.0%
distribute-neg-frac284.0%
sub-neg84.0%
+-commutative84.0%
distribute-neg-in84.0%
remove-double-neg84.0%
sub-neg84.0%
Simplified84.0%
Final simplification79.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.8e+48) (not (<= y 6.5e-82))) (- 1.0 (/ x y)) (/ x (- z y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.8e+48) || !(y <= 6.5e-82)) {
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.8d+48)) .or. (.not. (y <= 6.5d-82))) 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.8e+48) || !(y <= 6.5e-82)) {
tmp = 1.0 - (x / y);
} else {
tmp = x / (z - y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.8e+48) or not (y <= 6.5e-82): tmp = 1.0 - (x / y) else: tmp = x / (z - y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.8e+48) || !(y <= 6.5e-82)) 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.8e+48) || ~((y <= 6.5e-82))) tmp = 1.0 - (x / y); else tmp = x / (z - y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.8e+48], N[Not[LessEqual[y, 6.5e-82]], $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.8 \cdot 10^{+48} \lor \neg \left(y \leq 6.5 \cdot 10^{-82}\right):\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z - y}\\
\end{array}
\end{array}
if y < -2.80000000000000012e48 or 6.4999999999999997e-82 < y Initial program 100.0%
Taylor expanded in z around 0 76.9%
associate-*r/76.9%
neg-mul-176.9%
sub-neg76.9%
+-commutative76.9%
distribute-neg-in76.9%
remove-double-neg76.9%
sub-neg76.9%
div-sub76.9%
*-inverses76.9%
Simplified76.9%
if -2.80000000000000012e48 < y < 6.4999999999999997e-82Initial program 100.0%
Taylor expanded in x around inf 82.7%
Final simplification79.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -9.5e-23) (not (<= y 4.4e-82))) (- 1.0 (/ x y)) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -9.5e-23) || !(y <= 4.4e-82)) {
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 <= (-9.5d-23)) .or. (.not. (y <= 4.4d-82))) 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 <= -9.5e-23) || !(y <= 4.4e-82)) {
tmp = 1.0 - (x / y);
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -9.5e-23) or not (y <= 4.4e-82): tmp = 1.0 - (x / y) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -9.5e-23) || !(y <= 4.4e-82)) 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 <= -9.5e-23) || ~((y <= 4.4e-82))) tmp = 1.0 - (x / y); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -9.5e-23], N[Not[LessEqual[y, 4.4e-82]], $MachinePrecision]], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{-23} \lor \neg \left(y \leq 4.4 \cdot 10^{-82}\right):\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -9.50000000000000058e-23 or 4.39999999999999971e-82 < y Initial program 100.0%
Taylor expanded in z around 0 74.2%
associate-*r/74.2%
neg-mul-174.2%
sub-neg74.2%
+-commutative74.2%
distribute-neg-in74.2%
remove-double-neg74.2%
sub-neg74.2%
div-sub74.2%
*-inverses74.2%
Simplified74.2%
if -9.50000000000000058e-23 < y < 4.39999999999999971e-82Initial program 100.0%
Taylor expanded in y around 0 69.4%
Final simplification72.3%
(FPCore (x y z) :precision binary64 (if (<= y -1.1e+70) (+ 1.0 (/ z y)) (if (<= y 5.8e-81) (/ x z) 1.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.1e+70) {
tmp = 1.0 + (z / y);
} else if (y <= 5.8e-81) {
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 <= (-1.1d+70)) then
tmp = 1.0d0 + (z / y)
else if (y <= 5.8d-81) 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 <= -1.1e+70) {
tmp = 1.0 + (z / y);
} else if (y <= 5.8e-81) {
tmp = x / z;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.1e+70: tmp = 1.0 + (z / y) elif y <= 5.8e-81: tmp = x / z else: tmp = 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.1e+70) tmp = Float64(1.0 + Float64(z / y)); elseif (y <= 5.8e-81) tmp = Float64(x / z); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.1e+70) tmp = 1.0 + (z / y); elseif (y <= 5.8e-81) tmp = x / z; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.1e+70], N[(1.0 + N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.8e-81], N[(x / z), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{+70}:\\
\;\;\;\;1 + \frac{z}{y}\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-81}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.1e70Initial program 100.0%
Taylor expanded in x around 0 86.2%
neg-mul-186.2%
distribute-neg-frac286.2%
sub-neg86.2%
+-commutative86.2%
distribute-neg-in86.2%
remove-double-neg86.2%
sub-neg86.2%
Simplified86.2%
Taylor expanded in y around inf 71.9%
if -1.1e70 < y < 5.79999999999999978e-81Initial program 100.0%
Taylor expanded in y around 0 62.3%
if 5.79999999999999978e-81 < y Initial program 100.0%
Taylor expanded in y around inf 55.0%
(FPCore (x y z) :precision binary64 (if (<= y -7.6e+70) 1.0 (if (<= y 7.8e-81) (/ x z) 1.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -7.6e+70) {
tmp = 1.0;
} else if (y <= 7.8e-81) {
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.6d+70)) then
tmp = 1.0d0
else if (y <= 7.8d-81) 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.6e+70) {
tmp = 1.0;
} else if (y <= 7.8e-81) {
tmp = x / z;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7.6e+70: tmp = 1.0 elif y <= 7.8e-81: tmp = x / z else: tmp = 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7.6e+70) tmp = 1.0; elseif (y <= 7.8e-81) 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.6e+70) tmp = 1.0; elseif (y <= 7.8e-81) tmp = x / z; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7.6e+70], 1.0, If[LessEqual[y, 7.8e-81], N[(x / z), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{+70}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{-81}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -7.5999999999999996e70 or 7.7999999999999997e-81 < y Initial program 100.0%
Taylor expanded in y around inf 60.6%
if -7.5999999999999996e70 < y < 7.7999999999999997e-81Initial program 100.0%
Taylor expanded in y around 0 62.3%
(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 36.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 2024111
(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)))