
(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 96.4%
Taylor expanded in z around 0 91.7%
+-commutative91.7%
*-commutative91.7%
associate-*r/92.3%
mul-1-neg92.3%
associate-/l*91.8%
distribute-lft-neg-in91.8%
distribute-rgt-in98.1%
sub-neg98.1%
Simplified98.1%
Final simplification98.1%
(FPCore (x y z t)
:precision binary64
(if (<= x -7.2e+92)
x
(if (<= x -5.4e+74)
(* y (/ z t))
(if (<= x -2.8e-68)
x
(if (<= x 7.9e-25)
(* (/ y t) z)
(if (<= x 8.1e+191) x (* x (/ y (- t)))))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.2e+92) {
tmp = x;
} else if (x <= -5.4e+74) {
tmp = y * (z / t);
} else if (x <= -2.8e-68) {
tmp = x;
} else if (x <= 7.9e-25) {
tmp = (y / t) * z;
} else if (x <= 8.1e+191) {
tmp = x;
} else {
tmp = x * (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 (x <= (-7.2d+92)) then
tmp = x
else if (x <= (-5.4d+74)) then
tmp = y * (z / t)
else if (x <= (-2.8d-68)) then
tmp = x
else if (x <= 7.9d-25) then
tmp = (y / t) * z
else if (x <= 8.1d+191) then
tmp = x
else
tmp = x * (y / -t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.2e+92) {
tmp = x;
} else if (x <= -5.4e+74) {
tmp = y * (z / t);
} else if (x <= -2.8e-68) {
tmp = x;
} else if (x <= 7.9e-25) {
tmp = (y / t) * z;
} else if (x <= 8.1e+191) {
tmp = x;
} else {
tmp = x * (y / -t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7.2e+92: tmp = x elif x <= -5.4e+74: tmp = y * (z / t) elif x <= -2.8e-68: tmp = x elif x <= 7.9e-25: tmp = (y / t) * z elif x <= 8.1e+191: tmp = x else: tmp = x * (y / -t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7.2e+92) tmp = x; elseif (x <= -5.4e+74) tmp = Float64(y * Float64(z / t)); elseif (x <= -2.8e-68) tmp = x; elseif (x <= 7.9e-25) tmp = Float64(Float64(y / t) * z); elseif (x <= 8.1e+191) tmp = x; else tmp = Float64(x * Float64(y / Float64(-t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7.2e+92) tmp = x; elseif (x <= -5.4e+74) tmp = y * (z / t); elseif (x <= -2.8e-68) tmp = x; elseif (x <= 7.9e-25) tmp = (y / t) * z; elseif (x <= 8.1e+191) tmp = x; else tmp = x * (y / -t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7.2e+92], x, If[LessEqual[x, -5.4e+74], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.8e-68], x, If[LessEqual[x, 7.9e-25], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[x, 8.1e+191], x, N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+92}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -5.4 \cdot 10^{+74}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;x \leq -2.8 \cdot 10^{-68}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 7.9 \cdot 10^{-25}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\mathbf{elif}\;x \leq 8.1 \cdot 10^{+191}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{-t}\\
\end{array}
\end{array}
if x < -7.2e92 or -5.3999999999999996e74 < x < -2.8000000000000001e-68 or 7.8999999999999997e-25 < x < 8.1000000000000002e191Initial program 96.7%
Taylor expanded in y around 0 52.8%
if -7.2e92 < x < -5.3999999999999996e74Initial program 100.0%
Taylor expanded in y around -inf 100.0%
Taylor expanded in z around inf 84.5%
associate-/l*84.5%
Simplified84.5%
if -2.8000000000000001e-68 < x < 7.8999999999999997e-25Initial program 96.0%
Taylor expanded in y around -inf 75.8%
Taylor expanded in z around inf 67.2%
add-log-exp30.3%
*-un-lft-identity30.3%
log-prod30.3%
metadata-eval30.3%
add-log-exp67.2%
associate-/l*65.7%
Applied egg-rr65.7%
+-lft-identity65.7%
*-commutative65.7%
associate-*l/67.2%
associate-*r/69.5%
Simplified69.5%
if 8.1000000000000002e191 < x Initial program 95.7%
Taylor expanded in y around -inf 67.5%
Taylor expanded in z around 0 63.0%
mul-1-neg63.0%
associate-/l*63.0%
distribute-rgt-neg-in63.0%
mul-1-neg63.0%
associate-*r/63.0%
mul-1-neg63.0%
Simplified63.0%
Final simplification61.7%
(FPCore (x y z t)
:precision binary64
(if (<= x -1.55e+92)
x
(if (<= x -7.6e+74)
(* y (/ z t))
(if (<= x -1.16e-68)
x
(if (<= x 1.25e-23)
(* (/ y t) z)
(if (<= x 1.18e+201) x (/ (* x (- y)) t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.55e+92) {
tmp = x;
} else if (x <= -7.6e+74) {
tmp = y * (z / t);
} else if (x <= -1.16e-68) {
tmp = x;
} else if (x <= 1.25e-23) {
tmp = (y / t) * z;
} else if (x <= 1.18e+201) {
tmp = x;
} else {
tmp = (x * -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 (x <= (-1.55d+92)) then
tmp = x
else if (x <= (-7.6d+74)) then
tmp = y * (z / t)
else if (x <= (-1.16d-68)) then
tmp = x
else if (x <= 1.25d-23) then
tmp = (y / t) * z
else if (x <= 1.18d+201) then
tmp = x
else
tmp = (x * -y) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.55e+92) {
tmp = x;
} else if (x <= -7.6e+74) {
tmp = y * (z / t);
} else if (x <= -1.16e-68) {
tmp = x;
} else if (x <= 1.25e-23) {
tmp = (y / t) * z;
} else if (x <= 1.18e+201) {
tmp = x;
} else {
tmp = (x * -y) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.55e+92: tmp = x elif x <= -7.6e+74: tmp = y * (z / t) elif x <= -1.16e-68: tmp = x elif x <= 1.25e-23: tmp = (y / t) * z elif x <= 1.18e+201: tmp = x else: tmp = (x * -y) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.55e+92) tmp = x; elseif (x <= -7.6e+74) tmp = Float64(y * Float64(z / t)); elseif (x <= -1.16e-68) tmp = x; elseif (x <= 1.25e-23) tmp = Float64(Float64(y / t) * z); elseif (x <= 1.18e+201) tmp = x; else tmp = Float64(Float64(x * Float64(-y)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.55e+92) tmp = x; elseif (x <= -7.6e+74) tmp = y * (z / t); elseif (x <= -1.16e-68) tmp = x; elseif (x <= 1.25e-23) tmp = (y / t) * z; elseif (x <= 1.18e+201) tmp = x; else tmp = (x * -y) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.55e+92], x, If[LessEqual[x, -7.6e+74], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.16e-68], x, If[LessEqual[x, 1.25e-23], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[x, 1.18e+201], x, N[(N[(x * (-y)), $MachinePrecision] / t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{+92}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -7.6 \cdot 10^{+74}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;x \leq -1.16 \cdot 10^{-68}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-23}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\mathbf{elif}\;x \leq 1.18 \cdot 10^{+201}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(-y\right)}{t}\\
\end{array}
\end{array}
if x < -1.5500000000000001e92 or -7.5999999999999997e74 < x < -1.1599999999999999e-68 or 1.2500000000000001e-23 < x < 1.18e201Initial program 96.7%
Taylor expanded in y around 0 52.8%
if -1.5500000000000001e92 < x < -7.5999999999999997e74Initial program 100.0%
Taylor expanded in y around -inf 100.0%
Taylor expanded in z around inf 84.5%
associate-/l*84.5%
Simplified84.5%
if -1.1599999999999999e-68 < x < 1.2500000000000001e-23Initial program 96.0%
Taylor expanded in y around -inf 75.8%
Taylor expanded in z around inf 67.2%
add-log-exp30.3%
*-un-lft-identity30.3%
log-prod30.3%
metadata-eval30.3%
add-log-exp67.2%
associate-/l*65.7%
Applied egg-rr65.7%
+-lft-identity65.7%
*-commutative65.7%
associate-*l/67.2%
associate-*r/69.5%
Simplified69.5%
if 1.18e201 < x Initial program 95.7%
Taylor expanded in y around -inf 67.5%
Taylor expanded in z around 0 63.0%
mul-1-neg63.0%
distribute-lft-neg-out63.0%
*-commutative63.0%
Simplified63.0%
Final simplification61.7%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -1.5e+138)
(not (or (<= z -6e+32) (and (not (<= z -2.35e-36)) (<= z 7.4e+80)))))
(* (/ y t) (- z x))
(* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.5e+138) || !((z <= -6e+32) || (!(z <= -2.35e-36) && (z <= 7.4e+80)))) {
tmp = (y / t) * (z - x);
} 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 ((z <= (-1.5d+138)) .or. (.not. (z <= (-6d+32)) .or. (.not. (z <= (-2.35d-36))) .and. (z <= 7.4d+80))) then
tmp = (y / t) * (z - x)
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 ((z <= -1.5e+138) || !((z <= -6e+32) || (!(z <= -2.35e-36) && (z <= 7.4e+80)))) {
tmp = (y / t) * (z - x);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.5e+138) or not ((z <= -6e+32) or (not (z <= -2.35e-36) and (z <= 7.4e+80))): tmp = (y / t) * (z - x) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.5e+138) || !((z <= -6e+32) || (!(z <= -2.35e-36) && (z <= 7.4e+80)))) tmp = Float64(Float64(y / t) * Float64(z - x)); 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 ((z <= -1.5e+138) || ~(((z <= -6e+32) || (~((z <= -2.35e-36)) && (z <= 7.4e+80))))) tmp = (y / t) * (z - x); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.5e+138], N[Not[Or[LessEqual[z, -6e+32], And[N[Not[LessEqual[z, -2.35e-36]], $MachinePrecision], LessEqual[z, 7.4e+80]]]], $MachinePrecision]], N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+138} \lor \neg \left(z \leq -6 \cdot 10^{+32} \lor \neg \left(z \leq -2.35 \cdot 10^{-36}\right) \land z \leq 7.4 \cdot 10^{+80}\right):\\
\;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -1.50000000000000005e138 or -6e32 < z < -2.3500000000000001e-36 or 7.39999999999999992e80 < z Initial program 94.5%
Taylor expanded in y around -inf 76.5%
Taylor expanded in z around 0 68.0%
+-commutative86.0%
*-commutative86.0%
associate-*r/89.8%
mul-1-neg89.8%
associate-/l*86.9%
distribute-lft-neg-in86.9%
distribute-rgt-in99.2%
sub-neg99.2%
Simplified80.3%
if -1.50000000000000005e138 < z < -6e32 or -2.3500000000000001e-36 < z < 7.39999999999999992e80Initial program 97.7%
Taylor expanded in x around inf 85.6%
mul-1-neg85.6%
unsub-neg85.6%
Simplified85.6%
Final simplification83.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ y t)))))
(if (<= x -8.8e+95)
t_1
(if (<= x -2.1e+74)
(* (/ y t) (- z x))
(if (or (<= x -3.2e+39) (not (<= x 7.4e+61)))
t_1
(+ x (* y (/ z t))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / t));
double tmp;
if (x <= -8.8e+95) {
tmp = t_1;
} else if (x <= -2.1e+74) {
tmp = (y / t) * (z - x);
} else if ((x <= -3.2e+39) || !(x <= 7.4e+61)) {
tmp = t_1;
} else {
tmp = x + (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) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (y / t))
if (x <= (-8.8d+95)) then
tmp = t_1
else if (x <= (-2.1d+74)) then
tmp = (y / t) * (z - x)
else if ((x <= (-3.2d+39)) .or. (.not. (x <= 7.4d+61))) then
tmp = t_1
else
tmp = x + (y * (z / t))
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 <= -8.8e+95) {
tmp = t_1;
} else if (x <= -2.1e+74) {
tmp = (y / t) * (z - x);
} else if ((x <= -3.2e+39) || !(x <= 7.4e+61)) {
tmp = t_1;
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / t)) tmp = 0 if x <= -8.8e+95: tmp = t_1 elif x <= -2.1e+74: tmp = (y / t) * (z - x) elif (x <= -3.2e+39) or not (x <= 7.4e+61): tmp = t_1 else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / t))) tmp = 0.0 if (x <= -8.8e+95) tmp = t_1; elseif (x <= -2.1e+74) tmp = Float64(Float64(y / t) * Float64(z - x)); elseif ((x <= -3.2e+39) || !(x <= 7.4e+61)) tmp = t_1; else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / t)); tmp = 0.0; if (x <= -8.8e+95) tmp = t_1; elseif (x <= -2.1e+74) tmp = (y / t) * (z - x); elseif ((x <= -3.2e+39) || ~((x <= 7.4e+61))) tmp = t_1; else tmp = x + (y * (z / t)); 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, -8.8e+95], t$95$1, If[LessEqual[x, -2.1e+74], N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -3.2e+39], N[Not[LessEqual[x, 7.4e+61]], $MachinePrecision]], t$95$1, N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{if}\;x \leq -8.8 \cdot 10^{+95}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.1 \cdot 10^{+74}:\\
\;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\
\mathbf{elif}\;x \leq -3.2 \cdot 10^{+39} \lor \neg \left(x \leq 7.4 \cdot 10^{+61}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -8.7999999999999996e95 or -2.0999999999999999e74 < x < -3.19999999999999993e39 or 7.40000000000000005e61 < x Initial program 95.8%
Taylor expanded in x around inf 93.6%
mul-1-neg93.6%
unsub-neg93.6%
Simplified93.6%
if -8.7999999999999996e95 < x < -2.0999999999999999e74Initial program 100.0%
Taylor expanded in y around -inf 100.0%
Taylor expanded in z around 0 100.0%
+-commutative100.0%
*-commutative100.0%
associate-*r/100.0%
mul-1-neg100.0%
associate-/l*100.0%
distribute-lft-neg-in100.0%
distribute-rgt-in100.0%
sub-neg100.0%
Simplified100.0%
if -3.19999999999999993e39 < x < 7.40000000000000005e61Initial program 96.6%
Taylor expanded in z around inf 86.1%
associate-/l*55.4%
Simplified85.0%
Final simplification88.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ y t) z)) (t_2 (* x (- 1.0 (/ y t)))))
(if (<= z -1.56e+156)
t_1
(if (<= z -1.15e+26)
t_2
(if (<= z -3.6e-36) (* y (/ z t)) (if (<= z 3.2e+82) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (y / t) * z;
double t_2 = x * (1.0 - (y / t));
double tmp;
if (z <= -1.56e+156) {
tmp = t_1;
} else if (z <= -1.15e+26) {
tmp = t_2;
} else if (z <= -3.6e-36) {
tmp = y * (z / t);
} else if (z <= 3.2e+82) {
tmp = t_2;
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_1 = (y / t) * z
t_2 = x * (1.0d0 - (y / t))
if (z <= (-1.56d+156)) then
tmp = t_1
else if (z <= (-1.15d+26)) then
tmp = t_2
else if (z <= (-3.6d-36)) then
tmp = y * (z / t)
else if (z <= 3.2d+82) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y / t) * z;
double t_2 = x * (1.0 - (y / t));
double tmp;
if (z <= -1.56e+156) {
tmp = t_1;
} else if (z <= -1.15e+26) {
tmp = t_2;
} else if (z <= -3.6e-36) {
tmp = y * (z / t);
} else if (z <= 3.2e+82) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / t) * z t_2 = x * (1.0 - (y / t)) tmp = 0 if z <= -1.56e+156: tmp = t_1 elif z <= -1.15e+26: tmp = t_2 elif z <= -3.6e-36: tmp = y * (z / t) elif z <= 3.2e+82: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / t) * z) t_2 = Float64(x * Float64(1.0 - Float64(y / t))) tmp = 0.0 if (z <= -1.56e+156) tmp = t_1; elseif (z <= -1.15e+26) tmp = t_2; elseif (z <= -3.6e-36) tmp = Float64(y * Float64(z / t)); elseif (z <= 3.2e+82) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / t) * z; t_2 = x * (1.0 - (y / t)); tmp = 0.0; if (z <= -1.56e+156) tmp = t_1; elseif (z <= -1.15e+26) tmp = t_2; elseif (z <= -3.6e-36) tmp = y * (z / t); elseif (z <= 3.2e+82) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.56e+156], t$95$1, If[LessEqual[z, -1.15e+26], t$95$2, If[LessEqual[z, -3.6e-36], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e+82], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{t} \cdot z\\
t_2 := x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{if}\;z \leq -1.56 \cdot 10^{+156}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.15 \cdot 10^{+26}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{-36}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{+82}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.55999999999999992e156 or 3.19999999999999975e82 < z Initial program 94.2%
Taylor expanded in y around -inf 75.9%
Taylor expanded in z around inf 74.5%
add-log-exp43.2%
*-un-lft-identity43.2%
log-prod43.2%
metadata-eval43.2%
add-log-exp74.5%
associate-/l*71.0%
Applied egg-rr71.0%
+-lft-identity71.0%
*-commutative71.0%
associate-*l/74.5%
associate-*r/78.2%
Simplified78.2%
if -1.55999999999999992e156 < z < -1.15e26 or -3.60000000000000032e-36 < z < 3.19999999999999975e82Initial program 97.2%
Taylor expanded in x around inf 83.9%
mul-1-neg83.9%
unsub-neg83.9%
Simplified83.9%
if -1.15e26 < z < -3.60000000000000032e-36Initial program 99.7%
Taylor expanded in y around -inf 86.6%
Taylor expanded in z around inf 71.6%
associate-/l*71.7%
Simplified71.7%
Final simplification81.3%
(FPCore (x y z t)
:precision binary64
(if (<= x -6.2e+91)
x
(if (or (<= x -7.6e+74) (and (not (<= x -2.75e-71)) (<= x 3e-25)))
(* y (/ z t))
x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.2e+91) {
tmp = x;
} else if ((x <= -7.6e+74) || (!(x <= -2.75e-71) && (x <= 3e-25))) {
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 (x <= (-6.2d+91)) then
tmp = x
else if ((x <= (-7.6d+74)) .or. (.not. (x <= (-2.75d-71))) .and. (x <= 3d-25)) 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 (x <= -6.2e+91) {
tmp = x;
} else if ((x <= -7.6e+74) || (!(x <= -2.75e-71) && (x <= 3e-25))) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6.2e+91: tmp = x elif (x <= -7.6e+74) or (not (x <= -2.75e-71) and (x <= 3e-25)): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6.2e+91) tmp = x; elseif ((x <= -7.6e+74) || (!(x <= -2.75e-71) && (x <= 3e-25))) 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 (x <= -6.2e+91) tmp = x; elseif ((x <= -7.6e+74) || (~((x <= -2.75e-71)) && (x <= 3e-25))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6.2e+91], x, If[Or[LessEqual[x, -7.6e+74], And[N[Not[LessEqual[x, -2.75e-71]], $MachinePrecision], LessEqual[x, 3e-25]]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+91}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -7.6 \cdot 10^{+74} \lor \neg \left(x \leq -2.75 \cdot 10^{-71}\right) \land x \leq 3 \cdot 10^{-25}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.19999999999999995e91 or -7.5999999999999997e74 < x < -2.7499999999999999e-71 or 2.9999999999999998e-25 < x Initial program 96.5%
Taylor expanded in y around 0 49.3%
if -6.19999999999999995e91 < x < -7.5999999999999997e74 or -2.7499999999999999e-71 < x < 2.9999999999999998e-25Initial program 96.2%
Taylor expanded in y around -inf 77.0%
Taylor expanded in z around inf 68.1%
associate-/l*66.7%
Simplified66.7%
Final simplification57.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ y t) z)))
(if (<= z -1.3e+138)
t_1
(if (<= z -2.55e+33)
x
(if (<= z -1.75e-66) (* y (/ z t)) (if (<= z 4.5e-41) x t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (y / t) * z;
double tmp;
if (z <= -1.3e+138) {
tmp = t_1;
} else if (z <= -2.55e+33) {
tmp = x;
} else if (z <= -1.75e-66) {
tmp = y * (z / t);
} else if (z <= 4.5e-41) {
tmp = x;
} else {
tmp = t_1;
}
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 / t) * z
if (z <= (-1.3d+138)) then
tmp = t_1
else if (z <= (-2.55d+33)) then
tmp = x
else if (z <= (-1.75d-66)) then
tmp = y * (z / t)
else if (z <= 4.5d-41) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y / t) * z;
double tmp;
if (z <= -1.3e+138) {
tmp = t_1;
} else if (z <= -2.55e+33) {
tmp = x;
} else if (z <= -1.75e-66) {
tmp = y * (z / t);
} else if (z <= 4.5e-41) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / t) * z tmp = 0 if z <= -1.3e+138: tmp = t_1 elif z <= -2.55e+33: tmp = x elif z <= -1.75e-66: tmp = y * (z / t) elif z <= 4.5e-41: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / t) * z) tmp = 0.0 if (z <= -1.3e+138) tmp = t_1; elseif (z <= -2.55e+33) tmp = x; elseif (z <= -1.75e-66) tmp = Float64(y * Float64(z / t)); elseif (z <= 4.5e-41) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / t) * z; tmp = 0.0; if (z <= -1.3e+138) tmp = t_1; elseif (z <= -2.55e+33) tmp = x; elseif (z <= -1.75e-66) tmp = y * (z / t); elseif (z <= 4.5e-41) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1.3e+138], t$95$1, If[LessEqual[z, -2.55e+33], x, If[LessEqual[z, -1.75e-66], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.5e-41], x, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{t} \cdot z\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{+138}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.55 \cdot 10^{+33}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -1.75 \cdot 10^{-66}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-41}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.3e138 or 4.5e-41 < z Initial program 94.8%
Taylor expanded in y around -inf 73.9%
Taylor expanded in z around inf 66.7%
add-log-exp38.6%
*-un-lft-identity38.6%
log-prod38.6%
metadata-eval38.6%
add-log-exp66.7%
associate-/l*63.2%
Applied egg-rr63.2%
+-lft-identity63.2%
*-commutative63.2%
associate-*l/66.7%
associate-*r/69.5%
Simplified69.5%
if -1.3e138 < z < -2.5499999999999999e33 or -1.75e-66 < z < 4.5e-41Initial program 97.2%
Taylor expanded in y around 0 53.0%
if -2.5499999999999999e33 < z < -1.75e-66Initial program 99.8%
Taylor expanded in y around -inf 87.0%
Taylor expanded in z around inf 60.6%
associate-/l*60.6%
Simplified60.6%
Final simplification60.8%
(FPCore (x y z t) :precision binary64 (if (<= t -2.8e-78) (+ x (/ y (/ t z))) (if (<= t 1.65e+16) (/ (* y (- z x)) t) (+ x (* y (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.8e-78) {
tmp = x + (y / (t / z));
} else if (t <= 1.65e+16) {
tmp = (y * (z - x)) / t;
} else {
tmp = x + (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 (t <= (-2.8d-78)) then
tmp = x + (y / (t / z))
else if (t <= 1.65d+16) then
tmp = (y * (z - x)) / t
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.8e-78) {
tmp = x + (y / (t / z));
} else if (t <= 1.65e+16) {
tmp = (y * (z - x)) / t;
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.8e-78: tmp = x + (y / (t / z)) elif t <= 1.65e+16: tmp = (y * (z - x)) / t else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.8e-78) tmp = Float64(x + Float64(y / Float64(t / z))); elseif (t <= 1.65e+16) tmp = Float64(Float64(y * Float64(z - x)) / t); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.8e-78) tmp = x + (y / (t / z)); elseif (t <= 1.65e+16) tmp = (y * (z - x)) / t; else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.8e-78], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.65e+16], N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{-78}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{+16}:\\
\;\;\;\;\frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if t < -2.80000000000000024e-78Initial program 93.8%
Taylor expanded in z around inf 84.0%
associate-/l*34.7%
Simplified87.2%
clear-num87.2%
un-div-inv87.3%
Applied egg-rr87.3%
if -2.80000000000000024e-78 < t < 1.65e16Initial program 99.9%
Taylor expanded in y around -inf 84.6%
if 1.65e16 < t Initial program 90.0%
Taylor expanded in z around inf 87.9%
associate-/l*29.7%
Simplified91.5%
Final simplification86.6%
(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 96.4%
Taylor expanded in y around 0 36.7%
Final simplification36.7%
(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 2024066
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:alt
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))