
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / 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) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{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) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / 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) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (/ (- y z) (+ -1.0 (- z t))) a x))
double code(double x, double y, double z, double t, double a) {
return fma(((y - z) / (-1.0 + (z - t))), a, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(y - z) / Float64(-1.0 + Float64(z - t))), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(y - z), $MachinePrecision] / N[(-1.0 + N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y - z}{-1 + \left(z - t\right)}, a, x\right)
\end{array}
Initial program 97.6%
sub-neg97.6%
+-commutative97.6%
associate-/r/99.4%
distribute-lft-neg-in99.4%
fma-define99.4%
distribute-neg-frac299.4%
distribute-neg-in99.4%
sub-neg99.4%
distribute-neg-in99.4%
remove-double-neg99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* a (/ y (- (+ z -1.0) t)))))
(if (<= y -3.8e+137)
t_1
(if (<= y 7.8e+105)
(- x (* a (/ z (+ z -1.0))))
(if (<= y 3.8e+204) t_1 (- x (* a (/ y t))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a * (y / ((z + -1.0) - t));
double tmp;
if (y <= -3.8e+137) {
tmp = t_1;
} else if (y <= 7.8e+105) {
tmp = x - (a * (z / (z + -1.0)));
} else if (y <= 3.8e+204) {
tmp = t_1;
} else {
tmp = x - (a * (y / t));
}
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 = a * (y / ((z + (-1.0d0)) - t))
if (y <= (-3.8d+137)) then
tmp = t_1
else if (y <= 7.8d+105) then
tmp = x - (a * (z / (z + (-1.0d0))))
else if (y <= 3.8d+204) then
tmp = t_1
else
tmp = x - (a * (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a * (y / ((z + -1.0) - t));
double tmp;
if (y <= -3.8e+137) {
tmp = t_1;
} else if (y <= 7.8e+105) {
tmp = x - (a * (z / (z + -1.0)));
} else if (y <= 3.8e+204) {
tmp = t_1;
} else {
tmp = x - (a * (y / t));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a * (y / ((z + -1.0) - t)) tmp = 0 if y <= -3.8e+137: tmp = t_1 elif y <= 7.8e+105: tmp = x - (a * (z / (z + -1.0))) elif y <= 3.8e+204: tmp = t_1 else: tmp = x - (a * (y / t)) return tmp
function code(x, y, z, t, a) t_1 = Float64(a * Float64(y / Float64(Float64(z + -1.0) - t))) tmp = 0.0 if (y <= -3.8e+137) tmp = t_1; elseif (y <= 7.8e+105) tmp = Float64(x - Float64(a * Float64(z / Float64(z + -1.0)))); elseif (y <= 3.8e+204) tmp = t_1; else tmp = Float64(x - Float64(a * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a * (y / ((z + -1.0) - t)); tmp = 0.0; if (y <= -3.8e+137) tmp = t_1; elseif (y <= 7.8e+105) tmp = x - (a * (z / (z + -1.0))); elseif (y <= 3.8e+204) tmp = t_1; else tmp = x - (a * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[(y / N[(N[(z + -1.0), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.8e+137], t$95$1, If[LessEqual[y, 7.8e+105], N[(x - N[(a * N[(z / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.8e+204], t$95$1, N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \frac{y}{\left(z + -1\right) - t}\\
\mathbf{if}\;y \leq -3.8 \cdot 10^{+137}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{+105}:\\
\;\;\;\;x - a \cdot \frac{z}{z + -1}\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+204}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -3.79999999999999963e137 or 7.79999999999999957e105 < y < 3.7999999999999998e204Initial program 91.8%
sub-neg91.8%
+-commutative91.8%
associate-/r/99.8%
distribute-rgt-neg-in99.8%
associate-*l/73.8%
associate-/l*93.4%
fma-define93.4%
distribute-frac-neg93.4%
distribute-neg-frac293.4%
distribute-neg-in93.4%
sub-neg93.4%
distribute-neg-in93.4%
remove-double-neg93.4%
+-commutative93.4%
sub-neg93.4%
metadata-eval93.4%
Simplified93.4%
Taylor expanded in y around inf 55.5%
associate-/l*75.4%
associate--r+75.4%
sub-neg75.4%
metadata-eval75.4%
+-commutative75.4%
Simplified75.4%
if -3.79999999999999963e137 < y < 7.79999999999999957e105Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
associate-/r/99.3%
distribute-rgt-neg-in99.3%
associate-*l/87.9%
associate-/l*99.9%
fma-define99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
distribute-neg-in99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 76.3%
mul-1-neg76.3%
unsub-neg76.3%
associate-/l*86.7%
associate--r+86.7%
sub-neg86.7%
metadata-eval86.7%
+-commutative86.7%
Simplified86.7%
Taylor expanded in t around 0 78.7%
if 3.7999999999999998e204 < y Initial program 95.6%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 58.9%
Taylor expanded in t around inf 50.4%
associate-/l*66.8%
Simplified66.8%
Final simplification76.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.2e+38) (not (<= z 20000000.0))) (+ x (/ (- y z) (/ z a))) (+ x (/ (* y a) (- -1.0 t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.2e+38) || !(z <= 20000000.0)) {
tmp = x + ((y - z) / (z / a));
} else {
tmp = x + ((y * a) / (-1.0 - t));
}
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 <= (-5.2d+38)) .or. (.not. (z <= 20000000.0d0))) then
tmp = x + ((y - z) / (z / a))
else
tmp = x + ((y * a) / ((-1.0d0) - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.2e+38) || !(z <= 20000000.0)) {
tmp = x + ((y - z) / (z / a));
} else {
tmp = x + ((y * a) / (-1.0 - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5.2e+38) or not (z <= 20000000.0): tmp = x + ((y - z) / (z / a)) else: tmp = x + ((y * a) / (-1.0 - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.2e+38) || !(z <= 20000000.0)) tmp = Float64(x + Float64(Float64(y - z) / Float64(z / a))); else tmp = Float64(x + Float64(Float64(y * a) / Float64(-1.0 - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -5.2e+38) || ~((z <= 20000000.0))) tmp = x + ((y - z) / (z / a)); else tmp = x + ((y * a) / (-1.0 - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.2e+38], N[Not[LessEqual[z, 20000000.0]], $MachinePrecision]], N[(x + N[(N[(y - z), $MachinePrecision] / N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * a), $MachinePrecision] / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+38} \lor \neg \left(z \leq 20000000\right):\\
\;\;\;\;x + \frac{y - z}{\frac{z}{a}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot a}{-1 - t}\\
\end{array}
\end{array}
if z < -5.1999999999999998e38 or 2e7 < z Initial program 97.1%
Taylor expanded in z around inf 87.1%
associate-*r/87.1%
neg-mul-187.1%
Simplified87.1%
if -5.1999999999999998e38 < z < 2e7Initial program 97.9%
associate-/r/99.1%
Simplified99.1%
Taylor expanded in z around 0 86.5%
Final simplification86.7%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.6e+40)
(- x a)
(if (<= z 270000000000.0)
(+ x (/ (* y a) (- -1.0 t)))
(- x (* a (/ z (+ z -1.0)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.6e+40) {
tmp = x - a;
} else if (z <= 270000000000.0) {
tmp = x + ((y * a) / (-1.0 - t));
} else {
tmp = x - (a * (z / (z + -1.0)));
}
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 <= (-1.6d+40)) then
tmp = x - a
else if (z <= 270000000000.0d0) then
tmp = x + ((y * a) / ((-1.0d0) - t))
else
tmp = x - (a * (z / (z + (-1.0d0))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.6e+40) {
tmp = x - a;
} else if (z <= 270000000000.0) {
tmp = x + ((y * a) / (-1.0 - t));
} else {
tmp = x - (a * (z / (z + -1.0)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.6e+40: tmp = x - a elif z <= 270000000000.0: tmp = x + ((y * a) / (-1.0 - t)) else: tmp = x - (a * (z / (z + -1.0))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.6e+40) tmp = Float64(x - a); elseif (z <= 270000000000.0) tmp = Float64(x + Float64(Float64(y * a) / Float64(-1.0 - t))); else tmp = Float64(x - Float64(a * Float64(z / Float64(z + -1.0)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.6e+40) tmp = x - a; elseif (z <= 270000000000.0) tmp = x + ((y * a) / (-1.0 - t)); else tmp = x - (a * (z / (z + -1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.6e+40], N[(x - a), $MachinePrecision], If[LessEqual[z, 270000000000.0], N[(x + N[(N[(y * a), $MachinePrecision] / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(a * N[(z / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+40}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 270000000000:\\
\;\;\;\;x + \frac{y \cdot a}{-1 - t}\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{z}{z + -1}\\
\end{array}
\end{array}
if z < -1.5999999999999999e40Initial program 98.0%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 80.6%
if -1.5999999999999999e40 < z < 2.7e11Initial program 97.9%
associate-/r/99.1%
Simplified99.1%
Taylor expanded in z around 0 86.5%
if 2.7e11 < z Initial program 96.2%
sub-neg96.2%
+-commutative96.2%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-*l/69.4%
associate-/l*96.6%
fma-define96.6%
distribute-frac-neg96.6%
distribute-neg-frac296.6%
distribute-neg-in96.6%
sub-neg96.6%
distribute-neg-in96.6%
remove-double-neg96.6%
+-commutative96.6%
sub-neg96.6%
metadata-eval96.6%
Simplified96.6%
Taylor expanded in y around 0 62.0%
mul-1-neg62.0%
unsub-neg62.0%
associate-/l*83.4%
associate--r+83.4%
sub-neg83.4%
metadata-eval83.4%
+-commutative83.4%
Simplified83.4%
Taylor expanded in t around 0 76.2%
Final simplification83.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -5.5) (- x (* a (/ y t))) (if (<= t 0.0072) (- x (* y a)) (+ x (* a (/ (- z y) t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5.5) {
tmp = x - (a * (y / t));
} else if (t <= 0.0072) {
tmp = x - (y * a);
} else {
tmp = x + (a * ((z - y) / t));
}
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 <= (-5.5d0)) then
tmp = x - (a * (y / t))
else if (t <= 0.0072d0) then
tmp = x - (y * a)
else
tmp = x + (a * ((z - y) / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5.5) {
tmp = x - (a * (y / t));
} else if (t <= 0.0072) {
tmp = x - (y * a);
} else {
tmp = x + (a * ((z - y) / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -5.5: tmp = x - (a * (y / t)) elif t <= 0.0072: tmp = x - (y * a) else: tmp = x + (a * ((z - y) / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -5.5) tmp = Float64(x - Float64(a * Float64(y / t))); elseif (t <= 0.0072) tmp = Float64(x - Float64(y * a)); else tmp = Float64(x + Float64(a * Float64(Float64(z - y) / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -5.5) tmp = x - (a * (y / t)); elseif (t <= 0.0072) tmp = x - (y * a); else tmp = x + (a * ((z - y) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -5.5], N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 0.0072], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], N[(x + N[(a * N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5:\\
\;\;\;\;x - a \cdot \frac{y}{t}\\
\mathbf{elif}\;t \leq 0.0072:\\
\;\;\;\;x - y \cdot a\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \frac{z - y}{t}\\
\end{array}
\end{array}
if t < -5.5Initial program 97.1%
associate-/r/98.1%
Simplified98.1%
Taylor expanded in z around 0 68.6%
Taylor expanded in t around inf 68.6%
associate-/l*83.4%
Simplified83.4%
if -5.5 < t < 0.0071999999999999998Initial program 97.5%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 70.4%
Taylor expanded in t around 0 69.2%
if 0.0071999999999999998 < t Initial program 98.3%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around inf 85.6%
Final simplification77.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.2) (not (<= t 240000000.0))) (- x (* a (/ y t))) (- x (* y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.2) || !(t <= 240000000.0)) {
tmp = x - (a * (y / t));
} else {
tmp = x - (y * a);
}
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.2d0)) .or. (.not. (t <= 240000000.0d0))) then
tmp = x - (a * (y / t))
else
tmp = x - (y * a)
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.2) || !(t <= 240000000.0)) {
tmp = x - (a * (y / t));
} else {
tmp = x - (y * a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.2) or not (t <= 240000000.0): tmp = x - (a * (y / t)) else: tmp = x - (y * a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.2) || !(t <= 240000000.0)) tmp = Float64(x - Float64(a * Float64(y / t))); else tmp = Float64(x - Float64(y * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.2) || ~((t <= 240000000.0))) tmp = x - (a * (y / t)); else tmp = x - (y * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.2], N[Not[LessEqual[t, 240000000.0]], $MachinePrecision]], N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \lor \neg \left(t \leq 240000000\right):\\
\;\;\;\;x - a \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot a\\
\end{array}
\end{array}
if t < -1.19999999999999996 or 2.4e8 < t Initial program 97.6%
associate-/r/99.0%
Simplified99.0%
Taylor expanded in z around 0 69.3%
Taylor expanded in t around inf 69.3%
associate-/l*81.0%
Simplified81.0%
if -1.19999999999999996 < t < 2.4e8Initial program 97.5%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 69.5%
Taylor expanded in t around 0 68.4%
Final simplification74.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -108.0) (not (<= z 1.55))) (- x a) (- x (* y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -108.0) || !(z <= 1.55)) {
tmp = x - a;
} else {
tmp = x - (y * a);
}
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 <= (-108.0d0)) .or. (.not. (z <= 1.55d0))) then
tmp = x - a
else
tmp = x - (y * a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -108.0) || !(z <= 1.55)) {
tmp = x - a;
} else {
tmp = x - (y * a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -108.0) or not (z <= 1.55): tmp = x - a else: tmp = x - (y * a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -108.0) || !(z <= 1.55)) tmp = Float64(x - a); else tmp = Float64(x - Float64(y * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -108.0) || ~((z <= 1.55))) tmp = x - a; else tmp = x - (y * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -108.0], N[Not[LessEqual[z, 1.55]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -108 \lor \neg \left(z \leq 1.55\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot a\\
\end{array}
\end{array}
if z < -108 or 1.55000000000000004 < z Initial program 95.7%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 75.3%
if -108 < z < 1.55000000000000004Initial program 99.2%
associate-/r/99.1%
Simplified99.1%
Taylor expanded in z around 0 87.5%
Taylor expanded in t around 0 71.4%
Final simplification73.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.36e-35) (not (<= z 4e+43))) (- x a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.36e-35) || !(z <= 4e+43)) {
tmp = x - a;
} 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 ((z <= (-2.36d-35)) .or. (.not. (z <= 4d+43))) then
tmp = x - a
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 ((z <= -2.36e-35) || !(z <= 4e+43)) {
tmp = x - a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.36e-35) or not (z <= 4e+43): tmp = x - a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.36e-35) || !(z <= 4e+43)) tmp = Float64(x - a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.36e-35) || ~((z <= 4e+43))) tmp = x - a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.36e-35], N[Not[LessEqual[z, 4e+43]], $MachinePrecision]], N[(x - a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.36 \cdot 10^{-35} \lor \neg \left(z \leq 4 \cdot 10^{+43}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.35999999999999998e-35 or 4.00000000000000006e43 < z Initial program 95.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 73.8%
if -2.35999999999999998e-35 < z < 4.00000000000000006e43Initial program 99.2%
sub-neg99.2%
+-commutative99.2%
associate-/r/99.1%
distribute-rgt-neg-in99.1%
associate-*l/93.1%
associate-/l*99.2%
fma-define99.2%
distribute-frac-neg99.2%
distribute-neg-frac299.2%
distribute-neg-in99.2%
sub-neg99.2%
distribute-neg-in99.2%
remove-double-neg99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in a around 0 55.6%
Final simplification64.1%
(FPCore (x y z t a) :precision binary64 (+ x (* a (/ (- y z) (+ -1.0 (- z t))))))
double code(double x, double y, double z, double t, double a) {
return x + (a * ((y - z) / (-1.0 + (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 + (a * ((y - z) / ((-1.0d0) + (z - t))))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (a * ((y - z) / (-1.0 + (z - t))));
}
def code(x, y, z, t, a): return x + (a * ((y - z) / (-1.0 + (z - t))))
function code(x, y, z, t, a) return Float64(x + Float64(a * Float64(Float64(y - z) / Float64(-1.0 + Float64(z - t))))) end
function tmp = code(x, y, z, t, a) tmp = x + (a * ((y - z) / (-1.0 + (z - t)))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(a * N[(N[(y - z), $MachinePrecision] / N[(-1.0 + N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + a \cdot \frac{y - z}{-1 + \left(z - t\right)}
\end{array}
Initial program 97.6%
associate-/r/99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y z t a) :precision binary64 (if (<= a -5.8e+214) (- a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5.8e+214) {
tmp = -a;
} 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 (a <= (-5.8d+214)) then
tmp = -a
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 (a <= -5.8e+214) {
tmp = -a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -5.8e+214: tmp = -a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -5.8e+214) tmp = Float64(-a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -5.8e+214) tmp = -a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5.8e+214], (-a), x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.8 \cdot 10^{+214}:\\
\;\;\;\;-a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -5.7999999999999999e214Initial program 99.9%
associate-/r/95.1%
Simplified95.1%
Taylor expanded in z around inf 50.0%
Taylor expanded in x around 0 40.7%
neg-mul-140.7%
Simplified40.7%
if -5.7999999999999999e214 < a Initial program 97.3%
sub-neg97.3%
+-commutative97.3%
associate-/r/99.9%
distribute-rgt-neg-in99.9%
associate-*l/87.3%
associate-/l*97.8%
fma-define97.8%
distribute-frac-neg97.8%
distribute-neg-frac297.8%
distribute-neg-in97.8%
sub-neg97.8%
distribute-neg-in97.8%
remove-double-neg97.8%
+-commutative97.8%
sub-neg97.8%
metadata-eval97.8%
Simplified97.8%
Taylor expanded in a around 0 56.7%
(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 97.6%
sub-neg97.6%
+-commutative97.6%
associate-/r/99.4%
distribute-rgt-neg-in99.4%
associate-*l/83.4%
associate-/l*98.0%
fma-define98.0%
distribute-frac-neg98.0%
distribute-neg-frac298.0%
distribute-neg-in98.0%
sub-neg98.0%
distribute-neg-in98.0%
remove-double-neg98.0%
+-commutative98.0%
sub-neg98.0%
metadata-eval98.0%
Simplified98.0%
Taylor expanded in a around 0 52.7%
(FPCore (x y z t a) :precision binary64 (- x (* (/ (- y z) (+ (- t z) 1.0)) a)))
double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * 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) + 1.0d0)) * a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
def code(x, y, z, t, a): return x - (((y - z) / ((t - z) + 1.0)) * a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(Float64(y - z) / Float64(Float64(t - z) + 1.0)) * a)) end
function tmp = code(x, y, z, t, a) tmp = x - (((y - z) / ((t - z) + 1.0)) * a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(N[(y - z), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\left(t - z\right) + 1} \cdot a
\end{array}
herbie shell --seed 2024170
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (- x (* (/ (- y z) (+ (- t z) 1)) a)))
(- x (/ (- y z) (/ (+ (- t z) 1.0) a))))