
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
Initial program 98.2%
Final simplification98.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (* y t_1)))
(if (<= t_1 -2e+62)
(* t (- (/ y (- z a))))
(if (<= t_1 -2e+23)
x
(if (<= t_1 -3.6e-22)
t_2
(if (<= t_1 0.04)
(+ x (* y (/ t a)))
(if (<= t_1 1.00000001) (+ x y) t_2)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = y * t_1;
double tmp;
if (t_1 <= -2e+62) {
tmp = t * -(y / (z - a));
} else if (t_1 <= -2e+23) {
tmp = x;
} else if (t_1 <= -3.6e-22) {
tmp = t_2;
} else if (t_1 <= 0.04) {
tmp = x + (y * (t / a));
} else if (t_1 <= 1.00000001) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z - t) / (z - a)
t_2 = y * t_1
if (t_1 <= (-2d+62)) then
tmp = t * -(y / (z - a))
else if (t_1 <= (-2d+23)) then
tmp = x
else if (t_1 <= (-3.6d-22)) then
tmp = t_2
else if (t_1 <= 0.04d0) then
tmp = x + (y * (t / a))
else if (t_1 <= 1.00000001d0) then
tmp = x + y
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = y * t_1;
double tmp;
if (t_1 <= -2e+62) {
tmp = t * -(y / (z - a));
} else if (t_1 <= -2e+23) {
tmp = x;
} else if (t_1 <= -3.6e-22) {
tmp = t_2;
} else if (t_1 <= 0.04) {
tmp = x + (y * (t / a));
} else if (t_1 <= 1.00000001) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) t_2 = y * t_1 tmp = 0 if t_1 <= -2e+62: tmp = t * -(y / (z - a)) elif t_1 <= -2e+23: tmp = x elif t_1 <= -3.6e-22: tmp = t_2 elif t_1 <= 0.04: tmp = x + (y * (t / a)) elif t_1 <= 1.00000001: tmp = x + y else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(y * t_1) tmp = 0.0 if (t_1 <= -2e+62) tmp = Float64(t * Float64(-Float64(y / Float64(z - a)))); elseif (t_1 <= -2e+23) tmp = x; elseif (t_1 <= -3.6e-22) tmp = t_2; elseif (t_1 <= 0.04) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (t_1 <= 1.00000001) tmp = Float64(x + y); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); t_2 = y * t_1; tmp = 0.0; if (t_1 <= -2e+62) tmp = t * -(y / (z - a)); elseif (t_1 <= -2e+23) tmp = x; elseif (t_1 <= -3.6e-22) tmp = t_2; elseif (t_1 <= 0.04) tmp = x + (y * (t / a)); elseif (t_1 <= 1.00000001) tmp = x + y; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+62], N[(t * (-N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$1, -2e+23], x, If[LessEqual[t$95$1, -3.6e-22], t$95$2, If[LessEqual[t$95$1, 0.04], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1.00000001], N[(x + y), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := y \cdot t_1\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+62}:\\
\;\;\;\;t \cdot \left(-\frac{y}{z - a}\right)\\
\mathbf{elif}\;t_1 \leq -2 \cdot 10^{+23}:\\
\;\;\;\;x\\
\mathbf{elif}\;t_1 \leq -3.6 \cdot 10^{-22}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 0.04:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;t_1 \leq 1.00000001:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -2.00000000000000007e62Initial program 93.6%
+-commutative93.6%
associate-*r/85.2%
associate-*l/99.6%
fma-def99.7%
Simplified99.7%
fma-udef99.6%
associate-*l/85.2%
Applied egg-rr85.2%
Taylor expanded in t around inf 85.2%
associate-*r/85.2%
mul-1-neg85.2%
distribute-lft-neg-out85.2%
*-commutative85.2%
Simplified85.2%
Taylor expanded in y around 0 85.2%
mul-1-neg85.2%
*-commutative85.2%
associate-/l*93.8%
sub-neg93.8%
associate-/r/99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in x around 0 71.5%
mul-1-neg71.5%
associate-*r/86.0%
distribute-rgt-neg-in86.0%
distribute-neg-frac86.0%
Simplified86.0%
if -2.00000000000000007e62 < (/.f64 (-.f64 z t) (-.f64 z a)) < -1.9999999999999998e23Initial program 100.0%
Taylor expanded in x around inf 100.0%
if -1.9999999999999998e23 < (/.f64 (-.f64 z t) (-.f64 z a)) < -3.5999999999999998e-22 or 1.0000000099999999 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 96.3%
+-commutative96.3%
associate-*r/81.6%
associate-*l/93.0%
fma-def93.0%
Simplified93.0%
fma-udef93.0%
associate-*l/81.6%
Applied egg-rr81.6%
Taylor expanded in y around inf 80.3%
div-sub80.3%
Simplified80.3%
if -3.5999999999999998e-22 < (/.f64 (-.f64 z t) (-.f64 z a)) < 0.0400000000000000008Initial program 99.4%
Taylor expanded in z around 0 89.5%
if 0.0400000000000000008 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1.0000000099999999Initial program 99.9%
Taylor expanded in z around inf 99.5%
+-commutative99.5%
Simplified99.5%
Final simplification90.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (* y t_1)))
(if (<= t_1 -2e+62)
(* t (- (/ y (- z a))))
(if (<= t_1 -2e+23)
x
(if (<= t_1 -3.6e-22)
t_2
(if (<= t_1 0.04)
(+ x (* y (/ t a)))
(if (<= t_1 1.00000001) (+ x (* y (- 1.0 (/ t z)))) t_2)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = y * t_1;
double tmp;
if (t_1 <= -2e+62) {
tmp = t * -(y / (z - a));
} else if (t_1 <= -2e+23) {
tmp = x;
} else if (t_1 <= -3.6e-22) {
tmp = t_2;
} else if (t_1 <= 0.04) {
tmp = x + (y * (t / a));
} else if (t_1 <= 1.00000001) {
tmp = x + (y * (1.0 - (t / z)));
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z - t) / (z - a)
t_2 = y * t_1
if (t_1 <= (-2d+62)) then
tmp = t * -(y / (z - a))
else if (t_1 <= (-2d+23)) then
tmp = x
else if (t_1 <= (-3.6d-22)) then
tmp = t_2
else if (t_1 <= 0.04d0) then
tmp = x + (y * (t / a))
else if (t_1 <= 1.00000001d0) then
tmp = x + (y * (1.0d0 - (t / z)))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = y * t_1;
double tmp;
if (t_1 <= -2e+62) {
tmp = t * -(y / (z - a));
} else if (t_1 <= -2e+23) {
tmp = x;
} else if (t_1 <= -3.6e-22) {
tmp = t_2;
} else if (t_1 <= 0.04) {
tmp = x + (y * (t / a));
} else if (t_1 <= 1.00000001) {
tmp = x + (y * (1.0 - (t / z)));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) t_2 = y * t_1 tmp = 0 if t_1 <= -2e+62: tmp = t * -(y / (z - a)) elif t_1 <= -2e+23: tmp = x elif t_1 <= -3.6e-22: tmp = t_2 elif t_1 <= 0.04: tmp = x + (y * (t / a)) elif t_1 <= 1.00000001: tmp = x + (y * (1.0 - (t / z))) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(y * t_1) tmp = 0.0 if (t_1 <= -2e+62) tmp = Float64(t * Float64(-Float64(y / Float64(z - a)))); elseif (t_1 <= -2e+23) tmp = x; elseif (t_1 <= -3.6e-22) tmp = t_2; elseif (t_1 <= 0.04) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (t_1 <= 1.00000001) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); t_2 = y * t_1; tmp = 0.0; if (t_1 <= -2e+62) tmp = t * -(y / (z - a)); elseif (t_1 <= -2e+23) tmp = x; elseif (t_1 <= -3.6e-22) tmp = t_2; elseif (t_1 <= 0.04) tmp = x + (y * (t / a)); elseif (t_1 <= 1.00000001) tmp = x + (y * (1.0 - (t / z))); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+62], N[(t * (-N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$1, -2e+23], x, If[LessEqual[t$95$1, -3.6e-22], t$95$2, If[LessEqual[t$95$1, 0.04], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1.00000001], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := y \cdot t_1\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+62}:\\
\;\;\;\;t \cdot \left(-\frac{y}{z - a}\right)\\
\mathbf{elif}\;t_1 \leq -2 \cdot 10^{+23}:\\
\;\;\;\;x\\
\mathbf{elif}\;t_1 \leq -3.6 \cdot 10^{-22}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 0.04:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;t_1 \leq 1.00000001:\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -2.00000000000000007e62Initial program 93.6%
+-commutative93.6%
associate-*r/85.2%
associate-*l/99.6%
fma-def99.7%
Simplified99.7%
fma-udef99.6%
associate-*l/85.2%
Applied egg-rr85.2%
Taylor expanded in t around inf 85.2%
associate-*r/85.2%
mul-1-neg85.2%
distribute-lft-neg-out85.2%
*-commutative85.2%
Simplified85.2%
Taylor expanded in y around 0 85.2%
mul-1-neg85.2%
*-commutative85.2%
associate-/l*93.8%
sub-neg93.8%
associate-/r/99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in x around 0 71.5%
mul-1-neg71.5%
associate-*r/86.0%
distribute-rgt-neg-in86.0%
distribute-neg-frac86.0%
Simplified86.0%
if -2.00000000000000007e62 < (/.f64 (-.f64 z t) (-.f64 z a)) < -1.9999999999999998e23Initial program 100.0%
Taylor expanded in x around inf 100.0%
if -1.9999999999999998e23 < (/.f64 (-.f64 z t) (-.f64 z a)) < -3.5999999999999998e-22 or 1.0000000099999999 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 96.3%
+-commutative96.3%
associate-*r/81.6%
associate-*l/93.0%
fma-def93.0%
Simplified93.0%
fma-udef93.0%
associate-*l/81.6%
Applied egg-rr81.6%
Taylor expanded in y around inf 80.3%
div-sub80.3%
Simplified80.3%
if -3.5999999999999998e-22 < (/.f64 (-.f64 z t) (-.f64 z a)) < 0.0400000000000000008Initial program 99.4%
Taylor expanded in z around 0 89.5%
if 0.0400000000000000008 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1.0000000099999999Initial program 99.9%
Taylor expanded in a around 0 99.6%
div-sub99.6%
*-inverses99.6%
Simplified99.6%
Final simplification90.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (* y t_1)))
(if (<= t_1 -2e+62)
(* t (- (/ y (- z a))))
(if (<= t_1 -2e+23)
x
(if (<= t_1 -3.6e-22)
t_2
(if (<= t_1 -4e-318)
(+ x (/ t (/ a y)))
(if (<= t_1 1.00000001) (+ x (* y (/ z (- z a)))) t_2)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = y * t_1;
double tmp;
if (t_1 <= -2e+62) {
tmp = t * -(y / (z - a));
} else if (t_1 <= -2e+23) {
tmp = x;
} else if (t_1 <= -3.6e-22) {
tmp = t_2;
} else if (t_1 <= -4e-318) {
tmp = x + (t / (a / y));
} else if (t_1 <= 1.00000001) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z - t) / (z - a)
t_2 = y * t_1
if (t_1 <= (-2d+62)) then
tmp = t * -(y / (z - a))
else if (t_1 <= (-2d+23)) then
tmp = x
else if (t_1 <= (-3.6d-22)) then
tmp = t_2
else if (t_1 <= (-4d-318)) then
tmp = x + (t / (a / y))
else if (t_1 <= 1.00000001d0) then
tmp = x + (y * (z / (z - a)))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = y * t_1;
double tmp;
if (t_1 <= -2e+62) {
tmp = t * -(y / (z - a));
} else if (t_1 <= -2e+23) {
tmp = x;
} else if (t_1 <= -3.6e-22) {
tmp = t_2;
} else if (t_1 <= -4e-318) {
tmp = x + (t / (a / y));
} else if (t_1 <= 1.00000001) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) t_2 = y * t_1 tmp = 0 if t_1 <= -2e+62: tmp = t * -(y / (z - a)) elif t_1 <= -2e+23: tmp = x elif t_1 <= -3.6e-22: tmp = t_2 elif t_1 <= -4e-318: tmp = x + (t / (a / y)) elif t_1 <= 1.00000001: tmp = x + (y * (z / (z - a))) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(y * t_1) tmp = 0.0 if (t_1 <= -2e+62) tmp = Float64(t * Float64(-Float64(y / Float64(z - a)))); elseif (t_1 <= -2e+23) tmp = x; elseif (t_1 <= -3.6e-22) tmp = t_2; elseif (t_1 <= -4e-318) tmp = Float64(x + Float64(t / Float64(a / y))); elseif (t_1 <= 1.00000001) tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); t_2 = y * t_1; tmp = 0.0; if (t_1 <= -2e+62) tmp = t * -(y / (z - a)); elseif (t_1 <= -2e+23) tmp = x; elseif (t_1 <= -3.6e-22) tmp = t_2; elseif (t_1 <= -4e-318) tmp = x + (t / (a / y)); elseif (t_1 <= 1.00000001) tmp = x + (y * (z / (z - a))); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+62], N[(t * (-N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$1, -2e+23], x, If[LessEqual[t$95$1, -3.6e-22], t$95$2, If[LessEqual[t$95$1, -4e-318], N[(x + N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1.00000001], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := y \cdot t_1\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+62}:\\
\;\;\;\;t \cdot \left(-\frac{y}{z - a}\right)\\
\mathbf{elif}\;t_1 \leq -2 \cdot 10^{+23}:\\
\;\;\;\;x\\
\mathbf{elif}\;t_1 \leq -3.6 \cdot 10^{-22}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq -4 \cdot 10^{-318}:\\
\;\;\;\;x + \frac{t}{\frac{a}{y}}\\
\mathbf{elif}\;t_1 \leq 1.00000001:\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -2.00000000000000007e62Initial program 93.6%
+-commutative93.6%
associate-*r/85.2%
associate-*l/99.6%
fma-def99.7%
Simplified99.7%
fma-udef99.6%
associate-*l/85.2%
Applied egg-rr85.2%
Taylor expanded in t around inf 85.2%
associate-*r/85.2%
mul-1-neg85.2%
distribute-lft-neg-out85.2%
*-commutative85.2%
Simplified85.2%
Taylor expanded in y around 0 85.2%
mul-1-neg85.2%
*-commutative85.2%
associate-/l*93.8%
sub-neg93.8%
associate-/r/99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in x around 0 71.5%
mul-1-neg71.5%
associate-*r/86.0%
distribute-rgt-neg-in86.0%
distribute-neg-frac86.0%
Simplified86.0%
if -2.00000000000000007e62 < (/.f64 (-.f64 z t) (-.f64 z a)) < -1.9999999999999998e23Initial program 100.0%
Taylor expanded in x around inf 100.0%
if -1.9999999999999998e23 < (/.f64 (-.f64 z t) (-.f64 z a)) < -3.5999999999999998e-22 or 1.0000000099999999 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 96.3%
+-commutative96.3%
associate-*r/81.6%
associate-*l/93.0%
fma-def93.0%
Simplified93.0%
fma-udef93.0%
associate-*l/81.6%
Applied egg-rr81.6%
Taylor expanded in y around inf 80.3%
div-sub80.3%
Simplified80.3%
if -3.5999999999999998e-22 < (/.f64 (-.f64 z t) (-.f64 z a)) < -3.9999999e-318Initial program 98.6%
Taylor expanded in z around 0 83.7%
+-commutative83.7%
associate-/l*91.1%
Simplified91.1%
if -3.9999999e-318 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1.0000000099999999Initial program 99.9%
Taylor expanded in t around 0 96.7%
Final simplification91.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (- x (* t (/ y (- z a))))))
(if (<= t_1 -2e+23)
t_2
(if (<= t_1 -3.6e-22)
(* y t_1)
(if (<= t_1 -4e-318)
(+ x (/ t (/ a y)))
(if (<= t_1 10.0) (+ x (* y (/ z (- z a)))) t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = x - (t * (y / (z - a)));
double tmp;
if (t_1 <= -2e+23) {
tmp = t_2;
} else if (t_1 <= -3.6e-22) {
tmp = y * t_1;
} else if (t_1 <= -4e-318) {
tmp = x + (t / (a / y));
} else if (t_1 <= 10.0) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z - t) / (z - a)
t_2 = x - (t * (y / (z - a)))
if (t_1 <= (-2d+23)) then
tmp = t_2
else if (t_1 <= (-3.6d-22)) then
tmp = y * t_1
else if (t_1 <= (-4d-318)) then
tmp = x + (t / (a / y))
else if (t_1 <= 10.0d0) then
tmp = x + (y * (z / (z - a)))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = x - (t * (y / (z - a)));
double tmp;
if (t_1 <= -2e+23) {
tmp = t_2;
} else if (t_1 <= -3.6e-22) {
tmp = y * t_1;
} else if (t_1 <= -4e-318) {
tmp = x + (t / (a / y));
} else if (t_1 <= 10.0) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) t_2 = x - (t * (y / (z - a))) tmp = 0 if t_1 <= -2e+23: tmp = t_2 elif t_1 <= -3.6e-22: tmp = y * t_1 elif t_1 <= -4e-318: tmp = x + (t / (a / y)) elif t_1 <= 10.0: tmp = x + (y * (z / (z - a))) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(x - Float64(t * Float64(y / Float64(z - a)))) tmp = 0.0 if (t_1 <= -2e+23) tmp = t_2; elseif (t_1 <= -3.6e-22) tmp = Float64(y * t_1); elseif (t_1 <= -4e-318) tmp = Float64(x + Float64(t / Float64(a / y))); elseif (t_1 <= 10.0) tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); t_2 = x - (t * (y / (z - a))); tmp = 0.0; if (t_1 <= -2e+23) tmp = t_2; elseif (t_1 <= -3.6e-22) tmp = y * t_1; elseif (t_1 <= -4e-318) tmp = x + (t / (a / y)); elseif (t_1 <= 10.0) tmp = x + (y * (z / (z - a))); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(t * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+23], t$95$2, If[LessEqual[t$95$1, -3.6e-22], N[(y * t$95$1), $MachinePrecision], If[LessEqual[t$95$1, -4e-318], N[(x + N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 10.0], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := x - t \cdot \frac{y}{z - a}\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+23}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq -3.6 \cdot 10^{-22}:\\
\;\;\;\;y \cdot t_1\\
\mathbf{elif}\;t_1 \leq -4 \cdot 10^{-318}:\\
\;\;\;\;x + \frac{t}{\frac{a}{y}}\\
\mathbf{elif}\;t_1 \leq 10:\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -1.9999999999999998e23 or 10 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 94.9%
+-commutative94.9%
associate-*r/90.4%
associate-*l/97.3%
fma-def97.3%
Simplified97.3%
fma-udef97.3%
associate-*l/90.4%
Applied egg-rr90.4%
Taylor expanded in t around inf 90.4%
associate-*r/90.4%
mul-1-neg90.4%
distribute-lft-neg-out90.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in y around 0 90.4%
mul-1-neg90.4%
*-commutative90.4%
associate-/l*95.0%
sub-neg95.0%
associate-/r/97.3%
*-commutative97.3%
Simplified97.3%
if -1.9999999999999998e23 < (/.f64 (-.f64 z t) (-.f64 z a)) < -3.5999999999999998e-22Initial program 99.5%
+-commutative99.5%
associate-*r/42.4%
associate-*l/84.9%
fma-def85.0%
Simplified85.0%
fma-udef84.9%
associate-*l/42.4%
Applied egg-rr42.4%
Taylor expanded in y around inf 98.3%
div-sub98.1%
Simplified98.1%
if -3.5999999999999998e-22 < (/.f64 (-.f64 z t) (-.f64 z a)) < -3.9999999e-318Initial program 98.6%
Taylor expanded in z around 0 83.7%
+-commutative83.7%
associate-/l*91.1%
Simplified91.1%
if -3.9999999e-318 < (/.f64 (-.f64 z t) (-.f64 z a)) < 10Initial program 99.9%
Taylor expanded in t around 0 96.6%
Final simplification96.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (- x (* t (/ y (- z a))))))
(if (<= t_1 -200.0)
t_2
(if (<= t_1 0.04)
(- x (/ y (/ a (- z t))))
(if (<= t_1 10.0) (+ x (/ y (- 1.0 (/ a z)))) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = x - (t * (y / (z - a)));
double tmp;
if (t_1 <= -200.0) {
tmp = t_2;
} else if (t_1 <= 0.04) {
tmp = x - (y / (a / (z - t)));
} else if (t_1 <= 10.0) {
tmp = x + (y / (1.0 - (a / z)));
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z - t) / (z - a)
t_2 = x - (t * (y / (z - a)))
if (t_1 <= (-200.0d0)) then
tmp = t_2
else if (t_1 <= 0.04d0) then
tmp = x - (y / (a / (z - t)))
else if (t_1 <= 10.0d0) then
tmp = x + (y / (1.0d0 - (a / z)))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = x - (t * (y / (z - a)));
double tmp;
if (t_1 <= -200.0) {
tmp = t_2;
} else if (t_1 <= 0.04) {
tmp = x - (y / (a / (z - t)));
} else if (t_1 <= 10.0) {
tmp = x + (y / (1.0 - (a / z)));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) t_2 = x - (t * (y / (z - a))) tmp = 0 if t_1 <= -200.0: tmp = t_2 elif t_1 <= 0.04: tmp = x - (y / (a / (z - t))) elif t_1 <= 10.0: tmp = x + (y / (1.0 - (a / z))) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(x - Float64(t * Float64(y / Float64(z - a)))) tmp = 0.0 if (t_1 <= -200.0) tmp = t_2; elseif (t_1 <= 0.04) tmp = Float64(x - Float64(y / Float64(a / Float64(z - t)))); elseif (t_1 <= 10.0) tmp = Float64(x + Float64(y / Float64(1.0 - Float64(a / z)))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); t_2 = x - (t * (y / (z - a))); tmp = 0.0; if (t_1 <= -200.0) tmp = t_2; elseif (t_1 <= 0.04) tmp = x - (y / (a / (z - t))); elseif (t_1 <= 10.0) tmp = x + (y / (1.0 - (a / z))); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(t * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -200.0], t$95$2, If[LessEqual[t$95$1, 0.04], N[(x - N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 10.0], N[(x + N[(y / N[(1.0 - N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := x - t \cdot \frac{y}{z - a}\\
\mathbf{if}\;t_1 \leq -200:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 0.04:\\
\;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\
\mathbf{elif}\;t_1 \leq 10:\\
\;\;\;\;x + \frac{y}{1 - \frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -200 or 10 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 95.1%
+-commutative95.1%
associate-*r/87.6%
associate-*l/96.3%
fma-def96.3%
Simplified96.3%
fma-udef96.3%
associate-*l/87.6%
Applied egg-rr87.6%
Taylor expanded in t around inf 87.0%
associate-*r/87.0%
mul-1-neg87.0%
distribute-lft-neg-out87.0%
*-commutative87.0%
Simplified87.0%
Taylor expanded in y around 0 87.0%
mul-1-neg87.0%
*-commutative87.0%
associate-/l*93.1%
sub-neg93.1%
associate-/r/94.1%
*-commutative94.1%
Simplified94.1%
if -200 < (/.f64 (-.f64 z t) (-.f64 z a)) < 0.0400000000000000008Initial program 99.4%
Taylor expanded in a around inf 84.3%
mul-1-neg84.3%
unsub-neg84.3%
associate-/l*98.3%
Simplified98.3%
if 0.0400000000000000008 < (/.f64 (-.f64 z t) (-.f64 z a)) < 10Initial program 99.9%
+-commutative99.9%
associate-*r/70.4%
associate-*l/96.7%
fma-def96.7%
Simplified96.7%
fma-udef96.7%
associate-*l/70.4%
Applied egg-rr70.4%
Taylor expanded in t around 0 70.1%
associate-/l*99.6%
div-sub99.7%
*-inverses99.7%
Simplified99.7%
Final simplification97.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.8e+58) (not (<= z 1.25e-8))) (+ x y) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.8e+58) || !(z <= 1.25e-8)) {
tmp = x + y;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-4.8d+58)) .or. (.not. (z <= 1.25d-8))) then
tmp = x + y
else
tmp = x + (y * (t / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.8e+58) || !(z <= 1.25e-8)) {
tmp = x + y;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.8e+58) or not (z <= 1.25e-8): tmp = x + y else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.8e+58) || !(z <= 1.25e-8)) tmp = Float64(x + y); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4.8e+58) || ~((z <= 1.25e-8))) tmp = x + y; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.8e+58], N[Not[LessEqual[z, 1.25e-8]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+58} \lor \neg \left(z \leq 1.25 \cdot 10^{-8}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -4.8e58 or 1.2499999999999999e-8 < z Initial program 99.9%
Taylor expanded in z around inf 79.0%
+-commutative79.0%
Simplified79.0%
if -4.8e58 < z < 1.2499999999999999e-8Initial program 97.1%
Taylor expanded in z around 0 80.5%
Final simplification79.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.2e-59) (+ x y) (if (<= z 6e-21) x (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.2e-59) {
tmp = x + y;
} else if (z <= 6e-21) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-2.2d-59)) then
tmp = x + y
else if (z <= 6d-21) then
tmp = x
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.2e-59) {
tmp = x + y;
} else if (z <= 6e-21) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.2e-59: tmp = x + y elif z <= 6e-21: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.2e-59) tmp = Float64(x + y); elseif (z <= 6e-21) tmp = x; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.2e-59) tmp = x + y; elseif (z <= 6e-21) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.2e-59], N[(x + y), $MachinePrecision], If[LessEqual[z, 6e-21], x, N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{-59}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-21}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -2.1999999999999999e-59 or 5.99999999999999982e-21 < z Initial program 99.9%
Taylor expanded in z around inf 71.7%
+-commutative71.7%
Simplified71.7%
if -2.1999999999999999e-59 < z < 5.99999999999999982e-21Initial program 96.6%
Taylor expanded in x around inf 54.6%
Final simplification62.9%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 98.2%
Taylor expanded in x around inf 48.2%
Final simplification48.2%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- z a) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y / ((z - a) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((z - a) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(z - a) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((z - a) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{z - a}{z - t}}
\end{array}
herbie shell --seed 2023290
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
:precision binary64
:herbie-target
(+ x (/ y (/ (- z a) (- z t))))
(+ x (* y (/ (- z t) (- z a)))))