
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - 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 - t) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\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) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - 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 - t) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma y (/ (- z a) t) x)))
(if (<= t -3.4e+130)
t_1
(if (<= t 2e+167) (+ (+ y x) (* (/ y (- a t)) (- t z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((z - a) / t), x);
double tmp;
if (t <= -3.4e+130) {
tmp = t_1;
} else if (t <= 2e+167) {
tmp = (y + x) + ((y / (a - t)) * (t - z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(z - a) / t), x) tmp = 0.0 if (t <= -3.4e+130) tmp = t_1; elseif (t <= 2e+167) tmp = Float64(Float64(y + x) + Float64(Float64(y / Float64(a - t)) * Float64(t - z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -3.4e+130], t$95$1, If[LessEqual[t, 2e+167], N[(N[(y + x), $MachinePrecision] + N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{z - a}{t}, x\right)\\
\mathbf{if}\;t \leq -3.4 \cdot 10^{+130}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2 \cdot 10^{+167}:\\
\;\;\;\;\left(y + x\right) + \frac{y}{a - t} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.4000000000000001e130 or 2.0000000000000001e167 < t Initial program 56.9%
Taylor expanded in t around inf
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
sub-negN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6488.6
Simplified88.6%
associate-*l/N/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6492.4
Applied egg-rr92.4%
if -3.4000000000000001e130 < t < 2.0000000000000001e167Initial program 88.7%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6495.5
Applied egg-rr95.5%
Final simplification94.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* y z) t)) (t_2 (+ (+ y x) (/ (* y (- z t)) (- t a))))) (if (<= t_2 -1e+289) t_1 (if (<= t_2 5e+305) (+ y x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * z) / t;
double t_2 = (y + x) + ((y * (z - t)) / (t - a));
double tmp;
if (t_2 <= -1e+289) {
tmp = t_1;
} else if (t_2 <= 5e+305) {
tmp = y + x;
} else {
tmp = t_1;
}
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 = (y * z) / t
t_2 = (y + x) + ((y * (z - t)) / (t - a))
if (t_2 <= (-1d+289)) then
tmp = t_1
else if (t_2 <= 5d+305) then
tmp = y + x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * z) / t;
double t_2 = (y + x) + ((y * (z - t)) / (t - a));
double tmp;
if (t_2 <= -1e+289) {
tmp = t_1;
} else if (t_2 <= 5e+305) {
tmp = y + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * z) / t t_2 = (y + x) + ((y * (z - t)) / (t - a)) tmp = 0 if t_2 <= -1e+289: tmp = t_1 elif t_2 <= 5e+305: tmp = y + x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * z) / t) t_2 = Float64(Float64(y + x) + Float64(Float64(y * Float64(z - t)) / Float64(t - a))) tmp = 0.0 if (t_2 <= -1e+289) tmp = t_1; elseif (t_2 <= 5e+305) tmp = Float64(y + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * z) / t; t_2 = (y + x) + ((y * (z - t)) / (t - a)); tmp = 0.0; if (t_2 <= -1e+289) tmp = t_1; elseif (t_2 <= 5e+305) tmp = y + x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + x), $MachinePrecision] + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+289], t$95$1, If[LessEqual[t$95$2, 5e+305], N[(y + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot z}{t}\\
t_2 := \left(y + x\right) + \frac{y \cdot \left(z - t\right)}{t - a}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+289}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+305}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -1.0000000000000001e289 or 5.00000000000000009e305 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 41.0%
Taylor expanded in z around inf
associate-*r/N/A
mul-1-negN/A
/-lowering-/.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f6446.0
Simplified46.0%
Taylor expanded in a around 0
/-lowering-/.f64N/A
*-lowering-*.f6438.3
Simplified38.3%
if -1.0000000000000001e289 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 5.00000000000000009e305Initial program 94.0%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f6474.4
Simplified74.4%
Final simplification64.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma y (/ (- z a) t) x)))
(if (<= t -2.85e+125)
t_1
(if (<= t 7.2e-78) (fma y (- 1.0 (/ z a)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((z - a) / t), x);
double tmp;
if (t <= -2.85e+125) {
tmp = t_1;
} else if (t <= 7.2e-78) {
tmp = fma(y, (1.0 - (z / a)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(z - a) / t), x) tmp = 0.0 if (t <= -2.85e+125) tmp = t_1; elseif (t <= 7.2e-78) tmp = fma(y, Float64(1.0 - Float64(z / a)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -2.85e+125], t$95$1, If[LessEqual[t, 7.2e-78], N[(y * N[(1.0 - N[(z / a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{z - a}{t}, x\right)\\
\mathbf{if}\;t \leq -2.85 \cdot 10^{+125}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{-78}:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.8499999999999998e125 or 7.2000000000000005e-78 < t Initial program 67.3%
Taylor expanded in t around inf
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
sub-negN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6482.5
Simplified82.5%
associate-*l/N/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6484.7
Applied egg-rr84.7%
if -2.8499999999999998e125 < t < 7.2000000000000005e-78Initial program 90.5%
Taylor expanded in t around 0
associate--l+N/A
+-commutativeN/A
*-rgt-identityN/A
associate-/l*N/A
distribute-lft-out--N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
/-lowering-/.f6483.4
Simplified83.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (- 1.0 (/ z a)) x))) (if (<= a -1.7e-70) t_1 (if (<= a 3.1e-50) (fma (/ y t) z x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, (1.0 - (z / a)), x);
double tmp;
if (a <= -1.7e-70) {
tmp = t_1;
} else if (a <= 3.1e-50) {
tmp = fma((y / t), z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(1.0 - Float64(z / a)), x) tmp = 0.0 if (a <= -1.7e-70) tmp = t_1; elseif (a <= 3.1e-50) tmp = fma(Float64(y / t), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(1.0 - N[(z / a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.7e-70], t$95$1, If[LessEqual[a, 3.1e-50], N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, 1 - \frac{z}{a}, x\right)\\
\mathbf{if}\;a \leq -1.7 \cdot 10^{-70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3.1 \cdot 10^{-50}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.69999999999999998e-70 or 3.1000000000000002e-50 < a Initial program 79.8%
Taylor expanded in t around 0
associate--l+N/A
+-commutativeN/A
*-rgt-identityN/A
associate-/l*N/A
distribute-lft-out--N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
/-lowering-/.f6483.6
Simplified83.6%
if -1.69999999999999998e-70 < a < 3.1000000000000002e-50Initial program 80.6%
Taylor expanded in t around inf
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
sub-negN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6483.6
Simplified83.6%
Taylor expanded in z around inf
Simplified82.5%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.55e+16) (fma x (/ y x) x) (if (<= a 0.85) (fma (/ y t) z x) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.55e+16) {
tmp = fma(x, (y / x), x);
} else if (a <= 0.85) {
tmp = fma((y / t), z, x);
} else {
tmp = y + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.55e+16) tmp = fma(x, Float64(y / x), x); elseif (a <= 0.85) tmp = fma(Float64(y / t), z, x); else tmp = Float64(y + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.55e+16], N[(x * N[(y / x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 0.85], N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.55 \cdot 10^{+16}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{x}, x\right)\\
\mathbf{elif}\;a \leq 0.85:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -1.55e16Initial program 81.0%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f6477.6
Simplified77.6%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6479.6
Simplified79.6%
if -1.55e16 < a < 0.849999999999999978Initial program 80.0%
Taylor expanded in t around inf
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
sub-negN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6477.9
Simplified77.9%
Taylor expanded in z around inf
Simplified76.4%
if 0.849999999999999978 < a Initial program 79.4%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f6479.5
Simplified79.5%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.7e+15) (fma x (/ y x) x) (if (<= a 0.072) (fma y (/ z t) x) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.7e+15) {
tmp = fma(x, (y / x), x);
} else if (a <= 0.072) {
tmp = fma(y, (z / t), x);
} else {
tmp = y + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.7e+15) tmp = fma(x, Float64(y / x), x); elseif (a <= 0.072) tmp = fma(y, Float64(z / t), x); else tmp = Float64(y + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.7e+15], N[(x * N[(y / x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 0.072], N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.7 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{x}, x\right)\\
\mathbf{elif}\;a \leq 0.072:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -2.7e15Initial program 81.0%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f6477.6
Simplified77.6%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6479.6
Simplified79.6%
if -2.7e15 < a < 0.0719999999999999946Initial program 80.0%
Taylor expanded in t around inf
Simplified72.0%
Taylor expanded in a around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6474.2
Simplified74.2%
if 0.0719999999999999946 < a Initial program 79.4%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f6479.5
Simplified79.5%
(FPCore (x y z t a) :precision binary64 (if (<= y -7.8e+135) y (if (<= y 6e+105) x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -7.8e+135) {
tmp = y;
} else if (y <= 6e+105) {
tmp = x;
} else {
tmp = 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 (y <= (-7.8d+135)) then
tmp = y
else if (y <= 6d+105) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -7.8e+135) {
tmp = y;
} else if (y <= 6e+105) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -7.8e+135: tmp = y elif y <= 6e+105: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -7.8e+135) tmp = y; elseif (y <= 6e+105) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -7.8e+135) tmp = y; elseif (y <= 6e+105) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -7.8e+135], y, If[LessEqual[y, 6e+105], x, y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{+135}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+105}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -7.80000000000000064e135 or 6.0000000000000001e105 < y Initial program 53.8%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f6444.6
Simplified44.6%
Taylor expanded in y around inf
Simplified38.7%
if -7.80000000000000064e135 < y < 6.0000000000000001e105Initial program 89.8%
Taylor expanded in x around inf
Simplified61.4%
(FPCore (x y z t a) :precision binary64 (if (<= t 3.1e+167) (+ y x) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 3.1e+167) {
tmp = y + x;
} else {
tmp = x;
}
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 (t <= 3.1d+167) then
tmp = y + x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 3.1e+167) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 3.1e+167: tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 3.1e+167) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 3.1e+167) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 3.1e+167], N[(y + x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.1 \cdot 10^{+167}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < 3.1e167Initial program 82.2%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f6462.7
Simplified62.7%
if 3.1e167 < t Initial program 61.3%
Taylor expanded in x around inf
Simplified63.0%
(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 80.1%
Taylor expanded in x around inf
Simplified48.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)))
(t_2 (- (+ x y) (/ (* (- z t) y) (- a t)))))
(if (< t_2 -1.3664970889390727e-7)
t_1
(if (< t_2 1.4754293444577233e-239)
(/ (- (* y (- a z)) (* x t)) (- a t))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (a - t);
} else {
tmp = t_1;
}
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 = (y + x) - (((z - t) * (1.0d0 / (a - t))) * y)
t_2 = (x + y) - (((z - t) * y) / (a - t))
if (t_2 < (-1.3664970889390727d-7)) then
tmp = t_1
else if (t_2 < 1.4754293444577233d-239) then
tmp = ((y * (a - z)) - (x * t)) / (a - t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (a - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y) t_2 = (x + y) - (((z - t) * y) / (a - t)) tmp = 0 if t_2 < -1.3664970889390727e-7: tmp = t_1 elif t_2 < 1.4754293444577233e-239: tmp = ((y * (a - z)) - (x * t)) / (a - t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y + x) - Float64(Float64(Float64(z - t) * Float64(1.0 / Float64(a - t))) * y)) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = Float64(Float64(Float64(y * Float64(a - z)) - Float64(x * t)) / Float64(a - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y); t_2 = (x + y) - (((z - t) * y) / (a - t)); tmp = 0.0; if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = ((y * (a - z)) - (x * t)) / (a - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -1.3664970889390727e-7], t$95$1, If[Less[t$95$2, 1.4754293444577233e-239], N[(N[(N[(y * N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(x * t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t\_2 < -1.3664970889390727 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 < 1.4754293444577233 \cdot 10^{-239}:\\
\;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024195
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:alt
(! :herbie-platform default (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -13664970889390727/100000000000000000000000) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 14754293444577233/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)))))
(- (+ x y) (/ (* (- z t) y) (- a t))))