
(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 (/ (- z t) (/ (- z a) y))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) / ((z - a) / y));
}
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 + ((z - t) / ((z - a) / y))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) / ((z - a) / y));
}
def code(x, y, z, t, a): return x + ((z - t) / ((z - a) / y))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) / Float64(Float64(z - a) / y))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) / ((z - a) / y)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] / N[(N[(z - a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z - t}{\frac{z - a}{y}}
\end{array}
Initial program 86.3%
*-commutative86.3%
associate-/l*96.7%
Simplified96.7%
Final simplification96.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ y (- 1.0 (/ a z))))))
(if (<= z -42000000.0)
t_1
(if (<= z -1.32e-23)
(+ x (/ (* (- z t) y) z))
(if (or (<= z -9.6e-163) (not (<= z 2.3e+44)))
t_1
(+ x (* y (/ t a))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y / (1.0 - (a / z)));
double tmp;
if (z <= -42000000.0) {
tmp = t_1;
} else if (z <= -1.32e-23) {
tmp = x + (((z - t) * y) / z);
} else if ((z <= -9.6e-163) || !(z <= 2.3e+44)) {
tmp = t_1;
} else {
tmp = x + (y * (t / 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) :: t_1
real(8) :: tmp
t_1 = x + (y / (1.0d0 - (a / z)))
if (z <= (-42000000.0d0)) then
tmp = t_1
else if (z <= (-1.32d-23)) then
tmp = x + (((z - t) * y) / z)
else if ((z <= (-9.6d-163)) .or. (.not. (z <= 2.3d+44))) then
tmp = t_1
else
tmp = x + (y * (t / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y / (1.0 - (a / z)));
double tmp;
if (z <= -42000000.0) {
tmp = t_1;
} else if (z <= -1.32e-23) {
tmp = x + (((z - t) * y) / z);
} else if ((z <= -9.6e-163) || !(z <= 2.3e+44)) {
tmp = t_1;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y / (1.0 - (a / z))) tmp = 0 if z <= -42000000.0: tmp = t_1 elif z <= -1.32e-23: tmp = x + (((z - t) * y) / z) elif (z <= -9.6e-163) or not (z <= 2.3e+44): tmp = t_1 else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y / Float64(1.0 - Float64(a / z)))) tmp = 0.0 if (z <= -42000000.0) tmp = t_1; elseif (z <= -1.32e-23) tmp = Float64(x + Float64(Float64(Float64(z - t) * y) / z)); elseif ((z <= -9.6e-163) || !(z <= 2.3e+44)) tmp = t_1; else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y / (1.0 - (a / z))); tmp = 0.0; if (z <= -42000000.0) tmp = t_1; elseif (z <= -1.32e-23) tmp = x + (((z - t) * y) / z); elseif ((z <= -9.6e-163) || ~((z <= 2.3e+44))) tmp = t_1; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y / N[(1.0 - N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -42000000.0], t$95$1, If[LessEqual[z, -1.32e-23], N[(x + N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -9.6e-163], N[Not[LessEqual[z, 2.3e+44]], $MachinePrecision]], t$95$1, N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y}{1 - \frac{a}{z}}\\
\mathbf{if}\;z \leq -42000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.32 \cdot 10^{-23}:\\
\;\;\;\;x + \frac{\left(z - t\right) \cdot y}{z}\\
\mathbf{elif}\;z \leq -9.6 \cdot 10^{-163} \lor \neg \left(z \leq 2.3 \cdot 10^{+44}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -4.2e7 or -1.31999999999999994e-23 < z < -9.6000000000000003e-163 or 2.30000000000000004e44 < z Initial program 80.9%
*-commutative80.9%
associate-/l*96.8%
Simplified96.8%
clear-num96.5%
associate-/r/96.7%
Applied egg-rr96.7%
Taylor expanded in t around 0 73.3%
associate-/l*87.2%
div-sub87.2%
*-inverses87.2%
Simplified87.2%
if -4.2e7 < z < -1.31999999999999994e-23Initial program 89.6%
Taylor expanded in a around 0 78.9%
if -9.6000000000000003e-163 < z < 2.30000000000000004e44Initial program 94.1%
+-commutative94.1%
associate-*l/97.0%
fma-def97.0%
Simplified97.0%
Taylor expanded in z around 0 77.4%
+-commutative77.4%
associate-/l*79.3%
associate-/r/81.3%
Simplified81.3%
Final simplification84.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.9e+188)
(+ x y)
(if (<= z 1.85e+164)
(+ x (/ (* (- z t) y) (- z a)))
(+ x (/ y (- 1.0 (/ a z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.9e+188) {
tmp = x + y;
} else if (z <= 1.85e+164) {
tmp = x + (((z - t) * y) / (z - a));
} else {
tmp = x + (y / (1.0 - (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 (z <= (-2.9d+188)) then
tmp = x + y
else if (z <= 1.85d+164) then
tmp = x + (((z - t) * y) / (z - a))
else
tmp = x + (y / (1.0d0 - (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 (z <= -2.9e+188) {
tmp = x + y;
} else if (z <= 1.85e+164) {
tmp = x + (((z - t) * y) / (z - a));
} else {
tmp = x + (y / (1.0 - (a / z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.9e+188: tmp = x + y elif z <= 1.85e+164: tmp = x + (((z - t) * y) / (z - a)) else: tmp = x + (y / (1.0 - (a / z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.9e+188) tmp = Float64(x + y); elseif (z <= 1.85e+164) tmp = Float64(x + Float64(Float64(Float64(z - t) * y) / Float64(z - a))); else tmp = Float64(x + Float64(y / Float64(1.0 - Float64(a / z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.9e+188) tmp = x + y; elseif (z <= 1.85e+164) tmp = x + (((z - t) * y) / (z - a)); else tmp = x + (y / (1.0 - (a / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.9e+188], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.85e+164], N[(x + N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(1.0 - N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{+188}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+164}:\\
\;\;\;\;x + \frac{\left(z - t\right) \cdot y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{1 - \frac{a}{z}}\\
\end{array}
\end{array}
if z < -2.8999999999999999e188Initial program 65.5%
+-commutative65.5%
associate-*l/100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
+-commutative100.0%
Simplified100.0%
if -2.8999999999999999e188 < z < 1.85e164Initial program 91.5%
if 1.85e164 < z Initial program 67.7%
*-commutative67.7%
associate-/l*95.3%
Simplified95.3%
clear-num95.3%
associate-/r/95.2%
Applied egg-rr95.2%
Taylor expanded in t around 0 67.7%
associate-/l*99.9%
div-sub100.0%
*-inverses100.0%
Simplified100.0%
Final simplification93.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.2e-162) (not (<= z 2.35e+44))) (+ x (/ y (- 1.0 (/ a z)))) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.2e-162) || !(z <= 2.35e+44)) {
tmp = x + (y / (1.0 - (a / z)));
} else {
tmp = x + (y * (t / 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 <= (-1.2d-162)) .or. (.not. (z <= 2.35d+44))) then
tmp = x + (y / (1.0d0 - (a / z)))
else
tmp = x + (y * (t / 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 <= -1.2e-162) || !(z <= 2.35e+44)) {
tmp = x + (y / (1.0 - (a / z)));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.2e-162) or not (z <= 2.35e+44): tmp = x + (y / (1.0 - (a / z))) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.2e-162) || !(z <= 2.35e+44)) tmp = Float64(x + Float64(y / Float64(1.0 - Float64(a / z)))); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.2e-162) || ~((z <= 2.35e+44))) tmp = x + (y / (1.0 - (a / z))); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.2e-162], N[Not[LessEqual[z, 2.35e+44]], $MachinePrecision]], N[(x + N[(y / N[(1.0 - N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{-162} \lor \neg \left(z \leq 2.35 \cdot 10^{+44}\right):\\
\;\;\;\;x + \frac{y}{1 - \frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -1.2000000000000001e-162 or 2.35000000000000009e44 < z Initial program 81.4%
*-commutative81.4%
associate-/l*96.5%
Simplified96.5%
clear-num96.1%
associate-/r/96.4%
Applied egg-rr96.4%
Taylor expanded in t around 0 71.0%
associate-/l*84.1%
div-sub84.1%
*-inverses84.1%
Simplified84.1%
if -1.2000000000000001e-162 < z < 2.35000000000000009e44Initial program 94.1%
+-commutative94.1%
associate-*l/97.0%
fma-def97.0%
Simplified97.0%
Taylor expanded in z around 0 77.4%
+-commutative77.4%
associate-/l*79.3%
associate-/r/81.3%
Simplified81.3%
Final simplification83.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.3e+76) (not (<= t 520.0))) (- x (* t (/ y (- z a)))) (+ x (/ y (- 1.0 (/ a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.3e+76) || !(t <= 520.0)) {
tmp = x - (t * (y / (z - a)));
} else {
tmp = x + (y / (1.0 - (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 <= (-1.3d+76)) .or. (.not. (t <= 520.0d0))) then
tmp = x - (t * (y / (z - a)))
else
tmp = x + (y / (1.0d0 - (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 <= -1.3e+76) || !(t <= 520.0)) {
tmp = x - (t * (y / (z - a)));
} else {
tmp = x + (y / (1.0 - (a / z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.3e+76) or not (t <= 520.0): tmp = x - (t * (y / (z - a))) else: tmp = x + (y / (1.0 - (a / z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.3e+76) || !(t <= 520.0)) tmp = Float64(x - Float64(t * Float64(y / Float64(z - a)))); else tmp = Float64(x + Float64(y / Float64(1.0 - Float64(a / z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.3e+76) || ~((t <= 520.0))) tmp = x - (t * (y / (z - a))); else tmp = x + (y / (1.0 - (a / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.3e+76], N[Not[LessEqual[t, 520.0]], $MachinePrecision]], N[(x - N[(t * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(1.0 - N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.3 \cdot 10^{+76} \lor \neg \left(t \leq 520\right):\\
\;\;\;\;x - t \cdot \frac{y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{1 - \frac{a}{z}}\\
\end{array}
\end{array}
if t < -1.3e76 or 520 < t Initial program 83.9%
Taylor expanded in t around inf 81.4%
associate-*r/88.2%
neg-mul-188.2%
distribute-lft-neg-in88.2%
*-commutative88.2%
Simplified88.2%
if -1.3e76 < t < 520Initial program 88.2%
*-commutative88.2%
associate-/l*96.9%
Simplified96.9%
clear-num96.4%
associate-/r/96.8%
Applied egg-rr96.8%
Taylor expanded in t around 0 80.8%
associate-/l*92.3%
div-sub92.3%
*-inverses92.3%
Simplified92.3%
Final simplification90.5%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.95e+38) (+ x (* t (/ y a))) (if (<= a 2.1e+38) (+ x (/ (- z t) (/ z y))) (+ x (* y (/ t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.95e+38) {
tmp = x + (t * (y / a));
} else if (a <= 2.1e+38) {
tmp = x + ((z - t) / (z / y));
} else {
tmp = x + (y * (t / 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 (a <= (-1.95d+38)) then
tmp = x + (t * (y / a))
else if (a <= 2.1d+38) then
tmp = x + ((z - t) / (z / y))
else
tmp = x + (y * (t / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.95e+38) {
tmp = x + (t * (y / a));
} else if (a <= 2.1e+38) {
tmp = x + ((z - t) / (z / y));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.95e+38: tmp = x + (t * (y / a)) elif a <= 2.1e+38: tmp = x + ((z - t) / (z / y)) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.95e+38) tmp = Float64(x + Float64(t * Float64(y / a))); elseif (a <= 2.1e+38) tmp = Float64(x + Float64(Float64(z - t) / Float64(z / y))); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.95e+38) tmp = x + (t * (y / a)); elseif (a <= 2.1e+38) tmp = x + ((z - t) / (z / y)); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.95e+38], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.1e+38], N[(x + N[(N[(z - t), $MachinePrecision] / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.95 \cdot 10^{+38}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{elif}\;a \leq 2.1 \cdot 10^{+38}:\\
\;\;\;\;x + \frac{z - t}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if a < -1.95000000000000012e38Initial program 83.5%
*-commutative83.5%
associate-/l*99.8%
Simplified99.8%
clear-num99.8%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in z around 0 70.8%
associate-*r/83.3%
Simplified83.3%
if -1.95000000000000012e38 < a < 2.1e38Initial program 87.5%
*-commutative87.5%
associate-/l*96.0%
Simplified96.0%
Taylor expanded in z around inf 84.1%
if 2.1e38 < a Initial program 87.2%
+-commutative87.2%
associate-*l/94.6%
fma-def94.6%
Simplified94.6%
Taylor expanded in z around 0 78.4%
+-commutative78.4%
associate-/l*83.3%
associate-/r/86.5%
Simplified86.5%
Final simplification84.4%
(FPCore (x y z t a) :precision binary64 (if (<= a -1e+38) (+ x (* (/ y a) (- t z))) (if (<= a 1.56e+38) (+ x (/ (- z t) (/ z y))) (+ x (* y (/ t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1e+38) {
tmp = x + ((y / a) * (t - z));
} else if (a <= 1.56e+38) {
tmp = x + ((z - t) / (z / y));
} else {
tmp = x + (y * (t / 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 (a <= (-1d+38)) then
tmp = x + ((y / a) * (t - z))
else if (a <= 1.56d+38) then
tmp = x + ((z - t) / (z / y))
else
tmp = x + (y * (t / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1e+38) {
tmp = x + ((y / a) * (t - z));
} else if (a <= 1.56e+38) {
tmp = x + ((z - t) / (z / y));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1e+38: tmp = x + ((y / a) * (t - z)) elif a <= 1.56e+38: tmp = x + ((z - t) / (z / y)) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1e+38) tmp = Float64(x + Float64(Float64(y / a) * Float64(t - z))); elseif (a <= 1.56e+38) tmp = Float64(x + Float64(Float64(z - t) / Float64(z / y))); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1e+38) tmp = x + ((y / a) * (t - z)); elseif (a <= 1.56e+38) tmp = x + ((z - t) / (z / y)); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1e+38], N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.56e+38], N[(x + N[(N[(z - t), $MachinePrecision] / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1 \cdot 10^{+38}:\\
\;\;\;\;x + \frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{elif}\;a \leq 1.56 \cdot 10^{+38}:\\
\;\;\;\;x + \frac{z - t}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if a < -9.99999999999999977e37Initial program 83.5%
+-commutative83.5%
associate-*l/99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in a around inf 75.3%
mul-1-neg75.3%
unsub-neg75.3%
associate-/l*86.8%
associate-/r/91.0%
Simplified91.0%
if -9.99999999999999977e37 < a < 1.5599999999999999e38Initial program 87.5%
*-commutative87.5%
associate-/l*96.0%
Simplified96.0%
Taylor expanded in z around inf 84.1%
if 1.5599999999999999e38 < a Initial program 87.2%
+-commutative87.2%
associate-*l/94.6%
fma-def94.6%
Simplified94.6%
Taylor expanded in z around 0 78.4%
+-commutative78.4%
associate-/l*83.3%
associate-/r/86.5%
Simplified86.5%
Final simplification86.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.25e-162) (not (<= z 4.8e+45))) (+ x y) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.25e-162) || !(z <= 4.8e+45)) {
tmp = x + y;
} else {
tmp = x + (t * (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 <= (-1.25d-162)) .or. (.not. (z <= 4.8d+45))) then
tmp = x + y
else
tmp = x + (t * (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 <= -1.25e-162) || !(z <= 4.8e+45)) {
tmp = x + y;
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.25e-162) or not (z <= 4.8e+45): tmp = x + y else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.25e-162) || !(z <= 4.8e+45)) tmp = Float64(x + y); else tmp = Float64(x + Float64(t * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.25e-162) || ~((z <= 4.8e+45))) tmp = x + y; else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.25e-162], N[Not[LessEqual[z, 4.8e+45]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{-162} \lor \neg \left(z \leq 4.8 \cdot 10^{+45}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -1.25000000000000004e-162 or 4.79999999999999979e45 < z Initial program 81.4%
+-commutative81.4%
associate-*l/96.1%
fma-def96.1%
Simplified96.1%
Taylor expanded in z around inf 74.3%
+-commutative74.3%
Simplified74.3%
if -1.25000000000000004e-162 < z < 4.79999999999999979e45Initial program 94.1%
*-commutative94.1%
associate-/l*97.0%
Simplified97.0%
clear-num97.0%
associate-/r/96.9%
Applied egg-rr96.9%
Taylor expanded in z around 0 77.4%
associate-*r/79.3%
Simplified79.3%
Final simplification76.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1e-139) (not (<= z 1.15e+46))) (+ x y) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1e-139) || !(z <= 1.15e+46)) {
tmp = x + y;
} else {
tmp = x + (y * (t / 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 <= (-1d-139)) .or. (.not. (z <= 1.15d+46))) then
tmp = x + y
else
tmp = x + (y * (t / 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 <= -1e-139) || !(z <= 1.15e+46)) {
tmp = x + y;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1e-139) or not (z <= 1.15e+46): tmp = x + y else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1e-139) || !(z <= 1.15e+46)) tmp = Float64(x + y); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1e-139) || ~((z <= 1.15e+46))) tmp = x + y; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1e-139], N[Not[LessEqual[z, 1.15e+46]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-139} \lor \neg \left(z \leq 1.15 \cdot 10^{+46}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -1.00000000000000003e-139 or 1.15e46 < z Initial program 81.5%
+-commutative81.5%
associate-*l/96.1%
fma-def96.1%
Simplified96.1%
Taylor expanded in z around inf 74.3%
+-commutative74.3%
Simplified74.3%
if -1.00000000000000003e-139 < z < 1.15e46Initial program 93.4%
+-commutative93.4%
associate-*l/97.1%
fma-def97.1%
Simplified97.1%
Taylor expanded in z around 0 76.5%
+-commutative76.5%
associate-/l*79.2%
associate-/r/81.1%
Simplified81.1%
Final simplification77.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9e-187) (not (<= z 8.5e-42))) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9e-187) || !(z <= 8.5e-42)) {
tmp = x + 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 ((z <= (-9d-187)) .or. (.not. (z <= 8.5d-42))) then
tmp = x + 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 ((z <= -9e-187) || !(z <= 8.5e-42)) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9e-187) or not (z <= 8.5e-42): tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9e-187) || !(z <= 8.5e-42)) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -9e-187) || ~((z <= 8.5e-42))) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9e-187], N[Not[LessEqual[z, 8.5e-42]], $MachinePrecision]], N[(x + y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-187} \lor \neg \left(z \leq 8.5 \cdot 10^{-42}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -8.9999999999999996e-187 or 8.4999999999999996e-42 < z Initial program 82.1%
+-commutative82.1%
associate-*l/95.9%
fma-def95.9%
Simplified95.9%
Taylor expanded in z around inf 71.9%
+-commutative71.9%
Simplified71.9%
if -8.9999999999999996e-187 < z < 8.4999999999999996e-42Initial program 95.2%
+-commutative95.2%
associate-*l/97.6%
fma-def97.6%
Simplified97.6%
Taylor expanded in y around 0 55.0%
Final simplification66.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 86.3%
+-commutative86.3%
associate-*l/96.5%
fma-def96.5%
Simplified96.5%
Taylor expanded in y around 0 54.5%
Final simplification54.5%
(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 2024027
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, A"
:precision binary64
:herbie-target
(+ x (/ y (/ (- z a) (- z t))))
(+ x (/ (* y (- z t)) (- z a))))