
(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 (- x (/ y (/ (- a z) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x - (y / ((a - z) / (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 / ((a - z) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (y / ((a - z) / (z - t)));
}
def code(x, y, z, t, a): return x - (y / ((a - z) / (z - t)))
function code(x, y, z, t, a) return Float64(x - Float64(y / Float64(Float64(a - z) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x - (y / ((a - z) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x - N[(y / N[(N[(a - z), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y}{\frac{a - z}{z - t}}
\end{array}
Initial program 85.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6498.8
Applied rewrites98.8%
Final simplification98.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z t) z) y x)))
(if (<= z -2.05e+70)
t_1
(if (<= z -2.15e-54)
(fma (/ z (- z a)) y x)
(if (<= z 1.05e-39) (- x (/ (* (- z t) y) a)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - t) / z), y, x);
double tmp;
if (z <= -2.05e+70) {
tmp = t_1;
} else if (z <= -2.15e-54) {
tmp = fma((z / (z - a)), y, x);
} else if (z <= 1.05e-39) {
tmp = x - (((z - t) * y) / a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - t) / z), y, x) tmp = 0.0 if (z <= -2.05e+70) tmp = t_1; elseif (z <= -2.15e-54) tmp = fma(Float64(z / Float64(z - a)), y, x); elseif (z <= 1.05e-39) tmp = Float64(x - Float64(Float64(Float64(z - t) * y) / a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[z, -2.05e+70], t$95$1, If[LessEqual[z, -2.15e-54], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[z, 1.05e-39], N[(x - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - t}{z}, y, x\right)\\
\mathbf{if}\;z \leq -2.05 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.15 \cdot 10^{-54}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-39}:\\
\;\;\;\;x - \frac{\left(z - t\right) \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.0500000000000001e70 or 1.04999999999999997e-39 < z Initial program 72.0%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6491.3
Applied rewrites91.3%
if -2.0500000000000001e70 < z < -2.15e-54Initial program 89.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6491.7
Applied rewrites91.7%
if -2.15e-54 < z < 1.04999999999999997e-39Initial program 97.8%
Taylor expanded in a around inf
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6484.4
Applied rewrites84.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.55e+106)
(fma (/ (- z t) z) y x)
(if (<= z 3e+74)
(- x (/ (* (- t z) y) (- z a)))
(+ (/ y (- 1.0 (/ a z))) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.55e+106) {
tmp = fma(((z - t) / z), y, x);
} else if (z <= 3e+74) {
tmp = x - (((t - z) * y) / (z - a));
} else {
tmp = (y / (1.0 - (a / z))) + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.55e+106) tmp = fma(Float64(Float64(z - t) / z), y, x); elseif (z <= 3e+74) tmp = Float64(x - Float64(Float64(Float64(t - z) * y) / Float64(z - a))); else tmp = Float64(Float64(y / Float64(1.0 - Float64(a / z))) + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.55e+106], N[(N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[z, 3e+74], N[(x - N[(N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(1.0 - N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+106}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{z}, y, x\right)\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+74}:\\
\;\;\;\;x - \frac{\left(t - z\right) \cdot y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{1 - \frac{a}{z}} + x\\
\end{array}
\end{array}
if z < -1.55e106Initial program 55.6%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6497.0
Applied rewrites97.0%
if -1.55e106 < z < 3e74Initial program 95.6%
if 3e74 < z Initial program 72.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6495.0
Applied rewrites95.0%
Taylor expanded in a around inf
Applied rewrites95.3%
Final simplification95.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ z (- z a)) y x)))
(if (<= z -2.05e+70)
(fma (/ (- z t) z) y x)
(if (<= z -4.4e-130) t_1 (if (<= z 1.75e+18) (fma (/ y a) t x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z / (z - a)), y, x);
double tmp;
if (z <= -2.05e+70) {
tmp = fma(((z - t) / z), y, x);
} else if (z <= -4.4e-130) {
tmp = t_1;
} else if (z <= 1.75e+18) {
tmp = fma((y / a), t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z / Float64(z - a)), y, x) tmp = 0.0 if (z <= -2.05e+70) tmp = fma(Float64(Float64(z - t) / z), y, x); elseif (z <= -4.4e-130) tmp = t_1; elseif (z <= 1.75e+18) tmp = fma(Float64(y / a), t, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[z, -2.05e+70], N[(N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[z, -4.4e-130], t$95$1, If[LessEqual[z, 1.75e+18], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\mathbf{if}\;z \leq -2.05 \cdot 10^{+70}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{z}, y, x\right)\\
\mathbf{elif}\;z \leq -4.4 \cdot 10^{-130}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.0500000000000001e70Initial program 66.1%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6493.8
Applied rewrites93.8%
if -2.0500000000000001e70 < z < -4.3999999999999997e-130 or 1.75e18 < z Initial program 83.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6490.5
Applied rewrites90.5%
if -4.3999999999999997e-130 < z < 1.75e18Initial program 95.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6482.9
Applied rewrites82.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.55e+106) (fma (/ (- z t) z) y x) (if (<= z 3e+74) (- x (/ (* (- t z) y) (- z a))) (fma (/ z (- z a)) y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.55e+106) {
tmp = fma(((z - t) / z), y, x);
} else if (z <= 3e+74) {
tmp = x - (((t - z) * y) / (z - a));
} else {
tmp = fma((z / (z - a)), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.55e+106) tmp = fma(Float64(Float64(z - t) / z), y, x); elseif (z <= 3e+74) tmp = Float64(x - Float64(Float64(Float64(t - z) * y) / Float64(z - a))); else tmp = fma(Float64(z / Float64(z - a)), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.55e+106], N[(N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[z, 3e+74], N[(x - N[(N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+106}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{z}, y, x\right)\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+74}:\\
\;\;\;\;x - \frac{\left(t - z\right) \cdot y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\end{array}
\end{array}
if z < -1.55e106Initial program 55.6%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6497.0
Applied rewrites97.0%
if -1.55e106 < z < 3e74Initial program 95.6%
if 3e74 < z Initial program 72.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6495.3
Applied rewrites95.3%
Final simplification95.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -0.0045) (fma (/ (- z t) z) y x) (if (<= z 1.08e-13) (+ (/ (* (- t) y) (- z a)) x) (fma (/ z (- z a)) y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.0045) {
tmp = fma(((z - t) / z), y, x);
} else if (z <= 1.08e-13) {
tmp = ((-t * y) / (z - a)) + x;
} else {
tmp = fma((z / (z - a)), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -0.0045) tmp = fma(Float64(Float64(z - t) / z), y, x); elseif (z <= 1.08e-13) tmp = Float64(Float64(Float64(Float64(-t) * y) / Float64(z - a)) + x); else tmp = fma(Float64(z / Float64(z - a)), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -0.0045], N[(N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[z, 1.08e-13], N[(N[(N[((-t) * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0045:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{z}, y, x\right)\\
\mathbf{elif}\;z \leq 1.08 \cdot 10^{-13}:\\
\;\;\;\;\frac{\left(-t\right) \cdot y}{z - a} + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\end{array}
\end{array}
if z < -0.00449999999999999966Initial program 70.0%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6488.0
Applied rewrites88.0%
if -0.00449999999999999966 < z < 1.0799999999999999e-13Initial program 97.4%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6488.8
Applied rewrites88.8%
if 1.0799999999999999e-13 < z Initial program 74.4%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6491.9
Applied rewrites91.9%
Final simplification89.5%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ z (- z a)) y x))) (if (<= z -4.4e-130) t_1 (if (<= z 1.75e+18) (fma (/ y a) t x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z / (z - a)), y, x);
double tmp;
if (z <= -4.4e-130) {
tmp = t_1;
} else if (z <= 1.75e+18) {
tmp = fma((y / a), t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z / Float64(z - a)), y, x) tmp = 0.0 if (z <= -4.4e-130) tmp = t_1; elseif (z <= 1.75e+18) tmp = fma(Float64(y / a), t, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[z, -4.4e-130], t$95$1, If[LessEqual[z, 1.75e+18], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\mathbf{if}\;z \leq -4.4 \cdot 10^{-130}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.3999999999999997e-130 or 1.75e18 < z Initial program 78.3%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6488.1
Applied rewrites88.1%
if -4.3999999999999997e-130 < z < 1.75e18Initial program 95.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6482.9
Applied rewrites82.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -6e-31) (+ y x) (if (<= z 7e+31) (fma (/ y a) t x) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6e-31) {
tmp = y + x;
} else if (z <= 7e+31) {
tmp = fma((y / a), t, x);
} else {
tmp = y + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6e-31) tmp = Float64(y + x); elseif (z <= 7e+31) tmp = fma(Float64(y / a), t, x); else tmp = Float64(y + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6e-31], N[(y + x), $MachinePrecision], If[LessEqual[z, 7e+31], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{-31}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+31}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -5.99999999999999962e-31 or 7e31 < z Initial program 73.3%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6485.7
Applied rewrites85.7%
if -5.99999999999999962e-31 < z < 7e31Initial program 96.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6481.5
Applied rewrites81.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.8e-189) (+ y x) (if (<= z 1.48e-269) (* (/ t a) y) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.8e-189) {
tmp = y + x;
} else if (z <= 1.48e-269) {
tmp = (t / a) * y;
} 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 <= (-3.8d-189)) then
tmp = y + x
else if (z <= 1.48d-269) then
tmp = (t / a) * y
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 <= -3.8e-189) {
tmp = y + x;
} else if (z <= 1.48e-269) {
tmp = (t / a) * y;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.8e-189: tmp = y + x elif z <= 1.48e-269: tmp = (t / a) * y else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.8e-189) tmp = Float64(y + x); elseif (z <= 1.48e-269) tmp = Float64(Float64(t / a) * y); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.8e-189) tmp = y + x; elseif (z <= 1.48e-269) tmp = (t / a) * y; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.8e-189], N[(y + x), $MachinePrecision], If[LessEqual[z, 1.48e-269], N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-189}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq 1.48 \cdot 10^{-269}:\\
\;\;\;\;\frac{t}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -3.80000000000000022e-189 or 1.48e-269 < z Initial program 83.2%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6471.5
Applied rewrites71.5%
if -3.80000000000000022e-189 < z < 1.48e-269Initial program 96.3%
Taylor expanded in y around inf
distribute-lft-out--N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6464.7
Applied rewrites64.7%
Taylor expanded in z around 0
Applied rewrites61.3%
Applied rewrites61.2%
Applied rewrites61.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.8e-189) (+ y x) (if (<= z 1.48e-269) (* (/ y a) t) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.8e-189) {
tmp = y + x;
} else if (z <= 1.48e-269) {
tmp = (y / a) * t;
} 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 <= (-3.8d-189)) then
tmp = y + x
else if (z <= 1.48d-269) then
tmp = (y / a) * t
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 <= -3.8e-189) {
tmp = y + x;
} else if (z <= 1.48e-269) {
tmp = (y / a) * t;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.8e-189: tmp = y + x elif z <= 1.48e-269: tmp = (y / a) * t else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.8e-189) tmp = Float64(y + x); elseif (z <= 1.48e-269) tmp = Float64(Float64(y / a) * t); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.8e-189) tmp = y + x; elseif (z <= 1.48e-269) tmp = (y / a) * t; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.8e-189], N[(y + x), $MachinePrecision], If[LessEqual[z, 1.48e-269], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-189}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq 1.48 \cdot 10^{-269}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -3.80000000000000022e-189 or 1.48e-269 < z Initial program 83.2%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6471.5
Applied rewrites71.5%
if -3.80000000000000022e-189 < z < 1.48e-269Initial program 96.3%
Taylor expanded in y around inf
distribute-lft-out--N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6464.7
Applied rewrites64.7%
Taylor expanded in z around 0
Applied rewrites61.3%
Final simplification69.9%
(FPCore (x y z t a) :precision binary64 (+ y x))
double code(double x, double y, double z, double t, double a) {
return y + 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 = y + x
end function
public static double code(double x, double y, double z, double t, double a) {
return y + x;
}
def code(x, y, z, t, a): return y + x
function code(x, y, z, t, a) return Float64(y + x) end
function tmp = code(x, y, z, t, a) tmp = y + x; end
code[x_, y_, z_, t_, a_] := N[(y + x), $MachinePrecision]
\begin{array}{l}
\\
y + x
\end{array}
Initial program 85.3%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6463.7
Applied rewrites63.7%
(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 2024270
(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))))