
(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 11 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 (/ (- z x) (/ t y))))
double code(double x, double y, double z, double t) {
return x + ((z - x) / (t / y));
}
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 + ((z - x) / (t / y))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) / (t / y));
}
def code(x, y, z, t): return x + ((z - x) / (t / y))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) / Float64(t / y))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) / (t / y)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z - x}{\frac{t}{y}}
\end{array}
Initial program 92.5%
associate-*l/98.4%
Simplified98.4%
*-commutative98.4%
clear-num98.3%
un-div-inv98.5%
Applied egg-rr98.5%
Final simplification98.5%
(FPCore (x y z t)
:precision binary64
(if (<= x -2.45e+294)
x
(if (<= x -3.8e+177)
(* (/ x t) (- y))
(if (<= x -5.4e+39) x (if (<= x 1.8e-13) (* z (/ y t)) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.45e+294) {
tmp = x;
} else if (x <= -3.8e+177) {
tmp = (x / t) * -y;
} else if (x <= -5.4e+39) {
tmp = x;
} else if (x <= 1.8e-13) {
tmp = z * (y / 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 <= (-2.45d+294)) then
tmp = x
else if (x <= (-3.8d+177)) then
tmp = (x / t) * -y
else if (x <= (-5.4d+39)) then
tmp = x
else if (x <= 1.8d-13) then
tmp = z * (y / 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 <= -2.45e+294) {
tmp = x;
} else if (x <= -3.8e+177) {
tmp = (x / t) * -y;
} else if (x <= -5.4e+39) {
tmp = x;
} else if (x <= 1.8e-13) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.45e+294: tmp = x elif x <= -3.8e+177: tmp = (x / t) * -y elif x <= -5.4e+39: tmp = x elif x <= 1.8e-13: tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.45e+294) tmp = x; elseif (x <= -3.8e+177) tmp = Float64(Float64(x / t) * Float64(-y)); elseif (x <= -5.4e+39) tmp = x; elseif (x <= 1.8e-13) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.45e+294) tmp = x; elseif (x <= -3.8e+177) tmp = (x / t) * -y; elseif (x <= -5.4e+39) tmp = x; elseif (x <= 1.8e-13) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.45e+294], x, If[LessEqual[x, -3.8e+177], N[(N[(x / t), $MachinePrecision] * (-y)), $MachinePrecision], If[LessEqual[x, -5.4e+39], x, If[LessEqual[x, 1.8e-13], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.45 \cdot 10^{+294}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -3.8 \cdot 10^{+177}:\\
\;\;\;\;\frac{x}{t} \cdot \left(-y\right)\\
\mathbf{elif}\;x \leq -5.4 \cdot 10^{+39}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-13}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.4499999999999999e294 or -3.7999999999999998e177 < x < -5.40000000000000007e39 or 1.7999999999999999e-13 < x Initial program 93.7%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 62.4%
if -2.4499999999999999e294 < x < -3.7999999999999998e177Initial program 92.6%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around inf 63.1%
Taylor expanded in z around 0 70.5%
associate-*r/70.5%
neg-mul-170.5%
Simplified70.5%
if -5.40000000000000007e39 < x < 1.7999999999999999e-13Initial program 91.3%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in y around inf 73.5%
Taylor expanded in z around inf 59.7%
clear-num59.6%
un-div-inv59.9%
Applied egg-rr59.9%
associate-/r/62.0%
Applied egg-rr62.0%
Final simplification63.1%
(FPCore (x y z t)
:precision binary64
(if (<= x -6.2e+293)
x
(if (<= x -1.2e+177)
(* x (/ (- y) t))
(if (<= x -1.35e+40) x (if (<= x 9.4e-14) (* z (/ y t)) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.2e+293) {
tmp = x;
} else if (x <= -1.2e+177) {
tmp = x * (-y / t);
} else if (x <= -1.35e+40) {
tmp = x;
} else if (x <= 9.4e-14) {
tmp = z * (y / 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+293)) then
tmp = x
else if (x <= (-1.2d+177)) then
tmp = x * (-y / t)
else if (x <= (-1.35d+40)) then
tmp = x
else if (x <= 9.4d-14) then
tmp = z * (y / 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+293) {
tmp = x;
} else if (x <= -1.2e+177) {
tmp = x * (-y / t);
} else if (x <= -1.35e+40) {
tmp = x;
} else if (x <= 9.4e-14) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6.2e+293: tmp = x elif x <= -1.2e+177: tmp = x * (-y / t) elif x <= -1.35e+40: tmp = x elif x <= 9.4e-14: tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6.2e+293) tmp = x; elseif (x <= -1.2e+177) tmp = Float64(x * Float64(Float64(-y) / t)); elseif (x <= -1.35e+40) tmp = x; elseif (x <= 9.4e-14) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -6.2e+293) tmp = x; elseif (x <= -1.2e+177) tmp = x * (-y / t); elseif (x <= -1.35e+40) tmp = x; elseif (x <= 9.4e-14) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6.2e+293], x, If[LessEqual[x, -1.2e+177], N[(x * N[((-y) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.35e+40], x, If[LessEqual[x, 9.4e-14], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+293}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{+177}:\\
\;\;\;\;x \cdot \frac{-y}{t}\\
\mathbf{elif}\;x \leq -1.35 \cdot 10^{+40}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 9.4 \cdot 10^{-14}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.1999999999999998e293 or -1.2e177 < x < -1.35000000000000005e40 or 9.4000000000000003e-14 < x Initial program 93.7%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 62.4%
if -6.1999999999999998e293 < x < -1.2e177Initial program 92.6%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in y around inf 63.1%
Taylor expanded in z around 0 70.5%
associate-*r/70.5%
neg-mul-170.5%
Simplified70.5%
frac-2neg70.5%
remove-double-neg70.5%
associate-*r/70.6%
Applied egg-rr70.6%
frac-2neg70.6%
*-commutative70.6%
distribute-lft-neg-in70.6%
remove-double-neg70.6%
associate-*r/70.7%
*-commutative70.7%
Applied egg-rr70.7%
if -1.35000000000000005e40 < x < 9.4000000000000003e-14Initial program 91.3%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in y around inf 73.5%
Taylor expanded in z around inf 59.7%
clear-num59.6%
un-div-inv59.9%
Applied egg-rr59.9%
associate-/r/62.0%
Applied egg-rr62.0%
Final simplification63.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.2e-78) (not (<= y 1.2e-82))) (* y (/ (- z x) t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.2e-78) || !(y <= 1.2e-82)) {
tmp = y * ((z - x) / 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 ((y <= (-3.2d-78)) .or. (.not. (y <= 1.2d-82))) then
tmp = y * ((z - x) / 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 ((y <= -3.2e-78) || !(y <= 1.2e-82)) {
tmp = y * ((z - x) / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.2e-78) or not (y <= 1.2e-82): tmp = y * ((z - x) / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.2e-78) || !(y <= 1.2e-82)) tmp = Float64(y * Float64(Float64(z - x) / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.2e-78) || ~((y <= 1.2e-82))) tmp = y * ((z - x) / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.2e-78], N[Not[LessEqual[y, 1.2e-82]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{-78} \lor \neg \left(y \leq 1.2 \cdot 10^{-82}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.2e-78 or 1.20000000000000004e-82 < y Initial program 89.1%
associate-*l/98.6%
Simplified98.6%
Taylor expanded in y around inf 75.2%
Taylor expanded in z around 0 75.2%
+-commutative75.2%
mul-1-neg75.2%
sub-neg75.2%
div-sub78.5%
Simplified78.5%
if -3.2e-78 < y < 1.20000000000000004e-82Initial program 97.2%
associate-*l/98.2%
Simplified98.2%
Taylor expanded in y around 0 70.2%
Final simplification75.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.2e-11) (not (<= y 2.1e-34))) (* y (/ (- z x) t)) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.2e-11) || !(y <= 2.1e-34)) {
tmp = y * ((z - x) / t);
} else {
tmp = x + (z * (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 <= (-7.2d-11)) .or. (.not. (y <= 2.1d-34))) then
tmp = y * ((z - x) / t)
else
tmp = x + (z * (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.2e-11) || !(y <= 2.1e-34)) {
tmp = y * ((z - x) / t);
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.2e-11) or not (y <= 2.1e-34): tmp = y * ((z - x) / t) else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.2e-11) || !(y <= 2.1e-34)) tmp = Float64(y * Float64(Float64(z - x) / t)); else tmp = Float64(x + Float64(z * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.2e-11) || ~((y <= 2.1e-34))) tmp = y * ((z - x) / t); else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.2e-11], N[Not[LessEqual[y, 2.1e-34]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{-11} \lor \neg \left(y \leq 2.1 \cdot 10^{-34}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -7.19999999999999969e-11 or 2.1000000000000001e-34 < y Initial program 87.8%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in y around inf 78.8%
Taylor expanded in z around 0 78.8%
+-commutative78.8%
mul-1-neg78.8%
sub-neg78.8%
div-sub81.9%
Simplified81.9%
if -7.19999999999999969e-11 < y < 2.1000000000000001e-34Initial program 97.0%
associate-*l/98.5%
Simplified98.5%
Taylor expanded in z around inf 87.3%
associate-*l/86.7%
*-commutative86.7%
Simplified86.7%
Final simplification84.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.5e-15) (not (<= y 1.55e-34))) (* y (/ (- z x) t)) (+ x (/ (* z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.5e-15) || !(y <= 1.55e-34)) {
tmp = y * ((z - x) / t);
} else {
tmp = x + ((z * 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 <= (-6.5d-15)) .or. (.not. (y <= 1.55d-34))) then
tmp = y * ((z - x) / t)
else
tmp = x + ((z * y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.5e-15) || !(y <= 1.55e-34)) {
tmp = y * ((z - x) / t);
} else {
tmp = x + ((z * y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.5e-15) or not (y <= 1.55e-34): tmp = y * ((z - x) / t) else: tmp = x + ((z * y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.5e-15) || !(y <= 1.55e-34)) tmp = Float64(y * Float64(Float64(z - x) / t)); else tmp = Float64(x + Float64(Float64(z * y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6.5e-15) || ~((y <= 1.55e-34))) tmp = y * ((z - x) / t); else tmp = x + ((z * y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.5e-15], N[Not[LessEqual[y, 1.55e-34]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{-15} \lor \neg \left(y \leq 1.55 \cdot 10^{-34}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\end{array}
\end{array}
if y < -6.49999999999999991e-15 or 1.5499999999999999e-34 < y Initial program 87.8%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in y around inf 78.8%
Taylor expanded in z around 0 78.8%
+-commutative78.8%
mul-1-neg78.8%
sub-neg78.8%
div-sub81.9%
Simplified81.9%
if -6.49999999999999991e-15 < y < 1.5499999999999999e-34Initial program 97.0%
associate-*l/98.5%
Simplified98.5%
Taylor expanded in z around inf 87.3%
Final simplification84.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.2e+63) (not (<= x 8e-12))) (- x (* x (/ y t))) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.2e+63) || !(x <= 8e-12)) {
tmp = x - (x * (y / t));
} else {
tmp = x + (z * (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 <= (-2.2d+63)) .or. (.not. (x <= 8d-12))) then
tmp = x - (x * (y / t))
else
tmp = x + (z * (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.2e+63) || !(x <= 8e-12)) {
tmp = x - (x * (y / t));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.2e+63) or not (x <= 8e-12): tmp = x - (x * (y / t)) else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.2e+63) || !(x <= 8e-12)) tmp = Float64(x - Float64(x * Float64(y / t))); else tmp = Float64(x + Float64(z * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.2e+63) || ~((x <= 8e-12))) tmp = x - (x * (y / t)); else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.2e+63], N[Not[LessEqual[x, 8e-12]], $MachinePrecision]], N[(x - N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{+63} \lor \neg \left(x \leq 8 \cdot 10^{-12}\right):\\
\;\;\;\;x - x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -2.1999999999999999e63 or 7.99999999999999984e-12 < x Initial program 93.2%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in x around inf 93.9%
distribute-lft-in93.9%
mul-1-neg93.9%
distribute-rgt-neg-in93.9%
distribute-lft-neg-out93.9%
*-rgt-identity93.9%
neg-mul-193.9%
associate-*r*93.9%
associate-*r/87.2%
mul-1-neg87.2%
unsub-neg87.2%
associate-*r/93.9%
Simplified93.9%
if -2.1999999999999999e63 < x < 7.99999999999999984e-12Initial program 91.6%
associate-*l/96.8%
Simplified96.8%
Taylor expanded in z around inf 77.5%
associate-*l/82.8%
*-commutative82.8%
Simplified82.8%
Final simplification88.5%
(FPCore (x y z t) :precision binary64 (if (<= x -2.1e+40) x (if (<= x 3.5e-14) (* y (/ z t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.1e+40) {
tmp = x;
} else if (x <= 3.5e-14) {
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 <= (-2.1d+40)) then
tmp = x
else if (x <= 3.5d-14) 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 <= -2.1e+40) {
tmp = x;
} else if (x <= 3.5e-14) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.1e+40: tmp = x elif x <= 3.5e-14: tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.1e+40) tmp = x; elseif (x <= 3.5e-14) 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 <= -2.1e+40) tmp = x; elseif (x <= 3.5e-14) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.1e+40], x, If[LessEqual[x, 3.5e-14], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+40}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-14}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.1000000000000001e40 or 3.5000000000000002e-14 < x Initial program 93.5%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 56.1%
if -2.1000000000000001e40 < x < 3.5000000000000002e-14Initial program 91.3%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in y around inf 73.5%
Taylor expanded in z around inf 59.7%
Final simplification57.8%
(FPCore (x y z t) :precision binary64 (if (<= x -3.8e+40) x (if (<= x 5.4e-14) (* z (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.8e+40) {
tmp = x;
} else if (x <= 5.4e-14) {
tmp = z * (y / 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 <= (-3.8d+40)) then
tmp = x
else if (x <= 5.4d-14) then
tmp = z * (y / 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 <= -3.8e+40) {
tmp = x;
} else if (x <= 5.4e-14) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.8e+40: tmp = x elif x <= 5.4e-14: tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.8e+40) tmp = x; elseif (x <= 5.4e-14) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.8e+40) tmp = x; elseif (x <= 5.4e-14) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.8e+40], x, If[LessEqual[x, 5.4e-14], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{+40}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.4 \cdot 10^{-14}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.80000000000000004e40 or 5.3999999999999997e-14 < x Initial program 93.5%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 56.1%
if -3.80000000000000004e40 < x < 5.3999999999999997e-14Initial program 91.3%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in y around inf 73.5%
Taylor expanded in z around inf 59.7%
clear-num59.6%
un-div-inv59.9%
Applied egg-rr59.9%
associate-/r/62.0%
Applied egg-rr62.0%
Final simplification58.9%
(FPCore (x y z t) :precision binary64 (+ x (* (- z x) (/ y t))))
double code(double x, double y, double z, double t) {
return x + ((z - x) * (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 + ((z - x) * (y / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) * (y / t));
}
def code(x, y, z, t): return x + ((z - x) * (y / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) * Float64(y / t))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) * (y / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - x\right) \cdot \frac{y}{t}
\end{array}
Initial program 92.5%
associate-*l/98.4%
Simplified98.4%
Final simplification98.4%
(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.5%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in y around 0 41.0%
Final simplification41.0%
(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 2023293
(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)))