
(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(Float64(y * 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[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{z - a}
\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)) (- 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(Float64(y * 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[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{z - a}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (/ (- z t) (- z a)) y x))
double code(double x, double y, double z, double t, double a) {
return fma(((z - t) / (z - a)), y, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(z - t) / Float64(z - a)), y, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z - t}{z - a}, y, x\right)
\end{array}
Initial program 85.8%
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6498.8
Applied egg-rr98.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma y (- 1.0 (/ t z)) x)) (t_2 (/ (* (- z t) y) (- z a))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -1e-7)
t_2
(if (<= t_2 4e+71)
(fma y (/ z (- z a)) x)
(if (<= t_2 2e+288) t_2 t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, (1.0 - (t / z)), x);
double t_2 = ((z - t) * y) / (z - a);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -1e-7) {
tmp = t_2;
} else if (t_2 <= 4e+71) {
tmp = fma(y, (z / (z - a)), x);
} else if (t_2 <= 2e+288) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(1.0 - Float64(t / z)), x) t_2 = Float64(Float64(Float64(z - t) * y) / Float64(z - a)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -1e-7) tmp = t_2; elseif (t_2 <= 4e+71) tmp = fma(y, Float64(z / Float64(z - a)), x); elseif (t_2 <= 2e+288) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -1e-7], t$95$2, If[LessEqual[t$95$2, 4e+71], N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 2e+288], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, 1 - \frac{t}{z}, x\right)\\
t_2 := \frac{\left(z - t\right) \cdot y}{z - a}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-7}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+71}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{z - a}, x\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+288}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -inf.0 or 2e288 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 41.9%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
div-subN/A
*-inversesN/A
--lowering--.f64N/A
/-lowering-/.f6482.4
Simplified82.4%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -9.9999999999999995e-8 or 4.0000000000000002e71 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 2e288Initial program 99.5%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
--lowering--.f6490.8
Simplified90.8%
if -9.9999999999999995e-8 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 4.0000000000000002e71Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6492.5
Simplified92.5%
Final simplification89.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.4e+34) (+ y x) (if (<= z -1.16e-291) x (if (<= z 1.5e-260) (/ (* t y) a) (+ y x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.4e+34) {
tmp = y + x;
} else if (z <= -1.16e-291) {
tmp = x;
} else if (z <= 1.5e-260) {
tmp = (t * y) / a;
} 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 (z <= (-2.4d+34)) then
tmp = y + x
else if (z <= (-1.16d-291)) then
tmp = x
else if (z <= 1.5d-260) then
tmp = (t * y) / a
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 (z <= -2.4e+34) {
tmp = y + x;
} else if (z <= -1.16e-291) {
tmp = x;
} else if (z <= 1.5e-260) {
tmp = (t * y) / a;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.4e+34: tmp = y + x elif z <= -1.16e-291: tmp = x elif z <= 1.5e-260: tmp = (t * y) / a else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.4e+34) tmp = Float64(y + x); elseif (z <= -1.16e-291) tmp = x; elseif (z <= 1.5e-260) tmp = Float64(Float64(t * y) / a); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.4e+34) tmp = y + x; elseif (z <= -1.16e-291) tmp = x; elseif (z <= 1.5e-260) tmp = (t * y) / a; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.4e+34], N[(y + x), $MachinePrecision], If[LessEqual[z, -1.16e-291], x, If[LessEqual[z, 1.5e-260], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision], N[(y + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+34}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq -1.16 \cdot 10^{-291}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-260}:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -2.39999999999999987e34 or 1.5e-260 < z Initial program 80.6%
Taylor expanded in z around inf
+-commutativeN/A
+-lowering-+.f6475.9
Simplified75.9%
if -2.39999999999999987e34 < z < -1.15999999999999997e-291Initial program 96.1%
Taylor expanded in x around inf
Simplified56.8%
if -1.15999999999999997e-291 < z < 1.5e-260Initial program 99.5%
Taylor expanded in z around 0
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6490.2
Simplified90.2%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f6479.6
Simplified79.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (- 1.0 (/ t z)) x))) (if (<= z -1.3e-16) t_1 (if (<= z 5e-105) (fma (/ (- t z) a) y x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, (1.0 - (t / z)), x);
double tmp;
if (z <= -1.3e-16) {
tmp = t_1;
} else if (z <= 5e-105) {
tmp = fma(((t - z) / a), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(1.0 - Float64(t / z)), x) tmp = 0.0 if (z <= -1.3e-16) tmp = t_1; elseif (z <= 5e-105) tmp = fma(Float64(Float64(t - z) / a), y, 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[(t / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -1.3e-16], t$95$1, If[LessEqual[z, 5e-105], N[(N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, 1 - \frac{t}{z}, x\right)\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-105}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.2999999999999999e-16 or 4.99999999999999963e-105 < z Initial program 79.1%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
div-subN/A
*-inversesN/A
--lowering--.f64N/A
/-lowering-/.f6485.6
Simplified85.6%
if -1.2999999999999999e-16 < z < 4.99999999999999963e-105Initial program 97.8%
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6497.9
Applied egg-rr97.9%
Taylor expanded in a around inf
associate-*r/N/A
/-lowering-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6483.6
Simplified83.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (/ z (- z a)) x))) (if (<= a -2.3e+19) t_1 (if (<= a 6.8e+89) (fma y (- 1.0 (/ t z)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, (z / (z - a)), x);
double tmp;
if (a <= -2.3e+19) {
tmp = t_1;
} else if (a <= 6.8e+89) {
tmp = fma(y, (1.0 - (t / z)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(z / Float64(z - a)), x) tmp = 0.0 if (a <= -2.3e+19) tmp = t_1; elseif (a <= 6.8e+89) tmp = fma(y, Float64(1.0 - Float64(t / z)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -2.3e+19], t$95$1, If[LessEqual[a, 6.8e+89], N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{z}{z - a}, x\right)\\
\mathbf{if}\;a \leq -2.3 \cdot 10^{+19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 6.8 \cdot 10^{+89}:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - \frac{t}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.3e19 or 6.8000000000000004e89 < a Initial program 84.7%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6486.3
Simplified86.3%
if -2.3e19 < a < 6.8000000000000004e89Initial program 86.7%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
div-subN/A
*-inversesN/A
--lowering--.f64N/A
/-lowering-/.f6483.5
Simplified83.5%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (- 1.0 (/ t z)) x))) (if (<= z -3.8e-103) t_1 (if (<= z 5.1e-105) (fma y (/ t a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, (1.0 - (t / z)), x);
double tmp;
if (z <= -3.8e-103) {
tmp = t_1;
} else if (z <= 5.1e-105) {
tmp = fma(y, (t / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(1.0 - Float64(t / z)), x) tmp = 0.0 if (z <= -3.8e-103) tmp = t_1; elseif (z <= 5.1e-105) tmp = fma(y, Float64(t / 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[(t / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -3.8e-103], t$95$1, If[LessEqual[z, 5.1e-105], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, 1 - \frac{t}{z}, x\right)\\
\mathbf{if}\;z \leq -3.8 \cdot 10^{-103}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.1 \cdot 10^{-105}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.8000000000000001e-103 or 5.10000000000000007e-105 < z Initial program 81.7%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
div-subN/A
*-inversesN/A
--lowering--.f64N/A
/-lowering-/.f6482.8
Simplified82.8%
if -3.8000000000000001e-103 < z < 5.10000000000000007e-105Initial program 97.1%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6489.6
Simplified89.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.4e+67) (+ y x) (if (<= z 6.2e+38) (fma y (/ t a) x) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.4e+67) {
tmp = y + x;
} else if (z <= 6.2e+38) {
tmp = fma(y, (t / a), x);
} else {
tmp = y + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.4e+67) tmp = Float64(y + x); elseif (z <= 6.2e+38) tmp = fma(y, Float64(t / a), x); else tmp = Float64(y + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.4e+67], N[(y + x), $MachinePrecision], If[LessEqual[z, 6.2e+38], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+67}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -2.40000000000000002e67 or 6.20000000000000035e38 < z Initial program 74.5%
Taylor expanded in z around inf
+-commutativeN/A
+-lowering-+.f6485.6
Simplified85.6%
if -2.40000000000000002e67 < z < 6.20000000000000035e38Initial program 97.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6475.1
Simplified75.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.15e+197) (fma y (- 1.0 (/ t z)) x) (fma (/ y (- z a)) (- z t) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.15e+197) {
tmp = fma(y, (1.0 - (t / z)), x);
} else {
tmp = fma((y / (z - a)), (z - t), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.15e+197) tmp = fma(y, Float64(1.0 - Float64(t / z)), x); else tmp = fma(Float64(y / Float64(z - a)), Float64(z - t), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.15e+197], N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+197}:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - \frac{t}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z - a}, z - t, x\right)\\
\end{array}
\end{array}
if z < -1.15e197Initial program 67.8%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
div-subN/A
*-inversesN/A
--lowering--.f64N/A
/-lowering-/.f6498.6
Simplified98.6%
if -1.15e197 < z Initial program 88.2%
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6497.3
Applied egg-rr97.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.5e+38) (+ y x) (if (<= z 4.9e-141) x (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.5e+38) {
tmp = y + x;
} else if (z <= 4.9e-141) {
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 (z <= (-2.5d+38)) then
tmp = y + x
else if (z <= 4.9d-141) 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 (z <= -2.5e+38) {
tmp = y + x;
} else if (z <= 4.9e-141) {
tmp = x;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.5e+38: tmp = y + x elif z <= 4.9e-141: tmp = x else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.5e+38) tmp = Float64(y + x); elseif (z <= 4.9e-141) tmp = x; else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.5e+38) tmp = y + x; elseif (z <= 4.9e-141) tmp = x; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.5e+38], N[(y + x), $MachinePrecision], If[LessEqual[z, 4.9e-141], x, N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+38}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{-141}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -2.49999999999999985e38 or 4.90000000000000006e-141 < z Initial program 78.5%
Taylor expanded in z around inf
+-commutativeN/A
+-lowering-+.f6480.1
Simplified80.1%
if -2.49999999999999985e38 < z < 4.90000000000000006e-141Initial program 97.1%
Taylor expanded in x around inf
Simplified51.3%
(FPCore (x y z t a) :precision binary64 (if (<= x -1.25e-162) x (if (<= x 2.6e-200) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.25e-162) {
tmp = x;
} else if (x <= 2.6e-200) {
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 <= (-1.25d-162)) then
tmp = x
else if (x <= 2.6d-200) 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 <= -1.25e-162) {
tmp = x;
} else if (x <= 2.6e-200) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.25e-162: tmp = x elif x <= 2.6e-200: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.25e-162) tmp = x; elseif (x <= 2.6e-200) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1.25e-162) tmp = x; elseif (x <= 2.6e-200) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.25e-162], x, If[LessEqual[x, 2.6e-200], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{-162}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-200}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.25000000000000004e-162 or 2.5999999999999999e-200 < x Initial program 85.7%
Taylor expanded in x around inf
Simplified64.3%
if -1.25000000000000004e-162 < x < 2.5999999999999999e-200Initial program 86.2%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
--lowering--.f6475.7
Simplified75.7%
Taylor expanded in z around inf
Simplified45.3%
(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 85.8%
Taylor expanded in x around inf
Simplified53.0%
(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 2024195
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, A"
:precision binary64
:alt
(! :herbie-platform default (+ x (/ y (/ (- z a) (- z t)))))
(+ x (/ (* y (- z t)) (- z a))))