
(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 10 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 (* y (+ (/ x y) (+ (/ (- z t) (- t a)) 1.0)))))
(if (<= y -128000000.0)
t_1
(if (<= y 3e-137) (+ (+ y x) (/ (* y (- z t)) (- t a))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((x / y) + (((z - t) / (t - a)) + 1.0));
double tmp;
if (y <= -128000000.0) {
tmp = t_1;
} else if (y <= 3e-137) {
tmp = (y + x) + ((y * (z - t)) / (t - a));
} 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) :: tmp
t_1 = y * ((x / y) + (((z - t) / (t - a)) + 1.0d0))
if (y <= (-128000000.0d0)) then
tmp = t_1
else if (y <= 3d-137) then
tmp = (y + x) + ((y * (z - t)) / (t - a))
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 / y) + (((z - t) / (t - a)) + 1.0));
double tmp;
if (y <= -128000000.0) {
tmp = t_1;
} else if (y <= 3e-137) {
tmp = (y + x) + ((y * (z - t)) / (t - a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * ((x / y) + (((z - t) / (t - a)) + 1.0)) tmp = 0 if y <= -128000000.0: tmp = t_1 elif y <= 3e-137: tmp = (y + x) + ((y * (z - t)) / (t - a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(x / y) + Float64(Float64(Float64(z - t) / Float64(t - a)) + 1.0))) tmp = 0.0 if (y <= -128000000.0) tmp = t_1; elseif (y <= 3e-137) tmp = Float64(Float64(y + x) + Float64(Float64(y * Float64(z - t)) / Float64(t - a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * ((x / y) + (((z - t) / (t - a)) + 1.0)); tmp = 0.0; if (y <= -128000000.0) tmp = t_1; elseif (y <= 3e-137) tmp = (y + x) + ((y * (z - t)) / (t - a)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(x / y), $MachinePrecision] + N[(N[(N[(z - t), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -128000000.0], t$95$1, If[LessEqual[y, 3e-137], N[(N[(y + x), $MachinePrecision] + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(\frac{x}{y} + \left(\frac{z - t}{t - a} + 1\right)\right)\\
\mathbf{if}\;y \leq -128000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-137}:\\
\;\;\;\;\left(y + x\right) + \frac{y \cdot \left(z - t\right)}{t - a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.28e8 or 2.9999999999999998e-137 < y Initial program 70.5%
Taylor expanded in y around -inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sub-negN/A
mul-1-negN/A
distribute-neg-outN/A
remove-double-negN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6490.7
Simplified90.7%
if -1.28e8 < y < 2.9999999999999998e-137Initial program 94.8%
Final simplification92.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ y t) (- z a) x)))
(if (<= t -4.3e+129)
t_1
(if (<= t 1.55e-6) (+ (+ y x) (/ (* y (- z t)) (- t a))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / t), (z - a), x);
double tmp;
if (t <= -4.3e+129) {
tmp = t_1;
} else if (t <= 1.55e-6) {
tmp = (y + x) + ((y * (z - t)) / (t - a));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / t), Float64(z - a), x) tmp = 0.0 if (t <= -4.3e+129) tmp = t_1; elseif (t <= 1.55e-6) tmp = Float64(Float64(y + x) + Float64(Float64(y * Float64(z - t)) / Float64(t - a))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -4.3e+129], t$95$1, If[LessEqual[t, 1.55e-6], N[(N[(y + x), $MachinePrecision] + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{t}, z - a, x\right)\\
\mathbf{if}\;t \leq -4.3 \cdot 10^{+129}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.55 \cdot 10^{-6}:\\
\;\;\;\;\left(y + x\right) + \frac{y \cdot \left(z - t\right)}{t - a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.30000000000000021e129 or 1.55e-6 < t Initial program 55.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--.f6487.2
Simplified87.2%
if -4.30000000000000021e129 < t < 1.55e-6Initial program 93.7%
Final simplification91.2%
(FPCore (x y z t a)
:precision binary64
(if (<= a -3.05e+88)
(+ y x)
(if (<= a -1.9e-91)
(- x (* z (/ y a)))
(if (<= a 3.4e+38) (fma (/ y t) z x) (+ y x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.05e+88) {
tmp = y + x;
} else if (a <= -1.9e-91) {
tmp = x - (z * (y / a));
} else if (a <= 3.4e+38) {
tmp = fma((y / t), z, x);
} else {
tmp = y + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.05e+88) tmp = Float64(y + x); elseif (a <= -1.9e-91) tmp = Float64(x - Float64(z * Float64(y / a))); elseif (a <= 3.4e+38) 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, -3.05e+88], N[(y + x), $MachinePrecision], If[LessEqual[a, -1.9e-91], N[(x - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.4e+38], N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision], N[(y + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.05 \cdot 10^{+88}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;a \leq -1.9 \cdot 10^{-91}:\\
\;\;\;\;x - z \cdot \frac{y}{a}\\
\mathbf{elif}\;a \leq 3.4 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -3.0499999999999999e88 or 3.39999999999999996e38 < a Initial program 85.5%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f6490.4
Simplified90.4%
if -3.0499999999999999e88 < a < -1.89999999999999989e-91Initial program 75.9%
Taylor expanded in t around 0
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6476.6
Simplified76.6%
Taylor expanded in x around inf
Simplified70.7%
if -1.89999999999999989e-91 < a < 3.39999999999999996e38Initial program 75.1%
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.1
Simplified83.1%
Taylor expanded in z around inf
Simplified80.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (- 1.0 (/ z a)) x))) (if (<= a -1.9e-90) t_1 (if (<= a 1.75e-13) (fma (/ y t) (- z a) 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.9e-90) {
tmp = t_1;
} else if (a <= 1.75e-13) {
tmp = fma((y / t), (z - a), 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.9e-90) tmp = t_1; elseif (a <= 1.75e-13) tmp = fma(Float64(y / t), 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[(1.0 - N[(z / a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.9e-90], t$95$1, If[LessEqual[a, 1.75e-13], N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + 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.9 \cdot 10^{-90}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.75 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z - a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.9e-90 or 1.7500000000000001e-13 < a Initial program 82.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-/.f6488.2
Simplified88.2%
if -1.9e-90 < a < 1.7500000000000001e-13Initial program 74.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--.f6486.1
Simplified86.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (- 1.0 (/ z a)) x))) (if (<= a -3.7e-104) t_1 (if (<= a 6e-12) (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 <= -3.7e-104) {
tmp = t_1;
} else if (a <= 6e-12) {
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 <= -3.7e-104) tmp = t_1; elseif (a <= 6e-12) 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, -3.7e-104], t$95$1, If[LessEqual[a, 6e-12], 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 -3.7 \cdot 10^{-104}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 6 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.6999999999999999e-104 or 6.0000000000000003e-12 < a Initial program 81.7%
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-/.f6487.3
Simplified87.3%
if -3.6999999999999999e-104 < a < 6.0000000000000003e-12Initial program 74.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--.f6486.5
Simplified86.5%
Taylor expanded in z around inf
Simplified84.8%
(FPCore (x y z t a) :precision binary64 (if (<= a -2e-38) (+ y x) (if (<= a 3.4e+38) (fma (/ y t) z x) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2e-38) {
tmp = y + x;
} else if (a <= 3.4e+38) {
tmp = fma((y / t), z, x);
} else {
tmp = y + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2e-38) tmp = Float64(y + x); elseif (a <= 3.4e+38) 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, -2e-38], N[(y + x), $MachinePrecision], If[LessEqual[a, 3.4e+38], N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{-38}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;a \leq 3.4 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -1.9999999999999999e-38 or 3.39999999999999996e38 < a Initial program 83.6%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f6479.7
Simplified79.7%
if -1.9999999999999999e-38 < a < 3.39999999999999996e38Initial program 74.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--.f6480.8
Simplified80.8%
Taylor expanded in z around inf
Simplified78.0%
(FPCore (x y z t a) :precision binary64 (if (<= a -7.2e-17) (+ y x) (if (<= a 3e+38) (fma y (/ z t) x) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -7.2e-17) {
tmp = y + x;
} else if (a <= 3e+38) {
tmp = fma(y, (z / t), x);
} else {
tmp = y + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -7.2e-17) tmp = Float64(y + x); elseif (a <= 3e+38) 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, -7.2e-17], N[(y + x), $MachinePrecision], If[LessEqual[a, 3e+38], N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.2 \cdot 10^{-17}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;a \leq 3 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -7.1999999999999999e-17 or 3.0000000000000001e38 < a Initial program 83.0%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f6479.6
Simplified79.6%
if -7.1999999999999999e-17 < a < 3.0000000000000001e38Initial program 75.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--.f6480.8
Simplified80.8%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6476.6
Simplified76.6%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.7e+201) x (if (<= t 5e+80) (+ y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.7e+201) {
tmp = x;
} else if (t <= 5e+80) {
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 <= (-1.7d+201)) then
tmp = x
else if (t <= 5d+80) 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 <= -1.7e+201) {
tmp = x;
} else if (t <= 5e+80) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.7e+201: tmp = x elif t <= 5e+80: tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.7e+201) tmp = x; elseif (t <= 5e+80) 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 <= -1.7e+201) tmp = x; elseif (t <= 5e+80) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.7e+201], x, If[LessEqual[t, 5e+80], N[(y + x), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.7 \cdot 10^{+201}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+80}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.7e201 or 4.99999999999999961e80 < t Initial program 53.9%
Taylor expanded in x around inf
Simplified76.2%
if -1.7e201 < t < 4.99999999999999961e80Initial program 88.1%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f6463.9
Simplified63.9%
(FPCore (x y z t a) :precision binary64 (if (<= x -3.5e-129) x (if (<= x 1.7e-108) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -3.5e-129) {
tmp = x;
} else if (x <= 1.7e-108) {
tmp = y;
} 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 (x <= (-3.5d-129)) then
tmp = x
else if (x <= 1.7d-108) then
tmp = y
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 (x <= -3.5e-129) {
tmp = x;
} else if (x <= 1.7e-108) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -3.5e-129: tmp = x elif x <= 1.7e-108: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -3.5e-129) tmp = x; elseif (x <= 1.7e-108) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -3.5e-129) tmp = x; elseif (x <= 1.7e-108) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -3.5e-129], x, If[LessEqual[x, 1.7e-108], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-129}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-108}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.4999999999999997e-129 or 1.70000000000000001e-108 < x Initial program 79.6%
Taylor expanded in x around inf
Simplified66.6%
if -3.4999999999999997e-129 < x < 1.70000000000000001e-108Initial program 77.8%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f6441.5
Simplified41.5%
Taylor expanded in y around inf
Simplified36.8%
(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 79.0%
Taylor expanded in x around inf
Simplified51.1%
(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 2024199
(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))))