
(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 (+ (* y (- (+ (/ t (- a t)) 1.0) (/ z (- a t)))) x))
double code(double x, double y, double z, double t, double a) {
return (y * (((t / (a - t)) + 1.0) - (z / (a - t)))) + 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 * (((t / (a - t)) + 1.0d0) - (z / (a - t)))) + x
end function
public static double code(double x, double y, double z, double t, double a) {
return (y * (((t / (a - t)) + 1.0) - (z / (a - t)))) + x;
}
def code(x, y, z, t, a): return (y * (((t / (a - t)) + 1.0) - (z / (a - t)))) + x
function code(x, y, z, t, a) return Float64(Float64(y * Float64(Float64(Float64(t / Float64(a - t)) + 1.0) - Float64(z / Float64(a - t)))) + x) end
function tmp = code(x, y, z, t, a) tmp = (y * (((t / (a - t)) + 1.0) - (z / (a - t)))) + x; end
code[x_, y_, z_, t_, a_] := N[(N[(y * N[(N[(N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(\left(\frac{t}{a - t} + 1\right) - \frac{z}{a - t}\right) + x
\end{array}
Initial program 77.9%
associate--l+81.3%
sub-neg81.3%
+-commutative81.3%
associate-/l*89.0%
distribute-neg-frac89.0%
associate-/r/90.9%
fma-def90.9%
sub-neg90.9%
+-commutative90.9%
distribute-neg-in90.9%
unsub-neg90.9%
remove-double-neg90.9%
Simplified90.9%
Taylor expanded in y around 0 94.3%
Final simplification94.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ y (- x (/ y (/ a z))))))
(if (<= a -210000.0)
t_1
(if (<= a 7.6e-190)
(+ x (/ y (/ t z)))
(if (<= a 2.7e+26)
(- x (/ (* y (- a z)) t))
(if (<= a 3.8e+30) (+ x (* y (/ z t))) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y + (x - (y / (a / z)));
double tmp;
if (a <= -210000.0) {
tmp = t_1;
} else if (a <= 7.6e-190) {
tmp = x + (y / (t / z));
} else if (a <= 2.7e+26) {
tmp = x - ((y * (a - z)) / t);
} else if (a <= 3.8e+30) {
tmp = x + (y * (z / 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) :: tmp
t_1 = y + (x - (y / (a / z)))
if (a <= (-210000.0d0)) then
tmp = t_1
else if (a <= 7.6d-190) then
tmp = x + (y / (t / z))
else if (a <= 2.7d+26) then
tmp = x - ((y * (a - z)) / t)
else if (a <= 3.8d+30) then
tmp = x + (y * (z / 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 - (y / (a / z)));
double tmp;
if (a <= -210000.0) {
tmp = t_1;
} else if (a <= 7.6e-190) {
tmp = x + (y / (t / z));
} else if (a <= 2.7e+26) {
tmp = x - ((y * (a - z)) / t);
} else if (a <= 3.8e+30) {
tmp = x + (y * (z / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y + (x - (y / (a / z))) tmp = 0 if a <= -210000.0: tmp = t_1 elif a <= 7.6e-190: tmp = x + (y / (t / z)) elif a <= 2.7e+26: tmp = x - ((y * (a - z)) / t) elif a <= 3.8e+30: tmp = x + (y * (z / t)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y + Float64(x - Float64(y / Float64(a / z)))) tmp = 0.0 if (a <= -210000.0) tmp = t_1; elseif (a <= 7.6e-190) tmp = Float64(x + Float64(y / Float64(t / z))); elseif (a <= 2.7e+26) tmp = Float64(x - Float64(Float64(y * Float64(a - z)) / t)); elseif (a <= 3.8e+30) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y + (x - (y / (a / z))); tmp = 0.0; if (a <= -210000.0) tmp = t_1; elseif (a <= 7.6e-190) tmp = x + (y / (t / z)); elseif (a <= 2.7e+26) tmp = x - ((y * (a - z)) / t); elseif (a <= 3.8e+30) tmp = x + (y * (z / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y + N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -210000.0], t$95$1, If[LessEqual[a, 7.6e-190], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.7e+26], N[(x - N[(N[(y * N[(a - z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.8e+30], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + \left(x - \frac{y}{\frac{a}{z}}\right)\\
\mathbf{if}\;a \leq -210000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 7.6 \cdot 10^{-190}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;a \leq 2.7 \cdot 10^{+26}:\\
\;\;\;\;x - \frac{y \cdot \left(a - z\right)}{t}\\
\mathbf{elif}\;a \leq 3.8 \cdot 10^{+30}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if a < -2.1e5 or 3.8000000000000001e30 < a Initial program 77.8%
associate--l+79.6%
sub-neg79.6%
+-commutative79.6%
associate-/l*92.8%
distribute-neg-frac92.8%
associate-/r/96.2%
fma-def96.2%
sub-neg96.2%
+-commutative96.2%
distribute-neg-in96.2%
unsub-neg96.2%
remove-double-neg96.2%
Simplified96.2%
Taylor expanded in t around 0 74.9%
mul-1-neg74.9%
sub-neg74.9%
associate-/l*85.5%
Simplified85.5%
if -2.1e5 < a < 7.5999999999999996e-190Initial program 75.6%
associate--l+82.7%
sub-neg82.7%
+-commutative82.7%
associate-/l*88.7%
distribute-neg-frac88.7%
associate-/r/89.5%
fma-def89.5%
sub-neg89.5%
+-commutative89.5%
distribute-neg-in89.5%
unsub-neg89.5%
remove-double-neg89.5%
Simplified89.5%
Taylor expanded in y around 0 96.0%
Taylor expanded in a around 0 84.0%
associate-/l*89.5%
Simplified89.5%
if 7.5999999999999996e-190 < a < 2.7e26Initial program 83.7%
associate--l+83.7%
associate-/l*80.7%
Simplified80.7%
Taylor expanded in t around -inf 73.5%
+-commutative73.5%
sub-neg73.5%
mul-1-neg73.5%
+-commutative73.5%
*-commutative73.5%
+-commutative73.5%
*-commutative73.5%
mul-1-neg73.5%
unsub-neg73.5%
mul-1-neg73.5%
sub-neg73.5%
distribute-lft-out--73.5%
Simplified73.5%
if 2.7e26 < a < 3.8000000000000001e30Initial program 50.1%
associate--l+50.1%
sub-neg50.1%
+-commutative50.1%
associate-/l*99.2%
distribute-neg-frac99.2%
associate-/r/100.0%
fma-def100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in a around 0 100.0%
Final simplification84.8%
(FPCore (x y z t a)
:precision binary64
(if (<= a -7200000000.0)
(+ y (- x (/ y (/ a z))))
(if (<= a 1.2e+49)
(- x (/ (* y z) (- a t)))
(+ x (* y (+ (/ t (- a t)) 1.0))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -7200000000.0) {
tmp = y + (x - (y / (a / z)));
} else if (a <= 1.2e+49) {
tmp = x - ((y * z) / (a - t));
} else {
tmp = x + (y * ((t / (a - t)) + 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 (a <= (-7200000000.0d0)) then
tmp = y + (x - (y / (a / z)))
else if (a <= 1.2d+49) then
tmp = x - ((y * z) / (a - t))
else
tmp = x + (y * ((t / (a - t)) + 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 (a <= -7200000000.0) {
tmp = y + (x - (y / (a / z)));
} else if (a <= 1.2e+49) {
tmp = x - ((y * z) / (a - t));
} else {
tmp = x + (y * ((t / (a - t)) + 1.0));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -7200000000.0: tmp = y + (x - (y / (a / z))) elif a <= 1.2e+49: tmp = x - ((y * z) / (a - t)) else: tmp = x + (y * ((t / (a - t)) + 1.0)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -7200000000.0) tmp = Float64(y + Float64(x - Float64(y / Float64(a / z)))); elseif (a <= 1.2e+49) tmp = Float64(x - Float64(Float64(y * z) / Float64(a - t))); else tmp = Float64(x + Float64(y * Float64(Float64(t / Float64(a - t)) + 1.0))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -7200000000.0) tmp = y + (x - (y / (a / z))); elseif (a <= 1.2e+49) tmp = x - ((y * z) / (a - t)); else tmp = x + (y * ((t / (a - t)) + 1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -7200000000.0], N[(y + N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.2e+49], N[(x - N[(N[(y * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7200000000:\\
\;\;\;\;y + \left(x - \frac{y}{\frac{a}{z}}\right)\\
\mathbf{elif}\;a \leq 1.2 \cdot 10^{+49}:\\
\;\;\;\;x - \frac{y \cdot z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(\frac{t}{a - t} + 1\right)\\
\end{array}
\end{array}
if a < -7.2e9Initial program 76.0%
associate--l+77.6%
sub-neg77.6%
+-commutative77.6%
associate-/l*92.0%
distribute-neg-frac92.0%
associate-/r/96.7%
fma-def96.6%
sub-neg96.6%
+-commutative96.6%
distribute-neg-in96.6%
unsub-neg96.6%
remove-double-neg96.6%
Simplified96.6%
Taylor expanded in t around 0 76.5%
mul-1-neg76.5%
sub-neg76.5%
associate-/l*87.5%
Simplified87.5%
if -7.2e9 < a < 1.2e49Initial program 77.7%
associate--l+82.3%
sub-neg82.3%
+-commutative82.3%
associate-/l*85.8%
distribute-neg-frac85.8%
associate-/r/86.6%
fma-def86.6%
sub-neg86.6%
+-commutative86.6%
distribute-neg-in86.6%
unsub-neg86.6%
remove-double-neg86.6%
Simplified86.6%
Taylor expanded in z around inf 87.5%
associate-*r/87.5%
associate-*r*87.5%
neg-mul-187.5%
Simplified87.5%
if 1.2e49 < a Initial program 80.9%
associate--l+83.0%
sub-neg83.0%
+-commutative83.0%
associate-/l*95.5%
distribute-neg-frac95.5%
associate-/r/97.3%
fma-def97.4%
sub-neg97.4%
+-commutative97.4%
distribute-neg-in97.4%
unsub-neg97.4%
remove-double-neg97.4%
Simplified97.4%
Taylor expanded in y around 0 97.4%
Taylor expanded in z around 0 87.1%
Final simplification87.4%
(FPCore (x y z t a)
:precision binary64
(if (<= t -2.8e+103)
(+ x (* y (/ (- z a) t)))
(if (<= t 1.05e+55)
(- (+ y x) (* y (/ z (- a t))))
(- x (/ y (/ t (- a z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.8e+103) {
tmp = x + (y * ((z - a) / t));
} else if (t <= 1.05e+55) {
tmp = (y + x) - (y * (z / (a - t)));
} else {
tmp = x - (y / (t / (a - z)));
}
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 <= (-2.8d+103)) then
tmp = x + (y * ((z - a) / t))
else if (t <= 1.05d+55) then
tmp = (y + x) - (y * (z / (a - t)))
else
tmp = x - (y / (t / (a - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.8e+103) {
tmp = x + (y * ((z - a) / t));
} else if (t <= 1.05e+55) {
tmp = (y + x) - (y * (z / (a - t)));
} else {
tmp = x - (y / (t / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.8e+103: tmp = x + (y * ((z - a) / t)) elif t <= 1.05e+55: tmp = (y + x) - (y * (z / (a - t))) else: tmp = x - (y / (t / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.8e+103) tmp = Float64(x + Float64(y * Float64(Float64(z - a) / t))); elseif (t <= 1.05e+55) tmp = Float64(Float64(y + x) - Float64(y * Float64(z / Float64(a - t)))); else tmp = Float64(x - Float64(y / Float64(t / Float64(a - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.8e+103) tmp = x + (y * ((z - a) / t)); elseif (t <= 1.05e+55) tmp = (y + x) - (y * (z / (a - t))); else tmp = x - (y / (t / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.8e+103], N[(x + N[(y * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.05e+55], N[(N[(y + x), $MachinePrecision] - N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+103}:\\
\;\;\;\;x + y \cdot \frac{z - a}{t}\\
\mathbf{elif}\;t \leq 1.05 \cdot 10^{+55}:\\
\;\;\;\;\left(y + x\right) - y \cdot \frac{z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{t}{a - z}}\\
\end{array}
\end{array}
if t < -2.80000000000000008e103Initial program 49.5%
associate--l+60.0%
sub-neg60.0%
+-commutative60.0%
associate-/l*61.6%
distribute-neg-frac61.6%
associate-/r/76.1%
fma-def76.0%
sub-neg76.0%
+-commutative76.0%
distribute-neg-in76.0%
unsub-neg76.0%
remove-double-neg76.0%
Simplified76.0%
Taylor expanded in y around 0 89.2%
Taylor expanded in t around inf 84.7%
associate-*r/84.7%
neg-mul-184.7%
+-commutative84.7%
sub-neg84.7%
mul-1-neg84.7%
Simplified84.7%
if -2.80000000000000008e103 < t < 1.05e55Initial program 88.2%
associate-*l/92.4%
Simplified92.4%
Taylor expanded in z around inf 91.8%
if 1.05e55 < t Initial program 66.9%
associate--l+72.1%
sub-neg72.1%
+-commutative72.1%
associate-/l*88.3%
distribute-neg-frac88.3%
associate-/r/92.6%
fma-def92.7%
sub-neg92.7%
+-commutative92.7%
distribute-neg-in92.7%
unsub-neg92.7%
remove-double-neg92.7%
Simplified92.7%
Taylor expanded in y around 0 96.2%
Taylor expanded in t around inf 77.2%
mul-1-neg77.2%
*-commutative77.2%
neg-mul-177.2%
+-commutative77.2%
sub-neg77.2%
associate-/l*87.3%
Simplified87.3%
Final simplification89.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3100000.0) (not (<= a 2.3e+30))) (+ y (- x (/ y (/ a z)))) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3100000.0) || !(a <= 2.3e+30)) {
tmp = y + (x - (y / (a / z)));
} else {
tmp = x + (y / (t / z));
}
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 <= (-3100000.0d0)) .or. (.not. (a <= 2.3d+30))) then
tmp = y + (x - (y / (a / z)))
else
tmp = x + (y / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3100000.0) || !(a <= 2.3e+30)) {
tmp = y + (x - (y / (a / z)));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -3100000.0) or not (a <= 2.3e+30): tmp = y + (x - (y / (a / z))) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -3100000.0) || !(a <= 2.3e+30)) tmp = Float64(y + Float64(x - Float64(y / Float64(a / z)))); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -3100000.0) || ~((a <= 2.3e+30))) tmp = y + (x - (y / (a / z))); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -3100000.0], N[Not[LessEqual[a, 2.3e+30]], $MachinePrecision]], N[(y + N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3100000 \lor \neg \left(a \leq 2.3 \cdot 10^{+30}\right):\\
\;\;\;\;y + \left(x - \frac{y}{\frac{a}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if a < -3.1e6 or 2.3e30 < a Initial program 77.8%
associate--l+79.6%
sub-neg79.6%
+-commutative79.6%
associate-/l*92.8%
distribute-neg-frac92.8%
associate-/r/96.2%
fma-def96.2%
sub-neg96.2%
+-commutative96.2%
distribute-neg-in96.2%
unsub-neg96.2%
remove-double-neg96.2%
Simplified96.2%
Taylor expanded in t around 0 74.9%
mul-1-neg74.9%
sub-neg74.9%
associate-/l*85.5%
Simplified85.5%
if -3.1e6 < a < 2.3e30Initial program 78.0%
associate--l+82.6%
sub-neg82.6%
+-commutative82.6%
associate-/l*86.2%
distribute-neg-frac86.2%
associate-/r/87.0%
fma-def87.0%
sub-neg87.0%
+-commutative87.0%
distribute-neg-in87.0%
unsub-neg87.0%
remove-double-neg87.0%
Simplified87.0%
Taylor expanded in y around 0 92.2%
Taylor expanded in a around 0 76.9%
associate-/l*81.1%
Simplified81.1%
Final simplification83.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -15500000000.0) (not (<= a 3.7e+38))) (+ y (- x (/ y (/ a z)))) (- x (/ (* y z) (- a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -15500000000.0) || !(a <= 3.7e+38)) {
tmp = y + (x - (y / (a / z)));
} else {
tmp = x - ((y * z) / (a - 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 ((a <= (-15500000000.0d0)) .or. (.not. (a <= 3.7d+38))) then
tmp = y + (x - (y / (a / z)))
else
tmp = x - ((y * z) / (a - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -15500000000.0) || !(a <= 3.7e+38)) {
tmp = y + (x - (y / (a / z)));
} else {
tmp = x - ((y * z) / (a - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -15500000000.0) or not (a <= 3.7e+38): tmp = y + (x - (y / (a / z))) else: tmp = x - ((y * z) / (a - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -15500000000.0) || !(a <= 3.7e+38)) tmp = Float64(y + Float64(x - Float64(y / Float64(a / z)))); else tmp = Float64(x - Float64(Float64(y * z) / Float64(a - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -15500000000.0) || ~((a <= 3.7e+38))) tmp = y + (x - (y / (a / z))); else tmp = x - ((y * z) / (a - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -15500000000.0], N[Not[LessEqual[a, 3.7e+38]], $MachinePrecision]], N[(y + N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -15500000000 \lor \neg \left(a \leq 3.7 \cdot 10^{+38}\right):\\
\;\;\;\;y + \left(x - \frac{y}{\frac{a}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot z}{a - t}\\
\end{array}
\end{array}
if a < -1.55e10 or 3.7000000000000001e38 < a Initial program 78.5%
associate--l+80.3%
sub-neg80.3%
+-commutative80.3%
associate-/l*93.7%
distribute-neg-frac93.7%
associate-/r/97.0%
fma-def97.0%
sub-neg97.0%
+-commutative97.0%
distribute-neg-in97.0%
unsub-neg97.0%
remove-double-neg97.0%
Simplified97.0%
Taylor expanded in t around 0 75.5%
mul-1-neg75.5%
sub-neg75.5%
associate-/l*86.3%
Simplified86.3%
if -1.55e10 < a < 3.7000000000000001e38Initial program 77.4%
associate--l+82.1%
sub-neg82.1%
+-commutative82.1%
associate-/l*85.6%
distribute-neg-frac85.6%
associate-/r/86.4%
fma-def86.4%
sub-neg86.4%
+-commutative86.4%
distribute-neg-in86.4%
unsub-neg86.4%
remove-double-neg86.4%
Simplified86.4%
Taylor expanded in z around inf 87.3%
associate-*r/87.3%
associate-*r*87.3%
neg-mul-187.3%
Simplified87.3%
Final simplification86.9%
(FPCore (x y z t a) :precision binary64 (+ x (* y (+ (/ (- t z) (- a t)) 1.0))))
double code(double x, double y, double z, double t, double a) {
return x + (y * (((t - z) / (a - t)) + 1.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 = x + (y * (((t - z) / (a - t)) + 1.0d0))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * (((t - z) / (a - t)) + 1.0));
}
def code(x, y, z, t, a): return x + (y * (((t - z) / (a - t)) + 1.0))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(Float64(t - z) / Float64(a - t)) + 1.0))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * (((t - z) / (a - t)) + 1.0)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(N[(t - z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \left(\frac{t - z}{a - t} + 1\right)
\end{array}
Initial program 77.9%
associate--l+81.3%
sub-neg81.3%
+-commutative81.3%
associate-/l*89.0%
distribute-neg-frac89.0%
associate-/r/90.9%
fma-def90.9%
sub-neg90.9%
+-commutative90.9%
distribute-neg-in90.9%
unsub-neg90.9%
remove-double-neg90.9%
Simplified90.9%
Taylor expanded in y around 0 94.3%
associate--l+90.9%
div-sub90.9%
Simplified90.9%
Final simplification90.9%
(FPCore (x y z t a) :precision binary64 (if (<= a -26000000.0) (+ y x) (if (<= a 1.05e+47) (+ x (* y (/ z t))) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -26000000.0) {
tmp = y + x;
} else if (a <= 1.05e+47) {
tmp = x + (y * (z / 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 (a <= (-26000000.0d0)) then
tmp = y + x
else if (a <= 1.05d+47) then
tmp = x + (y * (z / 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 (a <= -26000000.0) {
tmp = y + x;
} else if (a <= 1.05e+47) {
tmp = x + (y * (z / t));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -26000000.0: tmp = y + x elif a <= 1.05e+47: tmp = x + (y * (z / t)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -26000000.0) tmp = Float64(y + x); elseif (a <= 1.05e+47) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -26000000.0) tmp = y + x; elseif (a <= 1.05e+47) tmp = x + (y * (z / t)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -26000000.0], N[(y + x), $MachinePrecision], If[LessEqual[a, 1.05e+47], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -26000000:\\
\;\;\;\;y + x\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{+47}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -2.6e7 or 1.05e47 < a Initial program 77.4%
associate--l+79.2%
sub-neg79.2%
+-commutative79.2%
associate-/l*92.7%
distribute-neg-frac92.7%
associate-/r/96.1%
fma-def96.1%
sub-neg96.1%
+-commutative96.1%
distribute-neg-in96.1%
unsub-neg96.1%
remove-double-neg96.1%
Simplified96.1%
Taylor expanded in a around inf 77.8%
if -2.6e7 < a < 1.05e47Initial program 78.3%
associate--l+82.8%
sub-neg82.8%
+-commutative82.8%
associate-/l*86.4%
distribute-neg-frac86.4%
associate-/r/87.1%
fma-def87.2%
sub-neg87.2%
+-commutative87.2%
distribute-neg-in87.2%
unsub-neg87.2%
remove-double-neg87.2%
Simplified87.2%
Taylor expanded in y around 0 92.3%
Taylor expanded in a around 0 80.9%
Final simplification79.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -720000.0) (+ y x) (if (<= a 6.2e+45) (+ x (/ y (/ t z))) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -720000.0) {
tmp = y + x;
} else if (a <= 6.2e+45) {
tmp = x + (y / (t / z));
} 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 <= (-720000.0d0)) then
tmp = y + x
else if (a <= 6.2d+45) then
tmp = x + (y / (t / z))
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 <= -720000.0) {
tmp = y + x;
} else if (a <= 6.2e+45) {
tmp = x + (y / (t / z));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -720000.0: tmp = y + x elif a <= 6.2e+45: tmp = x + (y / (t / z)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -720000.0) tmp = Float64(y + x); elseif (a <= 6.2e+45) tmp = Float64(x + Float64(y / Float64(t / z))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -720000.0) tmp = y + x; elseif (a <= 6.2e+45) tmp = x + (y / (t / z)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -720000.0], N[(y + x), $MachinePrecision], If[LessEqual[a, 6.2e+45], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -720000:\\
\;\;\;\;y + x\\
\mathbf{elif}\;a \leq 6.2 \cdot 10^{+45}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -7.2e5 or 6.19999999999999975e45 < a Initial program 77.4%
associate--l+79.2%
sub-neg79.2%
+-commutative79.2%
associate-/l*92.7%
distribute-neg-frac92.7%
associate-/r/96.1%
fma-def96.1%
sub-neg96.1%
+-commutative96.1%
distribute-neg-in96.1%
unsub-neg96.1%
remove-double-neg96.1%
Simplified96.1%
Taylor expanded in a around inf 77.8%
if -7.2e5 < a < 6.19999999999999975e45Initial program 78.3%
associate--l+82.8%
sub-neg82.8%
+-commutative82.8%
associate-/l*86.4%
distribute-neg-frac86.4%
associate-/r/87.1%
fma-def87.2%
sub-neg87.2%
+-commutative87.2%
distribute-neg-in87.2%
unsub-neg87.2%
remove-double-neg87.2%
Simplified87.2%
Taylor expanded in y around 0 92.3%
Taylor expanded in a around 0 77.2%
associate-/l*81.4%
Simplified81.4%
Final simplification79.9%
(FPCore (x y z t a) :precision binary64 (if (<= t -4.9e+187) x (if (<= t 3.5e+59) (+ y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.9e+187) {
tmp = x;
} else if (t <= 3.5e+59) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-4.9d+187)) then
tmp = x
else if (t <= 3.5d+59) then
tmp = y + x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.9e+187) {
tmp = x;
} else if (t <= 3.5e+59) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4.9e+187: tmp = x elif t <= 3.5e+59: tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.9e+187) tmp = x; elseif (t <= 3.5e+59) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -4.9e+187) tmp = x; elseif (t <= 3.5e+59) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.9e+187], x, If[LessEqual[t, 3.5e+59], N[(y + x), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.9 \cdot 10^{+187}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{+59}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -4.9000000000000003e187 or 3.5e59 < t Initial program 63.0%
associate--l+70.8%
sub-neg70.8%
+-commutative70.8%
associate-/l*80.3%
distribute-neg-frac80.3%
associate-/r/89.2%
fma-def89.2%
sub-neg89.2%
+-commutative89.2%
distribute-neg-in89.2%
unsub-neg89.2%
remove-double-neg89.2%
Simplified89.2%
Taylor expanded in x around inf 66.0%
if -4.9000000000000003e187 < t < 3.5e59Initial program 84.1%
associate--l+85.7%
sub-neg85.7%
+-commutative85.7%
associate-/l*92.6%
distribute-neg-frac92.6%
associate-/r/91.6%
fma-def91.6%
sub-neg91.6%
+-commutative91.6%
distribute-neg-in91.6%
unsub-neg91.6%
remove-double-neg91.6%
Simplified91.6%
Taylor expanded in a around inf 59.5%
Final simplification61.4%
(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 77.9%
associate--l+81.3%
sub-neg81.3%
+-commutative81.3%
associate-/l*89.0%
distribute-neg-frac89.0%
associate-/r/90.9%
fma-def90.9%
sub-neg90.9%
+-commutative90.9%
distribute-neg-in90.9%
unsub-neg90.9%
remove-double-neg90.9%
Simplified90.9%
Taylor expanded in x around inf 50.2%
Final simplification50.2%
(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 2023221
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-7) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y))))
(- (+ x y) (/ (* (- z t) y) (- a t))))