
(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 93.6%
Taylor expanded in z around 0 88.1%
+-commutative88.1%
*-commutative88.1%
associate-*r/87.3%
mul-1-neg87.3%
associate-/l*90.1%
distribute-lft-neg-in90.1%
distribute-rgt-in97.6%
sub-neg97.6%
Simplified97.6%
*-commutative97.6%
clear-num97.6%
un-div-inv98.0%
Applied egg-rr98.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3900000000.0) (not (<= x 3.2e+53))) (* x (- 1.0 (/ y t))) (+ x (/ (* z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3900000000.0) || !(x <= 3.2e+53)) {
tmp = x * (1.0 - (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 <= (-3900000000.0d0)) .or. (.not. (x <= 3.2d+53))) then
tmp = x * (1.0d0 - (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 <= -3900000000.0) || !(x <= 3.2e+53)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((z * y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3900000000.0) or not (x <= 3.2e+53): tmp = x * (1.0 - (y / t)) else: tmp = x + ((z * y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3900000000.0) || !(x <= 3.2e+53)) tmp = Float64(x * Float64(1.0 - Float64(y / 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 ((x <= -3900000000.0) || ~((x <= 3.2e+53))) tmp = x * (1.0 - (y / t)); else tmp = x + ((z * y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3900000000.0], N[Not[LessEqual[x, 3.2e+53]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3900000000 \lor \neg \left(x \leq 3.2 \cdot 10^{+53}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\end{array}
\end{array}
if x < -3.9e9 or 3.2e53 < x Initial program 93.8%
Taylor expanded in x around inf 96.8%
mul-1-neg96.8%
unsub-neg96.8%
Simplified96.8%
if -3.9e9 < x < 3.2e53Initial program 93.4%
Taylor expanded in z around 0 89.5%
+-commutative89.5%
*-commutative89.5%
associate-*r/88.1%
mul-1-neg88.1%
associate-/l*88.5%
distribute-lft-neg-in88.5%
distribute-rgt-in95.5%
sub-neg95.5%
Simplified95.5%
Taylor expanded in z around inf 79.0%
Final simplification87.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -450000000.0) (not (<= x 2.4e+103))) (* x (- 1.0 (/ y t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -450000000.0) || !(x <= 2.4e+103)) {
tmp = x * (1.0 - (y / 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 ((x <= (-450000000.0d0)) .or. (.not. (x <= 2.4d+103))) then
tmp = x * (1.0d0 - (y / 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 ((x <= -450000000.0) || !(x <= 2.4e+103)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -450000000.0) or not (x <= 2.4e+103): tmp = x * (1.0 - (y / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -450000000.0) || !(x <= 2.4e+103)) tmp = Float64(x * Float64(1.0 - Float64(y / 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 ((x <= -450000000.0) || ~((x <= 2.4e+103))) tmp = x * (1.0 - (y / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -450000000.0], N[Not[LessEqual[x, 2.4e+103]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -450000000 \lor \neg \left(x \leq 2.4 \cdot 10^{+103}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -4.5e8 or 2.3999999999999998e103 < x Initial program 94.3%
Taylor expanded in x around inf 97.5%
mul-1-neg97.5%
unsub-neg97.5%
Simplified97.5%
if -4.5e8 < x < 2.3999999999999998e103Initial program 93.0%
Taylor expanded in z around inf 78.9%
associate-/l*78.5%
Simplified78.5%
Final simplification87.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.7e-72) (not (<= x 2.15e+55))) (* x (- 1.0 (/ y t))) (* (- z x) (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.7e-72) || !(x <= 2.15e+55)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (z - 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.7d-72)) .or. (.not. (x <= 2.15d+55))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = (z - 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.7e-72) || !(x <= 2.15e+55)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (z - x) * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.7e-72) or not (x <= 2.15e+55): tmp = x * (1.0 - (y / t)) else: tmp = (z - x) * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.7e-72) || !(x <= 2.15e+55)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(Float64(z - x) * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.7e-72) || ~((x <= 2.15e+55))) tmp = x * (1.0 - (y / t)); else tmp = (z - x) * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.7e-72], N[Not[LessEqual[x, 2.15e+55]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{-72} \lor \neg \left(x \leq 2.15 \cdot 10^{+55}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -1.6999999999999999e-72 or 2.1499999999999999e55 < x Initial program 93.8%
Taylor expanded in x around inf 92.8%
mul-1-neg92.8%
unsub-neg92.8%
Simplified92.8%
if -1.6999999999999999e-72 < x < 2.1499999999999999e55Initial program 93.3%
Taylor expanded in y around -inf 68.6%
Taylor expanded in z around 0 66.9%
+-commutative91.5%
*-commutative91.5%
associate-*r/90.0%
mul-1-neg90.0%
associate-/l*90.5%
distribute-lft-neg-in90.5%
distribute-rgt-in95.7%
sub-neg95.7%
Simplified71.6%
Final simplification83.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.9e-102) (not (<= x 2.5e-21))) (* x (- 1.0 (/ y t))) (/ (* z y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.9e-102) || !(x <= 2.5e-21)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (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 <= (-5.9d-102)) .or. (.not. (x <= 2.5d-21))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = (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 <= -5.9e-102) || !(x <= 2.5e-21)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (z * y) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5.9e-102) or not (x <= 2.5e-21): tmp = x * (1.0 - (y / t)) else: tmp = (z * y) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5.9e-102) || !(x <= 2.5e-21)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(Float64(z * y) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -5.9e-102) || ~((x <= 2.5e-21))) tmp = x * (1.0 - (y / t)); else tmp = (z * y) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.9e-102], N[Not[LessEqual[x, 2.5e-21]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.9 \cdot 10^{-102} \lor \neg \left(x \leq 2.5 \cdot 10^{-21}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\end{array}
\end{array}
if x < -5.9000000000000003e-102 or 2.49999999999999986e-21 < x Initial program 93.1%
Taylor expanded in x around inf 87.0%
mul-1-neg87.0%
unsub-neg87.0%
Simplified87.0%
if -5.9000000000000003e-102 < x < 2.49999999999999986e-21Initial program 94.5%
Taylor expanded in y around -inf 71.7%
Taylor expanded in z around inf 64.2%
Final simplification79.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.2e+49) (not (<= x 2.2e+51))) (/ (* x y) y) (* z (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.2e+49) || !(x <= 2.2e+51)) {
tmp = (x * y) / y;
} else {
tmp = 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 <= (-4.2d+49)) .or. (.not. (x <= 2.2d+51))) then
tmp = (x * y) / y
else
tmp = 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 <= -4.2e+49) || !(x <= 2.2e+51)) {
tmp = (x * y) / y;
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.2e+49) or not (x <= 2.2e+51): tmp = (x * y) / y else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.2e+49) || !(x <= 2.2e+51)) tmp = Float64(Float64(x * y) / y); else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.2e+49) || ~((x <= 2.2e+51))) tmp = (x * y) / y; else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.2e+49], N[Not[LessEqual[x, 2.2e+51]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] / y), $MachinePrecision], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{+49} \lor \neg \left(x \leq 2.2 \cdot 10^{+51}\right):\\
\;\;\;\;\frac{x \cdot y}{y}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -4.20000000000000022e49 or 2.19999999999999992e51 < x Initial program 93.6%
Taylor expanded in y around inf 69.8%
associate--l+69.8%
div-sub70.7%
Simplified70.7%
Taylor expanded in y around 0 29.1%
*-commutative29.1%
associate-*l/61.2%
Applied egg-rr61.2%
if -4.20000000000000022e49 < x < 2.19999999999999992e51Initial program 93.6%
Taylor expanded in y around -inf 67.7%
Taylor expanded in z around 0 63.3%
+-commutative89.2%
*-commutative89.2%
associate-*r/87.8%
mul-1-neg87.8%
associate-/l*88.2%
distribute-lft-neg-in88.2%
distribute-rgt-in95.7%
sub-neg95.7%
Simplified70.3%
Taylor expanded in z around inf 55.0%
Final simplification57.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.25e-21) (not (<= y 8.8e+24))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.25e-21) || !(y <= 8.8e+24)) {
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 ((y <= (-1.25d-21)) .or. (.not. (y <= 8.8d+24))) 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 ((y <= -1.25e-21) || !(y <= 8.8e+24)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.25e-21) or not (y <= 8.8e+24): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.25e-21) || !(y <= 8.8e+24)) 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 ((y <= -1.25e-21) || ~((y <= 8.8e+24))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.25e-21], N[Not[LessEqual[y, 8.8e+24]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{-21} \lor \neg \left(y \leq 8.8 \cdot 10^{+24}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.24999999999999993e-21 or 8.80000000000000007e24 < y Initial program 88.1%
Taylor expanded in y around inf 95.1%
associate--l+95.1%
div-sub96.0%
Simplified96.0%
Taylor expanded in x around 0 50.3%
if -1.24999999999999993e-21 < y < 8.80000000000000007e24Initial program 98.4%
Taylor expanded in y around 0 59.0%
Final simplification54.9%
(FPCore (x y z t) :precision binary64 (if (<= x -880000000.0) (* x (/ y (- t))) (if (<= x 2.8e+52) (* z (/ y t)) (/ (* x y) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -880000000.0) {
tmp = x * (y / -t);
} else if (x <= 2.8e+52) {
tmp = z * (y / t);
} else {
tmp = (x * y) / y;
}
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 <= (-880000000.0d0)) then
tmp = x * (y / -t)
else if (x <= 2.8d+52) then
tmp = z * (y / t)
else
tmp = (x * y) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -880000000.0) {
tmp = x * (y / -t);
} else if (x <= 2.8e+52) {
tmp = z * (y / t);
} else {
tmp = (x * y) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -880000000.0: tmp = x * (y / -t) elif x <= 2.8e+52: tmp = z * (y / t) else: tmp = (x * y) / y return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -880000000.0) tmp = Float64(x * Float64(y / Float64(-t))); elseif (x <= 2.8e+52) tmp = Float64(z * Float64(y / t)); else tmp = Float64(Float64(x * y) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -880000000.0) tmp = x * (y / -t); elseif (x <= 2.8e+52) tmp = z * (y / t); else tmp = (x * y) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -880000000.0], N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.8e+52], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -880000000:\\
\;\;\;\;x \cdot \frac{y}{-t}\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+52}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{y}\\
\end{array}
\end{array}
if x < -8.8e8Initial program 94.8%
Taylor expanded in y around -inf 57.6%
Taylor expanded in z around 0 56.2%
mul-1-neg56.2%
associate-/l*58.9%
distribute-rgt-neg-in58.9%
mul-1-neg58.9%
associate-*r/58.9%
mul-1-neg58.9%
Simplified58.9%
if -8.8e8 < x < 2.8e52Initial program 93.4%
Taylor expanded in y around -inf 67.2%
Taylor expanded in z around 0 63.4%
+-commutative89.5%
*-commutative89.5%
associate-*r/88.1%
mul-1-neg88.1%
associate-/l*88.5%
distribute-lft-neg-in88.5%
distribute-rgt-in95.5%
sub-neg95.5%
Simplified69.9%
Taylor expanded in z around inf 56.2%
if 2.8e52 < x Initial program 92.5%
Taylor expanded in y around inf 63.3%
associate--l+63.3%
div-sub65.3%
Simplified65.3%
Taylor expanded in y around 0 36.4%
*-commutative36.4%
associate-*l/68.8%
Applied egg-rr68.8%
Final simplification59.5%
(FPCore (x y z t) :precision binary64 (if (<= t -2.8e-44) x (if (<= t 1.85e+95) (* z (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.8e-44) {
tmp = x;
} else if (t <= 1.85e+95) {
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 (t <= (-2.8d-44)) then
tmp = x
else if (t <= 1.85d+95) 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 (t <= -2.8e-44) {
tmp = x;
} else if (t <= 1.85e+95) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.8e-44: tmp = x elif t <= 1.85e+95: tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.8e-44) tmp = x; elseif (t <= 1.85e+95) 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 (t <= -2.8e-44) tmp = x; elseif (t <= 1.85e+95) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.8e-44], x, If[LessEqual[t, 1.85e+95], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{-44}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.85 \cdot 10^{+95}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -2.8e-44 or 1.8500000000000001e95 < t Initial program 89.2%
Taylor expanded in y around 0 64.6%
if -2.8e-44 < t < 1.8500000000000001e95Initial program 97.2%
Taylor expanded in y around -inf 82.6%
Taylor expanded in z around 0 74.1%
+-commutative88.6%
*-commutative88.6%
associate-*r/83.9%
mul-1-neg83.9%
associate-/l*82.9%
distribute-lft-neg-in82.9%
distribute-rgt-in96.5%
sub-neg96.5%
Simplified82.0%
Taylor expanded in z around inf 48.6%
Final simplification55.8%
(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 93.6%
Taylor expanded in z around 0 88.1%
+-commutative88.1%
*-commutative88.1%
associate-*r/87.3%
mul-1-neg87.3%
associate-/l*90.1%
distribute-lft-neg-in90.1%
distribute-rgt-in97.6%
sub-neg97.6%
Simplified97.6%
Final simplification97.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 93.6%
Taylor expanded in y around 0 38.1%
(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 2024185
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:alt
(! :herbie-platform default (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
(+ x (/ (* y (- z x)) t)))