
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (/ y t) (- z x))))
double code(double x, double y, double z, double t) {
return x + ((y / t) * (z - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y / t) * (z - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y / t) * (z - x));
}
def code(x, y, z, t): return x + ((y / t) * (z - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y / t) * Float64(z - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y / t) * (z - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{t} \cdot \left(z - x\right)
\end{array}
Initial program 92.9%
associate-*l/96.5%
Simplified96.5%
Final simplification96.5%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -9e-123)
(and (not (<= x 1.02e-218)) (or (<= x 4e-111) (not (<= x 4e-35)))))
(* x (- 1.0 (/ y t)))
(* y (/ z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9e-123) || (!(x <= 1.02e-218) && ((x <= 4e-111) || !(x <= 4e-35)))) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y * (z / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-9d-123)) .or. (.not. (x <= 1.02d-218)) .and. (x <= 4d-111) .or. (.not. (x <= 4d-35))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = y * (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9e-123) || (!(x <= 1.02e-218) && ((x <= 4e-111) || !(x <= 4e-35)))) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -9e-123) or (not (x <= 1.02e-218) and ((x <= 4e-111) or not (x <= 4e-35))): tmp = x * (1.0 - (y / t)) else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -9e-123) || (!(x <= 1.02e-218) && ((x <= 4e-111) || !(x <= 4e-35)))) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -9e-123) || (~((x <= 1.02e-218)) && ((x <= 4e-111) || ~((x <= 4e-35))))) tmp = x * (1.0 - (y / t)); else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -9e-123], And[N[Not[LessEqual[x, 1.02e-218]], $MachinePrecision], Or[LessEqual[x, 4e-111], N[Not[LessEqual[x, 4e-35]], $MachinePrecision]]]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-123} \lor \neg \left(x \leq 1.02 \cdot 10^{-218}\right) \land \left(x \leq 4 \cdot 10^{-111} \lor \neg \left(x \leq 4 \cdot 10^{-35}\right)\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -8.99999999999999986e-123 or 1.02e-218 < x < 4.00000000000000035e-111 or 4.00000000000000003e-35 < x Initial program 93.2%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in x around inf 81.6%
mul-1-neg81.6%
unsub-neg81.6%
Simplified81.6%
if -8.99999999999999986e-123 < x < 1.02e-218 or 4.00000000000000035e-111 < x < 4.00000000000000003e-35Initial program 92.3%
associate-*l/88.1%
Simplified88.1%
Taylor expanded in y around inf 83.9%
Taylor expanded in z around inf 77.1%
Final simplification80.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ y t)))))
(if (<= x -7.6e+114)
t_1
(if (<= x -9e+77)
(+ x (* (/ y t) z))
(if (or (<= x -55000000000.0) (not (<= x 9.5e+28)))
t_1
(+ x (/ y (/ t z))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / t));
double tmp;
if (x <= -7.6e+114) {
tmp = t_1;
} else if (x <= -9e+77) {
tmp = x + ((y / t) * z);
} else if ((x <= -55000000000.0) || !(x <= 9.5e+28)) {
tmp = t_1;
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (y / t))
if (x <= (-7.6d+114)) then
tmp = t_1
else if (x <= (-9d+77)) then
tmp = x + ((y / t) * z)
else if ((x <= (-55000000000.0d0)) .or. (.not. (x <= 9.5d+28))) then
tmp = t_1
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 t_1 = x * (1.0 - (y / t));
double tmp;
if (x <= -7.6e+114) {
tmp = t_1;
} else if (x <= -9e+77) {
tmp = x + ((y / t) * z);
} else if ((x <= -55000000000.0) || !(x <= 9.5e+28)) {
tmp = t_1;
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / t)) tmp = 0 if x <= -7.6e+114: tmp = t_1 elif x <= -9e+77: tmp = x + ((y / t) * z) elif (x <= -55000000000.0) or not (x <= 9.5e+28): tmp = t_1 else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / t))) tmp = 0.0 if (x <= -7.6e+114) tmp = t_1; elseif (x <= -9e+77) tmp = Float64(x + Float64(Float64(y / t) * z)); elseif ((x <= -55000000000.0) || !(x <= 9.5e+28)) tmp = t_1; else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / t)); tmp = 0.0; if (x <= -7.6e+114) tmp = t_1; elseif (x <= -9e+77) tmp = x + ((y / t) * z); elseif ((x <= -55000000000.0) || ~((x <= 9.5e+28))) tmp = t_1; else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.6e+114], t$95$1, If[LessEqual[x, -9e+77], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -55000000000.0], N[Not[LessEqual[x, 9.5e+28]], $MachinePrecision]], t$95$1, N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{if}\;x \leq -7.6 \cdot 10^{+114}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -9 \cdot 10^{+77}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\mathbf{elif}\;x \leq -55000000000 \lor \neg \left(x \leq 9.5 \cdot 10^{+28}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if x < -7.6000000000000001e114 or -9.00000000000000049e77 < x < -5.5e10 or 9.49999999999999927e28 < x Initial program 93.3%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in x around inf 93.9%
mul-1-neg93.9%
unsub-neg93.9%
Simplified93.9%
if -7.6000000000000001e114 < x < -9.00000000000000049e77Initial program 89.6%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in z around inf 87.1%
associate-*l/97.5%
*-commutative97.5%
Simplified97.5%
if -5.5e10 < x < 9.49999999999999927e28Initial program 92.8%
associate-/l*97.5%
Simplified97.5%
Taylor expanded in z around inf 88.5%
Final simplification91.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))))
(if (<= t -2.7e+28)
x
(if (<= t -8e-280)
t_1
(if (<= t 5.5e-191) (* (/ x t) (- y)) (if (<= t 2.2e+190) t_1 x))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (t <= -2.7e+28) {
tmp = x;
} else if (t <= -8e-280) {
tmp = t_1;
} else if (t <= 5.5e-191) {
tmp = (x / t) * -y;
} else if (t <= 2.2e+190) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * (z / t)
if (t <= (-2.7d+28)) then
tmp = x
else if (t <= (-8d-280)) then
tmp = t_1
else if (t <= 5.5d-191) then
tmp = (x / t) * -y
else if (t <= 2.2d+190) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (t <= -2.7e+28) {
tmp = x;
} else if (t <= -8e-280) {
tmp = t_1;
} else if (t <= 5.5e-191) {
tmp = (x / t) * -y;
} else if (t <= 2.2e+190) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) tmp = 0 if t <= -2.7e+28: tmp = x elif t <= -8e-280: tmp = t_1 elif t <= 5.5e-191: tmp = (x / t) * -y elif t <= 2.2e+190: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) tmp = 0.0 if (t <= -2.7e+28) tmp = x; elseif (t <= -8e-280) tmp = t_1; elseif (t <= 5.5e-191) tmp = Float64(Float64(x / t) * Float64(-y)); elseif (t <= 2.2e+190) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); tmp = 0.0; if (t <= -2.7e+28) tmp = x; elseif (t <= -8e-280) tmp = t_1; elseif (t <= 5.5e-191) tmp = (x / t) * -y; elseif (t <= 2.2e+190) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.7e+28], x, If[LessEqual[t, -8e-280], t$95$1, If[LessEqual[t, 5.5e-191], N[(N[(x / t), $MachinePrecision] * (-y)), $MachinePrecision], If[LessEqual[t, 2.2e+190], t$95$1, x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
\mathbf{if}\;t \leq -2.7 \cdot 10^{+28}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -8 \cdot 10^{-280}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{-191}:\\
\;\;\;\;\frac{x}{t} \cdot \left(-y\right)\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{+190}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -2.7000000000000002e28 or 2.2e190 < t Initial program 88.3%
associate-*l/97.6%
Simplified97.6%
Taylor expanded in y around 0 68.8%
if -2.7000000000000002e28 < t < -7.9999999999999997e-280 or 5.5000000000000001e-191 < t < 2.2e190Initial program 94.9%
associate-*l/95.6%
Simplified95.6%
Taylor expanded in y around inf 76.1%
Taylor expanded in z around inf 58.3%
if -7.9999999999999997e-280 < t < 5.5000000000000001e-191Initial program 97.1%
associate-*l/97.0%
Simplified97.0%
Taylor expanded in x around inf 70.1%
mul-1-neg70.1%
unsub-neg70.1%
Simplified70.1%
Taylor expanded in y around inf 67.4%
associate-*r/64.4%
*-commutative64.4%
associate-*l/67.4%
associate-*r/64.5%
neg-mul-164.5%
distribute-rgt-neg-in64.5%
distribute-neg-frac64.5%
Simplified64.5%
Final simplification62.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))))
(if (<= t -1.35e+29)
x
(if (<= t -1.35e-246)
t_1
(if (<= t 1.48e-71) (/ x (/ (- t) y)) (if (<= t 2.2e+190) t_1 x))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (t <= -1.35e+29) {
tmp = x;
} else if (t <= -1.35e-246) {
tmp = t_1;
} else if (t <= 1.48e-71) {
tmp = x / (-t / y);
} else if (t <= 2.2e+190) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * (z / t)
if (t <= (-1.35d+29)) then
tmp = x
else if (t <= (-1.35d-246)) then
tmp = t_1
else if (t <= 1.48d-71) then
tmp = x / (-t / y)
else if (t <= 2.2d+190) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (t <= -1.35e+29) {
tmp = x;
} else if (t <= -1.35e-246) {
tmp = t_1;
} else if (t <= 1.48e-71) {
tmp = x / (-t / y);
} else if (t <= 2.2e+190) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) tmp = 0 if t <= -1.35e+29: tmp = x elif t <= -1.35e-246: tmp = t_1 elif t <= 1.48e-71: tmp = x / (-t / y) elif t <= 2.2e+190: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) tmp = 0.0 if (t <= -1.35e+29) tmp = x; elseif (t <= -1.35e-246) tmp = t_1; elseif (t <= 1.48e-71) tmp = Float64(x / Float64(Float64(-t) / y)); elseif (t <= 2.2e+190) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); tmp = 0.0; if (t <= -1.35e+29) tmp = x; elseif (t <= -1.35e-246) tmp = t_1; elseif (t <= 1.48e-71) tmp = x / (-t / y); elseif (t <= 2.2e+190) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.35e+29], x, If[LessEqual[t, -1.35e-246], t$95$1, If[LessEqual[t, 1.48e-71], N[(x / N[((-t) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.2e+190], t$95$1, x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
\mathbf{if}\;t \leq -1.35 \cdot 10^{+29}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -1.35 \cdot 10^{-246}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.48 \cdot 10^{-71}:\\
\;\;\;\;\frac{x}{\frac{-t}{y}}\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{+190}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.35e29 or 2.2e190 < t Initial program 88.3%
associate-*l/97.6%
Simplified97.6%
Taylor expanded in y around 0 68.8%
if -1.35e29 < t < -1.3499999999999999e-246 or 1.4799999999999999e-71 < t < 2.2e190Initial program 94.4%
associate-*l/96.1%
Simplified96.1%
Taylor expanded in y around inf 78.4%
Taylor expanded in z around inf 61.4%
if -1.3499999999999999e-246 < t < 1.4799999999999999e-71Initial program 96.9%
associate-*l/95.4%
Simplified95.4%
Taylor expanded in x around inf 72.2%
mul-1-neg72.2%
unsub-neg72.2%
Simplified72.2%
Taylor expanded in y around inf 57.5%
associate-*r/60.5%
*-commutative60.5%
associate-*l/57.5%
associate-*r/52.9%
neg-mul-152.9%
distribute-rgt-neg-in52.9%
distribute-neg-frac52.9%
Simplified52.9%
associate-*r/57.5%
add-sqr-sqrt28.0%
sqrt-unprod28.3%
sqr-neg28.3%
sqrt-unprod2.2%
add-sqr-sqrt4.6%
*-commutative4.6%
associate-/l*4.7%
frac-2neg4.7%
add-sqr-sqrt2.4%
sqrt-unprod28.6%
sqr-neg28.6%
sqrt-unprod29.6%
add-sqr-sqrt60.5%
Applied egg-rr60.5%
Final simplification63.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.4e+25) (not (<= y 160.0))) (* y (/ (- z x) t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.4e+25) || !(y <= 160.0)) {
tmp = y * ((z - x) / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-3.4d+25)) .or. (.not. (y <= 160.0d0))) then
tmp = y * ((z - x) / t)
else
tmp = x * (1.0d0 - (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.4e+25) || !(y <= 160.0)) {
tmp = y * ((z - x) / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.4e+25) or not (y <= 160.0): tmp = y * ((z - x) / t) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.4e+25) || !(y <= 160.0)) tmp = Float64(y * Float64(Float64(z - x) / t)); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.4e+25) || ~((y <= 160.0))) tmp = y * ((z - x) / t); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.4e+25], N[Not[LessEqual[y, 160.0]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+25} \lor \neg \left(y \leq 160\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if y < -3.39999999999999984e25 or 160 < y Initial program 89.1%
associate-*l/96.2%
Simplified96.2%
Taylor expanded in y around inf 86.2%
Taylor expanded in z around 0 75.0%
+-commutative75.0%
associate-*r/80.1%
mul-1-neg80.1%
associate-*r/79.5%
*-commutative79.5%
associate-*l/80.1%
associate-*r/82.3%
distribute-rgt-neg-in82.3%
*-rgt-identity82.3%
distribute-lft-out86.2%
distribute-lft-neg-in86.2%
cancel-sign-sub-inv86.2%
*-rgt-identity86.2%
div-sub86.9%
Simplified86.9%
if -3.39999999999999984e25 < y < 160Initial program 96.8%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in x around inf 70.7%
mul-1-neg70.7%
unsub-neg70.7%
Simplified70.7%
Final simplification78.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.4e+115) (not (<= x 1.1e+27))) (* x (- 1.0 (/ y t))) (+ x (* (/ y t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.4e+115) || !(x <= 1.1e+27)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((y / t) * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-4.4d+115)) .or. (.not. (x <= 1.1d+27))) then
tmp = x * (1.0d0 - (y / t))
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 tmp;
if ((x <= -4.4e+115) || !(x <= 1.1e+27)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((y / t) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.4e+115) or not (x <= 1.1e+27): tmp = x * (1.0 - (y / t)) else: tmp = x + ((y / t) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.4e+115) || !(x <= 1.1e+27)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(Float64(y / t) * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.4e+115) || ~((x <= 1.1e+27))) tmp = x * (1.0 - (y / t)); else tmp = x + ((y / t) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.4e+115], N[Not[LessEqual[x, 1.1e+27]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{+115} \lor \neg \left(x \leq 1.1 \cdot 10^{+27}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\end{array}
\end{array}
if x < -4.4000000000000001e115 or 1.0999999999999999e27 < x Initial program 93.3%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around inf 95.0%
mul-1-neg95.0%
unsub-neg95.0%
Simplified95.0%
if -4.4000000000000001e115 < x < 1.0999999999999999e27Initial program 92.7%
associate-*l/94.3%
Simplified94.3%
Taylor expanded in z around inf 81.8%
associate-*l/86.1%
*-commutative86.1%
Simplified86.1%
Final simplification89.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.2e-63) (not (<= t 3.55e-72))) (+ x (/ y (/ t z))) (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.2e-63) || !(t <= 3.55e-72)) {
tmp = x + (y / (t / z));
} else {
tmp = (y * (z - x)) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-3.2d-63)) .or. (.not. (t <= 3.55d-72))) then
tmp = x + (y / (t / z))
else
tmp = (y * (z - x)) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.2e-63) || !(t <= 3.55e-72)) {
tmp = x + (y / (t / z));
} else {
tmp = (y * (z - x)) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.2e-63) or not (t <= 3.55e-72): tmp = x + (y / (t / z)) else: tmp = (y * (z - x)) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.2e-63) || !(t <= 3.55e-72)) tmp = Float64(x + Float64(y / Float64(t / z))); else tmp = Float64(Float64(y * Float64(z - x)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.2e-63) || ~((t <= 3.55e-72))) tmp = x + (y / (t / z)); else tmp = (y * (z - x)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.2e-63], N[Not[LessEqual[t, 3.55e-72]], $MachinePrecision]], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{-63} \lor \neg \left(t \leq 3.55 \cdot 10^{-72}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(z - x\right)}{t}\\
\end{array}
\end{array}
if t < -3.19999999999999989e-63 or 3.5499999999999998e-72 < t Initial program 90.9%
associate-/l*99.3%
Simplified99.3%
Taylor expanded in z around inf 89.5%
if -3.19999999999999989e-63 < t < 3.5499999999999998e-72Initial program 96.1%
associate-*l/95.1%
Simplified95.1%
Taylor expanded in y around inf 81.3%
Taylor expanded in t around 0 87.6%
Final simplification88.8%
(FPCore (x y z t) :precision binary64 (if (<= t -2.1e+30) x (if (<= t 2.2e+190) (* y (/ z t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.1e+30) {
tmp = x;
} else if (t <= 2.2e+190) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-2.1d+30)) then
tmp = x
else if (t <= 2.2d+190) then
tmp = y * (z / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.1e+30) {
tmp = x;
} else if (t <= 2.2e+190) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.1e+30: tmp = x elif t <= 2.2e+190: tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.1e+30) tmp = x; elseif (t <= 2.2e+190) tmp = Float64(y * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.1e+30) tmp = x; elseif (t <= 2.2e+190) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.1e+30], x, If[LessEqual[t, 2.2e+190], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{+30}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{+190}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -2.1e30 or 2.2e190 < t Initial program 88.3%
associate-*l/97.6%
Simplified97.6%
Taylor expanded in y around 0 68.8%
if -2.1e30 < t < 2.2e190Initial program 95.4%
associate-*l/95.9%
Simplified95.9%
Taylor expanded in y around inf 78.0%
Taylor expanded in z around inf 56.4%
Final simplification60.7%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 92.9%
associate-*l/96.5%
Simplified96.5%
Taylor expanded in y around 0 35.4%
Final simplification35.4%
(FPCore (x y z t) :precision binary64 (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x - ((x * (y / t)) + (-z * (y / t)))
end function
public static double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
def code(x, y, z, t): return x - ((x * (y / t)) + (-z * (y / t)))
function code(x, y, z, t) return Float64(x - Float64(Float64(x * Float64(y / t)) + Float64(Float64(-z) * Float64(y / t)))) end
function tmp = code(x, y, z, t) tmp = x - ((x * (y / t)) + (-z * (y / t))); end
code[x_, y_, z_, t_] := N[(x - N[(N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision] + N[((-z) * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)
\end{array}
herbie shell --seed 2024034
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:herbie-target
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))