
(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
(let* ((t_0 (/ (- x) y)))
(if (<= y -6.6e+46)
1.0
(if (<= y -4.7e-60)
t_0
(if (<= y -2.8e-83)
1.0
(if (<= y 1.15e-170)
(/ x z)
(if (<= y 9.5e-137)
t_0
(if (<= y 7e-74)
(/ x z)
(if (<= y 3.8e-22)
(/ (- y) z)
(if (<= y 5.5e+47) (/ x z) 1.0))))))))))
double code(double x, double y, double z) {
double t_0 = -x / y;
double tmp;
if (y <= -6.6e+46) {
tmp = 1.0;
} else if (y <= -4.7e-60) {
tmp = t_0;
} else if (y <= -2.8e-83) {
tmp = 1.0;
} else if (y <= 1.15e-170) {
tmp = x / z;
} else if (y <= 9.5e-137) {
tmp = t_0;
} else if (y <= 7e-74) {
tmp = x / z;
} else if (y <= 3.8e-22) {
tmp = -y / z;
} else if (y <= 5.5e+47) {
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) :: t_0
real(8) :: tmp
t_0 = -x / y
if (y <= (-6.6d+46)) then
tmp = 1.0d0
else if (y <= (-4.7d-60)) then
tmp = t_0
else if (y <= (-2.8d-83)) then
tmp = 1.0d0
else if (y <= 1.15d-170) then
tmp = x / z
else if (y <= 9.5d-137) then
tmp = t_0
else if (y <= 7d-74) then
tmp = x / z
else if (y <= 3.8d-22) then
tmp = -y / z
else if (y <= 5.5d+47) 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 t_0 = -x / y;
double tmp;
if (y <= -6.6e+46) {
tmp = 1.0;
} else if (y <= -4.7e-60) {
tmp = t_0;
} else if (y <= -2.8e-83) {
tmp = 1.0;
} else if (y <= 1.15e-170) {
tmp = x / z;
} else if (y <= 9.5e-137) {
tmp = t_0;
} else if (y <= 7e-74) {
tmp = x / z;
} else if (y <= 3.8e-22) {
tmp = -y / z;
} else if (y <= 5.5e+47) {
tmp = x / z;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): t_0 = -x / y tmp = 0 if y <= -6.6e+46: tmp = 1.0 elif y <= -4.7e-60: tmp = t_0 elif y <= -2.8e-83: tmp = 1.0 elif y <= 1.15e-170: tmp = x / z elif y <= 9.5e-137: tmp = t_0 elif y <= 7e-74: tmp = x / z elif y <= 3.8e-22: tmp = -y / z elif y <= 5.5e+47: tmp = x / z else: tmp = 1.0 return tmp
function code(x, y, z) t_0 = Float64(Float64(-x) / y) tmp = 0.0 if (y <= -6.6e+46) tmp = 1.0; elseif (y <= -4.7e-60) tmp = t_0; elseif (y <= -2.8e-83) tmp = 1.0; elseif (y <= 1.15e-170) tmp = Float64(x / z); elseif (y <= 9.5e-137) tmp = t_0; elseif (y <= 7e-74) tmp = Float64(x / z); elseif (y <= 3.8e-22) tmp = Float64(Float64(-y) / z); elseif (y <= 5.5e+47) tmp = Float64(x / z); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -x / y; tmp = 0.0; if (y <= -6.6e+46) tmp = 1.0; elseif (y <= -4.7e-60) tmp = t_0; elseif (y <= -2.8e-83) tmp = 1.0; elseif (y <= 1.15e-170) tmp = x / z; elseif (y <= 9.5e-137) tmp = t_0; elseif (y <= 7e-74) tmp = x / z; elseif (y <= 3.8e-22) tmp = -y / z; elseif (y <= 5.5e+47) tmp = x / z; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[((-x) / y), $MachinePrecision]}, If[LessEqual[y, -6.6e+46], 1.0, If[LessEqual[y, -4.7e-60], t$95$0, If[LessEqual[y, -2.8e-83], 1.0, If[LessEqual[y, 1.15e-170], N[(x / z), $MachinePrecision], If[LessEqual[y, 9.5e-137], t$95$0, If[LessEqual[y, 7e-74], N[(x / z), $MachinePrecision], If[LessEqual[y, 3.8e-22], N[((-y) / z), $MachinePrecision], If[LessEqual[y, 5.5e+47], N[(x / z), $MachinePrecision], 1.0]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{y}\\
\mathbf{if}\;y \leq -6.6 \cdot 10^{+46}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -4.7 \cdot 10^{-60}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -2.8 \cdot 10^{-83}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-170}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{-137}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 7 \cdot 10^{-74}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{-22}:\\
\;\;\;\;\frac{-y}{z}\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+47}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -6.5999999999999996e46 or -4.7e-60 < y < -2.8000000000000001e-83 or 5.4999999999999998e47 < y Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
times-frac99.9%
metadata-eval99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in y around inf 61.3%
if -6.5999999999999996e46 < y < -4.7e-60 or 1.14999999999999993e-170 < y < 9.5000000000000007e-137Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around inf 75.1%
neg-mul-175.1%
distribute-neg-frac75.1%
Simplified75.1%
Taylor expanded in y around inf 54.5%
associate-*r/54.5%
mul-1-neg54.5%
Simplified54.5%
if -2.8000000000000001e-83 < y < 1.14999999999999993e-170 or 9.5000000000000007e-137 < y < 7.00000000000000029e-74 or 3.80000000000000023e-22 < y < 5.4999999999999998e47Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in y around 0 71.2%
if 7.00000000000000029e-74 < y < 3.80000000000000023e-22Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 73.8%
Taylor expanded in y around 0 74.1%
associate-*r/74.1%
neg-mul-174.1%
Simplified74.1%
Final simplification64.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -1.5e-111)
t_0
(if (<= y 1.15e-170)
(/ x z)
(if (<= y 9.5e-137)
(/ (- x) y)
(if (<= y 9e-69)
(/ x z)
(if (<= y 7.2e-23)
(/ (- y) z)
(if (<= y 1.8e-10) (/ x z) t_0))))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -1.5e-111) {
tmp = t_0;
} else if (y <= 1.15e-170) {
tmp = x / z;
} else if (y <= 9.5e-137) {
tmp = -x / y;
} else if (y <= 9e-69) {
tmp = x / z;
} else if (y <= 7.2e-23) {
tmp = -y / z;
} else if (y <= 1.8e-10) {
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.5d-111)) then
tmp = t_0
else if (y <= 1.15d-170) then
tmp = x / z
else if (y <= 9.5d-137) then
tmp = -x / y
else if (y <= 9d-69) then
tmp = x / z
else if (y <= 7.2d-23) then
tmp = -y / z
else if (y <= 1.8d-10) 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.5e-111) {
tmp = t_0;
} else if (y <= 1.15e-170) {
tmp = x / z;
} else if (y <= 9.5e-137) {
tmp = -x / y;
} else if (y <= 9e-69) {
tmp = x / z;
} else if (y <= 7.2e-23) {
tmp = -y / z;
} else if (y <= 1.8e-10) {
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.5e-111: tmp = t_0 elif y <= 1.15e-170: tmp = x / z elif y <= 9.5e-137: tmp = -x / y elif y <= 9e-69: tmp = x / z elif y <= 7.2e-23: tmp = -y / z elif y <= 1.8e-10: 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.5e-111) tmp = t_0; elseif (y <= 1.15e-170) tmp = Float64(x / z); elseif (y <= 9.5e-137) tmp = Float64(Float64(-x) / y); elseif (y <= 9e-69) tmp = Float64(x / z); elseif (y <= 7.2e-23) tmp = Float64(Float64(-y) / z); elseif (y <= 1.8e-10) 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.5e-111) tmp = t_0; elseif (y <= 1.15e-170) tmp = x / z; elseif (y <= 9.5e-137) tmp = -x / y; elseif (y <= 9e-69) tmp = x / z; elseif (y <= 7.2e-23) tmp = -y / z; elseif (y <= 1.8e-10) 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.5e-111], t$95$0, If[LessEqual[y, 1.15e-170], N[(x / z), $MachinePrecision], If[LessEqual[y, 9.5e-137], N[((-x) / y), $MachinePrecision], If[LessEqual[y, 9e-69], N[(x / z), $MachinePrecision], If[LessEqual[y, 7.2e-23], N[((-y) / z), $MachinePrecision], If[LessEqual[y, 1.8e-10], N[(x / z), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -1.5 \cdot 10^{-111}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-170}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{-137}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-69}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-23}:\\
\;\;\;\;\frac{-y}{z}\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-10}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1.50000000000000004e-111 or 1.8e-10 < y Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
times-frac99.9%
metadata-eval99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in z around 0 71.2%
div-sub71.3%
*-inverses71.3%
Simplified71.3%
if -1.50000000000000004e-111 < y < 1.14999999999999993e-170 or 9.5000000000000007e-137 < y < 9.00000000000000019e-69 or 7.1999999999999996e-23 < y < 1.8e-10Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in y around 0 78.9%
if 1.14999999999999993e-170 < y < 9.5000000000000007e-137Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
neg-mul-1100.0%
distribute-neg-frac100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
associate-*r/100.0%
mul-1-neg100.0%
Simplified100.0%
if 9.00000000000000019e-69 < y < 7.1999999999999996e-23Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 73.8%
Taylor expanded in y around 0 74.1%
associate-*r/74.1%
neg-mul-174.1%
Simplified74.1%
Final simplification74.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (- x) y)))
(if (<= y -5e+47)
1.0
(if (<= y -2.1e-59)
t_0
(if (<= y -2.7e-83)
1.0
(if (<= y 1.15e-170)
(/ x z)
(if (<= y 9.5e-137) t_0 (if (<= y 3.6e+47) (/ x z) 1.0))))))))
double code(double x, double y, double z) {
double t_0 = -x / y;
double tmp;
if (y <= -5e+47) {
tmp = 1.0;
} else if (y <= -2.1e-59) {
tmp = t_0;
} else if (y <= -2.7e-83) {
tmp = 1.0;
} else if (y <= 1.15e-170) {
tmp = x / z;
} else if (y <= 9.5e-137) {
tmp = t_0;
} else if (y <= 3.6e+47) {
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) :: t_0
real(8) :: tmp
t_0 = -x / y
if (y <= (-5d+47)) then
tmp = 1.0d0
else if (y <= (-2.1d-59)) then
tmp = t_0
else if (y <= (-2.7d-83)) then
tmp = 1.0d0
else if (y <= 1.15d-170) then
tmp = x / z
else if (y <= 9.5d-137) then
tmp = t_0
else if (y <= 3.6d+47) 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 t_0 = -x / y;
double tmp;
if (y <= -5e+47) {
tmp = 1.0;
} else if (y <= -2.1e-59) {
tmp = t_0;
} else if (y <= -2.7e-83) {
tmp = 1.0;
} else if (y <= 1.15e-170) {
tmp = x / z;
} else if (y <= 9.5e-137) {
tmp = t_0;
} else if (y <= 3.6e+47) {
tmp = x / z;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): t_0 = -x / y tmp = 0 if y <= -5e+47: tmp = 1.0 elif y <= -2.1e-59: tmp = t_0 elif y <= -2.7e-83: tmp = 1.0 elif y <= 1.15e-170: tmp = x / z elif y <= 9.5e-137: tmp = t_0 elif y <= 3.6e+47: tmp = x / z else: tmp = 1.0 return tmp
function code(x, y, z) t_0 = Float64(Float64(-x) / y) tmp = 0.0 if (y <= -5e+47) tmp = 1.0; elseif (y <= -2.1e-59) tmp = t_0; elseif (y <= -2.7e-83) tmp = 1.0; elseif (y <= 1.15e-170) tmp = Float64(x / z); elseif (y <= 9.5e-137) tmp = t_0; elseif (y <= 3.6e+47) tmp = Float64(x / z); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -x / y; tmp = 0.0; if (y <= -5e+47) tmp = 1.0; elseif (y <= -2.1e-59) tmp = t_0; elseif (y <= -2.7e-83) tmp = 1.0; elseif (y <= 1.15e-170) tmp = x / z; elseif (y <= 9.5e-137) tmp = t_0; elseif (y <= 3.6e+47) tmp = x / z; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[((-x) / y), $MachinePrecision]}, If[LessEqual[y, -5e+47], 1.0, If[LessEqual[y, -2.1e-59], t$95$0, If[LessEqual[y, -2.7e-83], 1.0, If[LessEqual[y, 1.15e-170], N[(x / z), $MachinePrecision], If[LessEqual[y, 9.5e-137], t$95$0, If[LessEqual[y, 3.6e+47], N[(x / z), $MachinePrecision], 1.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{y}\\
\mathbf{if}\;y \leq -5 \cdot 10^{+47}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{-59}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -2.7 \cdot 10^{-83}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-170}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{-137}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{+47}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5.00000000000000022e47 or -2.09999999999999997e-59 < y < -2.69999999999999991e-83 or 3.60000000000000008e47 < y Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
times-frac99.9%
metadata-eval99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in y around inf 61.3%
if -5.00000000000000022e47 < y < -2.09999999999999997e-59 or 1.14999999999999993e-170 < y < 9.5000000000000007e-137Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around inf 75.1%
neg-mul-175.1%
distribute-neg-frac75.1%
Simplified75.1%
Taylor expanded in y around inf 54.5%
associate-*r/54.5%
mul-1-neg54.5%
Simplified54.5%
if -2.69999999999999991e-83 < y < 1.14999999999999993e-170 or 9.5000000000000007e-137 < y < 3.60000000000000008e47Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in y around 0 67.2%
Final simplification63.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -7e+25) (not (<= y 4.3e+44))) (- 1.0 (/ x y)) (/ x (- z y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7e+25) || !(y <= 4.3e+44)) {
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 <= (-7d+25)) .or. (.not. (y <= 4.3d+44))) 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 <= -7e+25) || !(y <= 4.3e+44)) {
tmp = 1.0 - (x / y);
} else {
tmp = x / (z - y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7e+25) or not (y <= 4.3e+44): tmp = 1.0 - (x / y) else: tmp = x / (z - y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7e+25) || !(y <= 4.3e+44)) 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 <= -7e+25) || ~((y <= 4.3e+44))) tmp = 1.0 - (x / y); else tmp = x / (z - y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7e+25], N[Not[LessEqual[y, 4.3e+44]], $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 -7 \cdot 10^{+25} \lor \neg \left(y \leq 4.3 \cdot 10^{+44}\right):\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z - y}\\
\end{array}
\end{array}
if y < -6.99999999999999999e25 or 4.29999999999999982e44 < y Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
times-frac99.9%
metadata-eval99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in z around 0 76.8%
div-sub76.8%
*-inverses76.8%
Simplified76.8%
if -6.99999999999999999e25 < y < 4.29999999999999982e44Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around inf 77.0%
neg-mul-177.0%
distribute-neg-frac77.0%
Simplified77.0%
frac-2neg77.0%
div-inv76.8%
remove-double-neg76.8%
Applied egg-rr76.8%
Taylor expanded in x around 0 77.0%
Final simplification76.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.5e+37) (not (<= z 2e-29))) (/ (- x y) z) (- 1.0 (/ x y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.5e+37) || !(z <= 2e-29)) {
tmp = (x - y) / z;
} 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) :: tmp
if ((z <= (-4.5d+37)) .or. (.not. (z <= 2d-29))) then
tmp = (x - y) / z
else
tmp = 1.0d0 - (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4.5e+37) || !(z <= 2e-29)) {
tmp = (x - y) / z;
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.5e+37) or not (z <= 2e-29): tmp = (x - y) / z else: tmp = 1.0 - (x / y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.5e+37) || !(z <= 2e-29)) tmp = Float64(Float64(x - y) / z); else tmp = Float64(1.0 - Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.5e+37) || ~((z <= 2e-29))) tmp = (x - y) / z; else tmp = 1.0 - (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.5e+37], N[Not[LessEqual[z, 2e-29]], $MachinePrecision]], N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+37} \lor \neg \left(z \leq 2 \cdot 10^{-29}\right):\\
\;\;\;\;\frac{x - y}{z}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y}\\
\end{array}
\end{array}
if z < -4.49999999999999962e37 or 1.99999999999999989e-29 < z Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in z around inf 84.0%
associate-*r/84.0%
neg-mul-184.0%
neg-sub084.0%
associate--r-84.0%
neg-sub084.0%
Simplified84.0%
Taylor expanded in y around 0 84.0%
+-commutative84.0%
mul-1-neg84.0%
sub-neg84.0%
div-sub84.0%
Simplified84.0%
if -4.49999999999999962e37 < z < 1.99999999999999989e-29Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in z around 0 85.9%
div-sub85.9%
*-inverses85.9%
Simplified85.9%
Final simplification84.9%
(FPCore (x y z) :precision binary64 (if (<= y -1.08e+127) (/ y (- y z)) (if (<= y 4e+43) (/ x (- z y)) (- 1.0 (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.08e+127) {
tmp = y / (y - z);
} else if (y <= 4e+43) {
tmp = x / (z - y);
} 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) :: tmp
if (y <= (-1.08d+127)) then
tmp = y / (y - z)
else if (y <= 4d+43) then
tmp = x / (z - y)
else
tmp = 1.0d0 - (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.08e+127) {
tmp = y / (y - z);
} else if (y <= 4e+43) {
tmp = x / (z - y);
} else {
tmp = 1.0 - (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.08e+127: tmp = y / (y - z) elif y <= 4e+43: tmp = x / (z - y) else: tmp = 1.0 - (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.08e+127) tmp = Float64(y / Float64(y - z)); elseif (y <= 4e+43) tmp = Float64(x / Float64(z - y)); else tmp = Float64(1.0 - Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.08e+127) tmp = y / (y - z); elseif (y <= 4e+43) tmp = x / (z - y); else tmp = 1.0 - (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.08e+127], N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4e+43], N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.08 \cdot 10^{+127}:\\
\;\;\;\;\frac{y}{y - z}\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+43}:\\
\;\;\;\;\frac{x}{z - y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y}\\
\end{array}
\end{array}
if y < -1.08000000000000001e127Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 90.9%
if -1.08000000000000001e127 < y < 4.00000000000000006e43Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around inf 74.1%
neg-mul-174.1%
distribute-neg-frac74.1%
Simplified74.1%
frac-2neg74.1%
div-inv73.9%
remove-double-neg73.9%
Applied egg-rr73.9%
Taylor expanded in x around 0 74.1%
if 4.00000000000000006e43 < y Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
times-frac99.9%
metadata-eval99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in z around 0 80.3%
div-sub80.4%
*-inverses80.4%
Simplified80.4%
Final simplification78.1%
(FPCore (x y z) :precision binary64 (if (<= y -8e-35) 1.0 (if (<= y 3.5e+45) (/ x z) 1.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -8e-35) {
tmp = 1.0;
} else if (y <= 3.5e+45) {
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 <= (-8d-35)) then
tmp = 1.0d0
else if (y <= 3.5d+45) 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 <= -8e-35) {
tmp = 1.0;
} else if (y <= 3.5e+45) {
tmp = x / z;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -8e-35: tmp = 1.0 elif y <= 3.5e+45: tmp = x / z else: tmp = 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -8e-35) tmp = 1.0; elseif (y <= 3.5e+45) tmp = Float64(x / z); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -8e-35) tmp = 1.0; elseif (y <= 3.5e+45) tmp = x / z; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -8e-35], 1.0, If[LessEqual[y, 3.5e+45], N[(x / z), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{-35}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+45}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -8.00000000000000006e-35 or 3.50000000000000023e45 < y Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
times-frac99.9%
metadata-eval99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in y around inf 56.5%
if -8.00000000000000006e-35 < y < 3.50000000000000023e45Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in y around 0 62.3%
Final simplification59.2%
(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-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in y around inf 33.1%
Final simplification33.1%
(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 2023224
(FPCore (x y z)
:name "Graphics.Rasterific.Shading:$sgradientColorAt from Rasterific-0.6.1"
:precision binary64
:herbie-target
(- (/ x (- z y)) (/ y (- z y)))
(/ (- x y) (- z y)))