
(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 11 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
(if (<= t -9.5e+45)
(fma (/ 1.0 (/ t y)) (- z a) x)
(if (<= t 4e-21)
(+ (+ y x) (/ (* y (- z t)) (- t a)))
(fma y (+ (/ (- z t) (- t a)) 1.0) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9.5e+45) {
tmp = fma((1.0 / (t / y)), (z - a), x);
} else if (t <= 4e-21) {
tmp = (y + x) + ((y * (z - t)) / (t - a));
} else {
tmp = fma(y, (((z - t) / (t - a)) + 1.0), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -9.5e+45) tmp = fma(Float64(1.0 / Float64(t / y)), Float64(z - a), x); elseif (t <= 4e-21) tmp = Float64(Float64(y + x) + Float64(Float64(y * Float64(z - t)) / Float64(t - a))); else tmp = fma(y, Float64(Float64(Float64(z - t) / Float64(t - a)) + 1.0), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -9.5e+45], N[(N[(1.0 / N[(t / y), $MachinePrecision]), $MachinePrecision] * N[(z - a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 4e-21], N[(N[(y + x), $MachinePrecision] + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(N[(z - t), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{+45}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\frac{t}{y}}, z - a, x\right)\\
\mathbf{elif}\;t \leq 4 \cdot 10^{-21}:\\
\;\;\;\;\left(y + x\right) + \frac{y \cdot \left(z - t\right)}{t - a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{t - a} + 1, x\right)\\
\end{array}
\end{array}
if t < -9.4999999999999998e45Initial program 52.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--.f6491.5
Simplified91.5%
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f6491.5
Applied egg-rr91.5%
if -9.4999999999999998e45 < t < 3.99999999999999963e-21Initial program 97.3%
if 3.99999999999999963e-21 < t Initial program 64.2%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
sub-negN/A
*-rgt-identityN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
distribute-lft-inN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6488.5
Simplified88.5%
Final simplification94.3%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.8e+46)
(fma (/ y t) (- z a) x)
(if (<= t 2.9e-24)
(+ (+ y x) (/ (* y (- z t)) (- t a)))
(fma y (+ (/ (- z t) (- t a)) 1.0) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.8e+46) {
tmp = fma((y / t), (z - a), x);
} else if (t <= 2.9e-24) {
tmp = (y + x) + ((y * (z - t)) / (t - a));
} else {
tmp = fma(y, (((z - t) / (t - a)) + 1.0), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.8e+46) tmp = fma(Float64(y / t), Float64(z - a), x); elseif (t <= 2.9e-24) tmp = Float64(Float64(y + x) + Float64(Float64(y * Float64(z - t)) / Float64(t - a))); else tmp = fma(y, Float64(Float64(Float64(z - t) / Float64(t - a)) + 1.0), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.8e+46], N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 2.9e-24], N[(N[(y + x), $MachinePrecision] + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(N[(z - t), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{+46}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z - a, x\right)\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{-24}:\\
\;\;\;\;\left(y + x\right) + \frac{y \cdot \left(z - t\right)}{t - a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{t - a} + 1, x\right)\\
\end{array}
\end{array}
if t < -1.7999999999999999e46Initial program 52.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--.f6491.5
Simplified91.5%
if -1.7999999999999999e46 < t < 2.8999999999999999e-24Initial program 97.3%
if 2.8999999999999999e-24 < t Initial program 64.2%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
sub-negN/A
*-rgt-identityN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
distribute-lft-inN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6488.5
Simplified88.5%
Final simplification94.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ y t) (- z a) x)))
(if (<= t -1.2e+46)
t_1
(if (<= t 1.26e+141) (fma y (+ (/ z (- t a)) 1.0) x) 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 <= -1.2e+46) {
tmp = t_1;
} else if (t <= 1.26e+141) {
tmp = fma(y, ((z / (t - a)) + 1.0), x);
} 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 <= -1.2e+46) tmp = t_1; elseif (t <= 1.26e+141) tmp = fma(y, Float64(Float64(z / Float64(t - a)) + 1.0), x); 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, -1.2e+46], t$95$1, If[LessEqual[t, 1.26e+141], N[(y * N[(N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] + x), $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 -1.2 \cdot 10^{+46}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.26 \cdot 10^{+141}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{t - a} + 1, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.20000000000000004e46 or 1.25999999999999994e141 < t Initial program 55.5%
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--.f6489.3
Simplified89.3%
if -1.20000000000000004e46 < t < 1.25999999999999994e141Initial program 94.8%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
sub-negN/A
*-rgt-identityN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
distribute-lft-inN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6494.3
Simplified94.3%
Taylor expanded in z around inf
/-lowering-/.f64N/A
--lowering--.f6492.1
Simplified92.1%
Final simplification91.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (- 1.0 (/ z a)) x))) (if (<= a -4.6e-73) t_1 (if (<= a 5.6e+20) (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 <= -4.6e-73) {
tmp = t_1;
} else if (a <= 5.6e+20) {
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 <= -4.6e-73) tmp = t_1; elseif (a <= 5.6e+20) 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, -4.6e-73], t$95$1, If[LessEqual[a, 5.6e+20], 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 -4.6 \cdot 10^{-73}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 5.6 \cdot 10^{+20}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -4.59999999999999977e-73 or 5.6e20 < a Initial program 84.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-/.f6487.4
Simplified87.4%
if -4.59999999999999977e-73 < a < 5.6e20Initial program 77.8%
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--.f6485.3
Simplified85.3%
Taylor expanded in z around inf
Simplified85.3%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.25e+110) (fma (/ y t) (- z a) x) (fma y (+ (/ (- z t) (- t a)) 1.0) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.25e+110) {
tmp = fma((y / t), (z - a), x);
} else {
tmp = fma(y, (((z - t) / (t - a)) + 1.0), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.25e+110) tmp = fma(Float64(y / t), Float64(z - a), x); else tmp = fma(y, Float64(Float64(Float64(z - t) / Float64(t - a)) + 1.0), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.25e+110], N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision] + x), $MachinePrecision], N[(y * N[(N[(N[(z - t), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.25 \cdot 10^{+110}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z - a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{t - a} + 1, x\right)\\
\end{array}
\end{array}
if t < -2.2500000000000001e110Initial program 42.2%
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.8
Simplified88.8%
if -2.2500000000000001e110 < t Initial program 88.5%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
sub-negN/A
*-rgt-identityN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
distribute-lft-inN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6493.2
Simplified93.2%
Final simplification92.5%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.3e-72) (+ y x) (if (<= a 32000000000.0) (fma (/ y t) z x) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.3e-72) {
tmp = y + x;
} else if (a <= 32000000000.0) {
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.3e-72) tmp = Float64(y + x); elseif (a <= 32000000000.0) 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.3e-72], N[(y + x), $MachinePrecision], If[LessEqual[a, 32000000000.0], N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.3 \cdot 10^{-72}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;a \leq 32000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -1.29999999999999998e-72 or 3.2e10 < a Initial program 84.0%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f6476.1
Simplified76.1%
if -1.29999999999999998e-72 < a < 3.2e10Initial program 78.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--.f6485.8
Simplified85.8%
Taylor expanded in z around inf
Simplified85.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* y z) t))) (if (<= z -3.2e+223) t_1 (if (<= z 4.8e+266) (+ y x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * z) / t;
double tmp;
if (z <= -3.2e+223) {
tmp = t_1;
} else if (z <= 4.8e+266) {
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) :: tmp
t_1 = (y * z) / t
if (z <= (-3.2d+223)) then
tmp = t_1
else if (z <= 4.8d+266) 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 tmp;
if (z <= -3.2e+223) {
tmp = t_1;
} else if (z <= 4.8e+266) {
tmp = y + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * z) / t tmp = 0 if z <= -3.2e+223: tmp = t_1 elif z <= 4.8e+266: tmp = y + x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * z) / t) tmp = 0.0 if (z <= -3.2e+223) tmp = t_1; elseif (z <= 4.8e+266) 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; tmp = 0.0; if (z <= -3.2e+223) tmp = t_1; elseif (z <= 4.8e+266) 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]}, If[LessEqual[z, -3.2e+223], t$95$1, If[LessEqual[z, 4.8e+266], N[(y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot z}{t}\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+223}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+266}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.2000000000000001e223 or 4.80000000000000003e266 < z Initial 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--.f6466.0
Simplified66.0%
Taylor expanded in z around inf
/-lowering-/.f64N/A
*-lowering-*.f6458.8
Simplified58.8%
if -3.2000000000000001e223 < z < 4.80000000000000003e266Initial program 81.3%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f6469.6
Simplified69.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -5.2e-104) (+ y x) (if (<= a 8e-202) x (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5.2e-104) {
tmp = y + x;
} else if (a <= 8e-202) {
tmp = x;
} else {
tmp = y + 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 (a <= (-5.2d-104)) then
tmp = y + x
else if (a <= 8d-202) then
tmp = x
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5.2e-104) {
tmp = y + x;
} else if (a <= 8e-202) {
tmp = x;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -5.2e-104: tmp = y + x elif a <= 8e-202: tmp = x else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -5.2e-104) tmp = Float64(y + x); elseif (a <= 8e-202) tmp = x; else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -5.2e-104) tmp = y + x; elseif (a <= 8e-202) tmp = x; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5.2e-104], N[(y + x), $MachinePrecision], If[LessEqual[a, 8e-202], x, N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.2 \cdot 10^{-104}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;a \leq 8 \cdot 10^{-202}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -5.20000000000000005e-104 or 8.0000000000000003e-202 < a Initial program 82.1%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f6470.3
Simplified70.3%
if -5.20000000000000005e-104 < a < 8.0000000000000003e-202Initial program 79.3%
Taylor expanded in x around inf
Simplified61.0%
(FPCore (x y z t a) :precision binary64 (if (<= y -2.45e+194) y (if (<= y 5.5e+147) x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.45e+194) {
tmp = y;
} else if (y <= 5.5e+147) {
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 <= (-2.45d+194)) then
tmp = y
else if (y <= 5.5d+147) 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 <= -2.45e+194) {
tmp = y;
} else if (y <= 5.5e+147) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -2.45e+194: tmp = y elif y <= 5.5e+147: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -2.45e+194) tmp = y; elseif (y <= 5.5e+147) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -2.45e+194) tmp = y; elseif (y <= 5.5e+147) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -2.45e+194], y, If[LessEqual[y, 5.5e+147], x, y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.45 \cdot 10^{+194}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+147}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -2.45000000000000013e194 or 5.4999999999999997e147 < y Initial program 59.8%
Taylor expanded in a around inf
+-commutativeN/A
+-lowering-+.f6447.5
Simplified47.5%
Taylor expanded in y around inf
Simplified43.9%
if -2.45000000000000013e194 < y < 5.4999999999999997e147Initial program 86.2%
Taylor expanded in x around inf
Simplified61.2%
(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 81.3%
Taylor expanded in x around inf
Simplified51.1%
(FPCore (x y z t a) :precision binary64 0.0)
double code(double x, double y, double z, double t, double a) {
return 0.0;
}
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 = 0.0d0
end function
public static double code(double x, double y, double z, double t, double a) {
return 0.0;
}
def code(x, y, z, t, a): return 0.0
function code(x, y, z, t, a) return 0.0 end
function tmp = code(x, y, z, t, a) tmp = 0.0; end
code[x_, y_, z_, t_, a_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 81.3%
sub-negN/A
+-commutativeN/A
div-invN/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
+-lowering-+.f6481.2
Applied egg-rr81.2%
Taylor expanded in y around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
mul-1-negN/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
--lowering--.f64N/A
--lowering--.f6442.0
Simplified42.0%
Taylor expanded in t around inf
distribute-rgt1-inN/A
metadata-evalN/A
mul0-lft2.7
Simplified2.7%
(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 2024198
(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))))