
(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%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (<= y -44000000000000.0)
1.0
(if (<= y 1.4e-134)
(/ x z)
(if (<= y 1.28e-104)
(/ y (- z))
(if (<= y 2.85e-68) (/ x z) (if (<= y 3.3e+35) (/ x (- y)) 1.0))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -44000000000000.0) {
tmp = 1.0;
} else if (y <= 1.4e-134) {
tmp = x / z;
} else if (y <= 1.28e-104) {
tmp = y / -z;
} else if (y <= 2.85e-68) {
tmp = x / z;
} else if (y <= 3.3e+35) {
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 <= (-44000000000000.0d0)) then
tmp = 1.0d0
else if (y <= 1.4d-134) then
tmp = x / z
else if (y <= 1.28d-104) then
tmp = y / -z
else if (y <= 2.85d-68) then
tmp = x / z
else if (y <= 3.3d+35) 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 <= -44000000000000.0) {
tmp = 1.0;
} else if (y <= 1.4e-134) {
tmp = x / z;
} else if (y <= 1.28e-104) {
tmp = y / -z;
} else if (y <= 2.85e-68) {
tmp = x / z;
} else if (y <= 3.3e+35) {
tmp = x / -y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -44000000000000.0: tmp = 1.0 elif y <= 1.4e-134: tmp = x / z elif y <= 1.28e-104: tmp = y / -z elif y <= 2.85e-68: tmp = x / z elif y <= 3.3e+35: tmp = x / -y else: tmp = 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -44000000000000.0) tmp = 1.0; elseif (y <= 1.4e-134) tmp = Float64(x / z); elseif (y <= 1.28e-104) tmp = Float64(y / Float64(-z)); elseif (y <= 2.85e-68) tmp = Float64(x / z); elseif (y <= 3.3e+35) tmp = Float64(x / Float64(-y)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -44000000000000.0) tmp = 1.0; elseif (y <= 1.4e-134) tmp = x / z; elseif (y <= 1.28e-104) tmp = y / -z; elseif (y <= 2.85e-68) tmp = x / z; elseif (y <= 3.3e+35) tmp = x / -y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -44000000000000.0], 1.0, If[LessEqual[y, 1.4e-134], N[(x / z), $MachinePrecision], If[LessEqual[y, 1.28e-104], N[(y / (-z)), $MachinePrecision], If[LessEqual[y, 2.85e-68], N[(x / z), $MachinePrecision], If[LessEqual[y, 3.3e+35], N[(x / (-y)), $MachinePrecision], 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -44000000000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-134}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 1.28 \cdot 10^{-104}:\\
\;\;\;\;\frac{y}{-z}\\
\mathbf{elif}\;y \leq 2.85 \cdot 10^{-68}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+35}:\\
\;\;\;\;\frac{x}{-y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -4.4e13 or 3.3000000000000002e35 < y Initial program 100.0%
Taylor expanded in y around inf 66.7%
if -4.4e13 < y < 1.3999999999999999e-134 or 1.27999999999999992e-104 < y < 2.8500000000000001e-68Initial program 100.0%
Taylor expanded in y around 0 76.9%
if 1.3999999999999999e-134 < y < 1.27999999999999992e-104Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in x around 0 100.0%
neg-mul-1100.0%
distribute-neg-frac2100.0%
Simplified100.0%
if 2.8500000000000001e-68 < y < 3.3000000000000002e35Initial program 100.0%
Taylor expanded in z around 0 62.7%
div-sub62.7%
sub-neg62.7%
*-inverses62.7%
metadata-eval62.7%
distribute-lft-in62.7%
metadata-eval62.7%
+-commutative62.7%
mul-1-neg62.7%
unsub-neg62.7%
Simplified62.7%
Taylor expanded in x around inf 51.0%
mul-1-neg51.0%
distribute-frac-neg251.0%
Simplified51.0%
Final simplification70.1%
(FPCore (x y z)
:precision binary64
(if (or (<= y -0.0008)
(and (not (<= y 1.8e-142)) (or (<= y 1.9e-77) (not (<= y 3.4e+33)))))
(/ y (- y z))
(/ x (- z y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.0008) || (!(y <= 1.8e-142) && ((y <= 1.9e-77) || !(y <= 3.4e+33)))) {
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.0008d0)) .or. (.not. (y <= 1.8d-142)) .and. (y <= 1.9d-77) .or. (.not. (y <= 3.4d+33))) 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.0008) || (!(y <= 1.8e-142) && ((y <= 1.9e-77) || !(y <= 3.4e+33)))) {
tmp = y / (y - z);
} else {
tmp = x / (z - y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.0008) or (not (y <= 1.8e-142) and ((y <= 1.9e-77) or not (y <= 3.4e+33))): tmp = y / (y - z) else: tmp = x / (z - y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.0008) || (!(y <= 1.8e-142) && ((y <= 1.9e-77) || !(y <= 3.4e+33)))) 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.0008) || (~((y <= 1.8e-142)) && ((y <= 1.9e-77) || ~((y <= 3.4e+33))))) tmp = y / (y - z); else tmp = x / (z - y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.0008], And[N[Not[LessEqual[y, 1.8e-142]], $MachinePrecision], Or[LessEqual[y, 1.9e-77], N[Not[LessEqual[y, 3.4e+33]], $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.0008 \lor \neg \left(y \leq 1.8 \cdot 10^{-142}\right) \land \left(y \leq 1.9 \cdot 10^{-77} \lor \neg \left(y \leq 3.4 \cdot 10^{+33}\right)\right):\\
\;\;\;\;\frac{y}{y - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z - y}\\
\end{array}
\end{array}
if y < -8.00000000000000038e-4 or 1.8e-142 < y < 1.8999999999999999e-77 or 3.3999999999999999e33 < y Initial program 100.0%
Taylor expanded in x around 0 85.1%
neg-mul-185.1%
distribute-neg-frac85.1%
Simplified85.1%
frac-2neg85.1%
div-inv84.9%
remove-double-neg84.9%
sub-neg84.9%
distribute-neg-in84.9%
remove-double-neg84.9%
Applied egg-rr84.9%
associate-*r/85.1%
*-rgt-identity85.1%
+-commutative85.1%
unsub-neg85.1%
Simplified85.1%
if -8.00000000000000038e-4 < y < 1.8e-142 or 1.8999999999999999e-77 < y < 3.3999999999999999e33Initial program 100.0%
Taylor expanded in x around inf 85.6%
Final simplification85.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -1.46e-67)
t_0
(if (<= y 1.4e-134)
(/ x z)
(if (<= y 1.3e-104) (/ y (- z)) (if (<= y 1.25e-69) (/ x z) t_0))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -1.46e-67) {
tmp = t_0;
} else if (y <= 1.4e-134) {
tmp = x / z;
} else if (y <= 1.3e-104) {
tmp = y / -z;
} else if (y <= 1.25e-69) {
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 = 1.0d0 - (x / y)
if (y <= (-1.46d-67)) then
tmp = t_0
else if (y <= 1.4d-134) then
tmp = x / z
else if (y <= 1.3d-104) then
tmp = y / -z
else if (y <= 1.25d-69) 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 = 1.0 - (x / y);
double tmp;
if (y <= -1.46e-67) {
tmp = t_0;
} else if (y <= 1.4e-134) {
tmp = x / z;
} else if (y <= 1.3e-104) {
tmp = y / -z;
} else if (y <= 1.25e-69) {
tmp = x / z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (x / y) tmp = 0 if y <= -1.46e-67: tmp = t_0 elif y <= 1.4e-134: tmp = x / z elif y <= 1.3e-104: tmp = y / -z elif y <= 1.25e-69: tmp = x / 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 <= -1.46e-67) tmp = t_0; elseif (y <= 1.4e-134) tmp = Float64(x / z); elseif (y <= 1.3e-104) tmp = Float64(y / Float64(-z)); elseif (y <= 1.25e-69) tmp = Float64(x / 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 <= -1.46e-67) tmp = t_0; elseif (y <= 1.4e-134) tmp = x / z; elseif (y <= 1.3e-104) tmp = y / -z; elseif (y <= 1.25e-69) tmp = x / 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, -1.46e-67], t$95$0, If[LessEqual[y, 1.4e-134], N[(x / z), $MachinePrecision], If[LessEqual[y, 1.3e-104], N[(y / (-z)), $MachinePrecision], If[LessEqual[y, 1.25e-69], N[(x / z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -1.46 \cdot 10^{-67}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-134}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-104}:\\
\;\;\;\;\frac{y}{-z}\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{-69}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.46000000000000002e-67 or 1.25000000000000008e-69 < y Initial program 100.0%
Taylor expanded in z around 0 71.2%
div-sub71.2%
sub-neg71.2%
*-inverses71.2%
metadata-eval71.2%
distribute-lft-in71.2%
metadata-eval71.2%
+-commutative71.2%
mul-1-neg71.2%
unsub-neg71.2%
Simplified71.2%
if -1.46000000000000002e-67 < y < 1.3999999999999999e-134 or 1.30000000000000001e-104 < y < 1.25000000000000008e-69Initial program 100.0%
Taylor expanded in y around 0 79.9%
if 1.3999999999999999e-134 < y < 1.30000000000000001e-104Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in x around 0 100.0%
neg-mul-1100.0%
distribute-neg-frac2100.0%
Simplified100.0%
Final simplification75.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))) (t_1 (/ x (- z y))))
(if (<= y -1.9e+17)
t_0
(if (<= y 1.3e-134)
t_1
(if (<= y 1.75e-104) (/ y (- z)) (if (<= y 2.6e-8) t_1 t_0))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (x / y);
double t_1 = x / (z - y);
double tmp;
if (y <= -1.9e+17) {
tmp = t_0;
} else if (y <= 1.3e-134) {
tmp = t_1;
} else if (y <= 1.75e-104) {
tmp = y / -z;
} else if (y <= 2.6e-8) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (x / y)
t_1 = x / (z - y)
if (y <= (-1.9d+17)) then
tmp = t_0
else if (y <= 1.3d-134) then
tmp = t_1
else if (y <= 1.75d-104) then
tmp = y / -z
else if (y <= 2.6d-8) then
tmp = t_1
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 t_1 = x / (z - y);
double tmp;
if (y <= -1.9e+17) {
tmp = t_0;
} else if (y <= 1.3e-134) {
tmp = t_1;
} else if (y <= 1.75e-104) {
tmp = y / -z;
} else if (y <= 2.6e-8) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (x / y) t_1 = x / (z - y) tmp = 0 if y <= -1.9e+17: tmp = t_0 elif y <= 1.3e-134: tmp = t_1 elif y <= 1.75e-104: tmp = y / -z elif y <= 2.6e-8: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(x / y)) t_1 = Float64(x / Float64(z - y)) tmp = 0.0 if (y <= -1.9e+17) tmp = t_0; elseif (y <= 1.3e-134) tmp = t_1; elseif (y <= 1.75e-104) tmp = Float64(y / Float64(-z)); elseif (y <= 2.6e-8) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (x / y); t_1 = x / (z - y); tmp = 0.0; if (y <= -1.9e+17) tmp = t_0; elseif (y <= 1.3e-134) tmp = t_1; elseif (y <= 1.75e-104) tmp = y / -z; elseif (y <= 2.6e-8) tmp = t_1; 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]}, Block[{t$95$1 = N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.9e+17], t$95$0, If[LessEqual[y, 1.3e-134], t$95$1, If[LessEqual[y, 1.75e-104], N[(y / (-z)), $MachinePrecision], If[LessEqual[y, 2.6e-8], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
t_1 := \frac{x}{z - y}\\
\mathbf{if}\;y \leq -1.9 \cdot 10^{+17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{-104}:\\
\;\;\;\;\frac{y}{-z}\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.9e17 or 2.6000000000000001e-8 < y Initial program 100.0%
Taylor expanded in z around 0 74.2%
div-sub74.2%
sub-neg74.2%
*-inverses74.2%
metadata-eval74.2%
distribute-lft-in74.2%
metadata-eval74.2%
+-commutative74.2%
mul-1-neg74.2%
unsub-neg74.2%
Simplified74.2%
if -1.9e17 < y < 1.30000000000000011e-134 or 1.75000000000000014e-104 < y < 2.6000000000000001e-8Initial program 100.0%
Taylor expanded in x around inf 85.8%
if 1.30000000000000011e-134 < y < 1.75000000000000014e-104Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in x around 0 100.0%
neg-mul-1100.0%
distribute-neg-frac2100.0%
Simplified100.0%
Final simplification80.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ y (- y z))))
(if (<= y -0.04)
t_0
(if (<= y 3.7e-70)
(/ (- x y) z)
(if (<= y 1.28e+33) (/ x (- z y)) t_0)))))
double code(double x, double y, double z) {
double t_0 = y / (y - z);
double tmp;
if (y <= -0.04) {
tmp = t_0;
} else if (y <= 3.7e-70) {
tmp = (x - y) / z;
} else if (y <= 1.28e+33) {
tmp = x / (z - 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 = y / (y - z)
if (y <= (-0.04d0)) then
tmp = t_0
else if (y <= 3.7d-70) then
tmp = (x - y) / z
else if (y <= 1.28d+33) then
tmp = x / (z - y)
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 <= -0.04) {
tmp = t_0;
} else if (y <= 3.7e-70) {
tmp = (x - y) / z;
} else if (y <= 1.28e+33) {
tmp = x / (z - y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y / (y - z) tmp = 0 if y <= -0.04: tmp = t_0 elif y <= 3.7e-70: tmp = (x - y) / z elif y <= 1.28e+33: tmp = x / (z - y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(y / Float64(y - z)) tmp = 0.0 if (y <= -0.04) tmp = t_0; elseif (y <= 3.7e-70) tmp = Float64(Float64(x - y) / z); elseif (y <= 1.28e+33) tmp = Float64(x / Float64(z - y)); 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 <= -0.04) tmp = t_0; elseif (y <= 3.7e-70) tmp = (x - y) / z; elseif (y <= 1.28e+33) tmp = x / (z - y); 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, -0.04], t$95$0, If[LessEqual[y, 3.7e-70], N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 1.28e+33], N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{y - z}\\
\mathbf{if}\;y \leq -0.04:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{-70}:\\
\;\;\;\;\frac{x - y}{z}\\
\mathbf{elif}\;y \leq 1.28 \cdot 10^{+33}:\\
\;\;\;\;\frac{x}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.0400000000000000008 or 1.28e33 < y Initial program 100.0%
Taylor expanded in x around 0 85.0%
neg-mul-185.0%
distribute-neg-frac85.0%
Simplified85.0%
frac-2neg85.0%
div-inv84.8%
remove-double-neg84.8%
sub-neg84.8%
distribute-neg-in84.8%
remove-double-neg84.8%
Applied egg-rr84.8%
associate-*r/85.0%
*-rgt-identity85.0%
+-commutative85.0%
unsub-neg85.0%
Simplified85.0%
if -0.0400000000000000008 < y < 3.7e-70Initial program 100.0%
Taylor expanded in z around inf 88.6%
if 3.7e-70 < y < 1.28e33Initial program 100.0%
Taylor expanded in x around inf 70.8%
Final simplification85.1%
(FPCore (x y z) :precision binary64 (if (<= y -160000000.0) 1.0 (if (<= y 3.1e-67) (/ x z) (if (<= y 4.9e+35) (/ x (- y)) 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -160000000.0) {
tmp = 1.0;
} else if (y <= 3.1e-67) {
tmp = x / z;
} else if (y <= 4.9e+35) {
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 <= (-160000000.0d0)) then
tmp = 1.0d0
else if (y <= 3.1d-67) then
tmp = x / z
else if (y <= 4.9d+35) 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 <= -160000000.0) {
tmp = 1.0;
} else if (y <= 3.1e-67) {
tmp = x / z;
} else if (y <= 4.9e+35) {
tmp = x / -y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -160000000.0: tmp = 1.0 elif y <= 3.1e-67: tmp = x / z elif y <= 4.9e+35: tmp = x / -y else: tmp = 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -160000000.0) tmp = 1.0; elseif (y <= 3.1e-67) tmp = Float64(x / z); elseif (y <= 4.9e+35) tmp = Float64(x / Float64(-y)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -160000000.0) tmp = 1.0; elseif (y <= 3.1e-67) tmp = x / z; elseif (y <= 4.9e+35) tmp = x / -y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -160000000.0], 1.0, If[LessEqual[y, 3.1e-67], N[(x / z), $MachinePrecision], If[LessEqual[y, 4.9e+35], N[(x / (-y)), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -160000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{-67}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{+35}:\\
\;\;\;\;\frac{x}{-y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.6e8 or 4.90000000000000025e35 < y Initial program 100.0%
Taylor expanded in y around inf 66.7%
if -1.6e8 < y < 3.1000000000000003e-67Initial program 100.0%
Taylor expanded in y around 0 73.9%
if 3.1000000000000003e-67 < y < 4.90000000000000025e35Initial program 100.0%
Taylor expanded in z around 0 62.7%
div-sub62.7%
sub-neg62.7%
*-inverses62.7%
metadata-eval62.7%
distribute-lft-in62.7%
metadata-eval62.7%
+-commutative62.7%
mul-1-neg62.7%
unsub-neg62.7%
Simplified62.7%
Taylor expanded in x around inf 51.0%
mul-1-neg51.0%
distribute-frac-neg251.0%
Simplified51.0%
Final simplification68.3%
(FPCore (x y z) :precision binary64 (if (<= y -225000.0) 1.0 (if (<= y 1.9e-8) (/ x z) 1.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -225000.0) {
tmp = 1.0;
} else if (y <= 1.9e-8) {
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 <= (-225000.0d0)) then
tmp = 1.0d0
else if (y <= 1.9d-8) 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 <= -225000.0) {
tmp = 1.0;
} else if (y <= 1.9e-8) {
tmp = x / z;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -225000.0: tmp = 1.0 elif y <= 1.9e-8: tmp = x / z else: tmp = 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -225000.0) tmp = 1.0; elseif (y <= 1.9e-8) tmp = Float64(x / z); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -225000.0) tmp = 1.0; elseif (y <= 1.9e-8) tmp = x / z; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -225000.0], 1.0, If[LessEqual[y, 1.9e-8], N[(x / z), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -225000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -225000 or 1.90000000000000014e-8 < y Initial program 100.0%
Taylor expanded in y around inf 62.4%
if -225000 < y < 1.90000000000000014e-8Initial program 100.0%
Taylor expanded in y around 0 69.5%
Final simplification65.8%
(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 34.5%
Final simplification34.5%
(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 2024057
(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)))