
(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 95.1%
Taylor expanded in z around 0 91.6%
+-commutative91.6%
*-commutative91.6%
associate-*r/91.1%
mul-1-neg91.1%
associate-/l*92.5%
distribute-lft-neg-in92.5%
distribute-rgt-in97.3%
sub-neg97.3%
Simplified97.3%
Taylor expanded in y around 0 95.1%
associate-*r/93.2%
*-commutative93.2%
associate-/r/97.4%
Simplified97.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.8e+136) (not (<= x 4.1e-22))) (* x (- 1.0 (/ y t))) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.8e+136) || !(x <= 4.1e-22)) {
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 <= (-3.8d+136)) .or. (.not. (x <= 4.1d-22))) 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 <= -3.8e+136) || !(x <= 4.1e-22)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.8e+136) or not (x <= 4.1e-22): 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 <= -3.8e+136) || !(x <= 4.1e-22)) tmp = Float64(x * Float64(1.0 - 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 <= -3.8e+136) || ~((x <= 4.1e-22))) 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, -3.8e+136], N[Not[LessEqual[x, 4.1e-22]], $MachinePrecision]], N[(x * N[(1.0 - 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 -3.8 \cdot 10^{+136} \lor \neg \left(x \leq 4.1 \cdot 10^{-22}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -3.80000000000000015e136 or 4.0999999999999999e-22 < x Initial program 95.9%
Taylor expanded in x around inf 92.8%
mul-1-neg92.8%
unsub-neg92.8%
Simplified92.8%
if -3.80000000000000015e136 < x < 4.0999999999999999e-22Initial program 94.6%
Taylor expanded in z around 0 92.7%
+-commutative92.7%
*-commutative92.7%
associate-*r/93.1%
mul-1-neg93.1%
associate-/l*93.1%
distribute-lft-neg-in93.1%
distribute-rgt-in95.7%
sub-neg95.7%
Simplified95.7%
Taylor expanded in z around inf 85.1%
Final simplification88.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.6e+21) (not (<= x 3.55e-22))) (* x (- 1.0 (/ y t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.6e+21) || !(x <= 3.55e-22)) {
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 <= (-2.6d+21)) .or. (.not. (x <= 3.55d-22))) 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 <= -2.6e+21) || !(x <= 3.55e-22)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.6e+21) or not (x <= 3.55e-22): 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 <= -2.6e+21) || !(x <= 3.55e-22)) 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 <= -2.6e+21) || ~((x <= 3.55e-22))) 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, -2.6e+21], N[Not[LessEqual[x, 3.55e-22]], $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 -2.6 \cdot 10^{+21} \lor \neg \left(x \leq 3.55 \cdot 10^{-22}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -2.6e21 or 3.5499999999999999e-22 < x Initial program 95.0%
Taylor expanded in x around inf 90.2%
mul-1-neg90.2%
unsub-neg90.2%
Simplified90.2%
if -2.6e21 < x < 3.5499999999999999e-22Initial program 95.1%
Taylor expanded in z around inf 82.1%
associate-/l*81.3%
Simplified81.3%
Final simplification85.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.4e-194) (not (<= x 2.9e-83))) (* x (- 1.0 (/ y t))) (* z (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.4e-194) || !(x <= 2.9e-83)) {
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 <= (-4.4d-194)) .or. (.not. (x <= 2.9d-83))) 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 <= -4.4e-194) || !(x <= 2.9e-83)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.4e-194) or not (x <= 2.9e-83): tmp = x * (1.0 - (y / t)) else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.4e-194) || !(x <= 2.9e-83)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); 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.4e-194) || ~((x <= 2.9e-83))) 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, -4.4e-194], N[Not[LessEqual[x, 2.9e-83]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{-194} \lor \neg \left(x \leq 2.9 \cdot 10^{-83}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -4.4000000000000003e-194 or 2.8999999999999999e-83 < x Initial program 95.1%
Taylor expanded in x around inf 77.9%
mul-1-neg77.9%
unsub-neg77.9%
Simplified77.9%
if -4.4000000000000003e-194 < x < 2.8999999999999999e-83Initial program 95.1%
Taylor expanded in t around 0 95.1%
Taylor expanded in x around 0 65.9%
associate-*l/69.3%
Applied egg-rr69.3%
Final simplification75.2%
(FPCore (x y z t) :precision binary64 (if (<= t -3.7e-106) (+ x (* z (/ y t))) (if (<= t 2.6e-67) (/ (* (- z x) y) t) (+ x (* y (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.7e-106) {
tmp = x + (z * (y / t));
} else if (t <= 2.6e-67) {
tmp = ((z - x) * 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 (t <= (-3.7d-106)) then
tmp = x + (z * (y / t))
else if (t <= 2.6d-67) then
tmp = ((z - x) * 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 (t <= -3.7e-106) {
tmp = x + (z * (y / t));
} else if (t <= 2.6e-67) {
tmp = ((z - x) * y) / t;
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.7e-106: tmp = x + (z * (y / t)) elif t <= 2.6e-67: tmp = ((z - x) * y) / t else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.7e-106) tmp = Float64(x + Float64(z * Float64(y / t))); elseif (t <= 2.6e-67) tmp = Float64(Float64(Float64(z - x) * 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 (t <= -3.7e-106) tmp = x + (z * (y / t)); elseif (t <= 2.6e-67) tmp = ((z - x) * y) / t; else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.7e-106], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.6e-67], N[(N[(N[(z - x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.7 \cdot 10^{-106}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{elif}\;t \leq 2.6 \cdot 10^{-67}:\\
\;\;\;\;\frac{\left(z - x\right) \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if t < -3.69999999999999979e-106Initial program 94.9%
Taylor expanded in z around 0 92.8%
+-commutative92.8%
*-commutative92.8%
associate-*r/97.7%
mul-1-neg97.7%
associate-/l*98.7%
distribute-lft-neg-in98.7%
distribute-rgt-in99.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in z around inf 84.6%
if -3.69999999999999979e-106 < t < 2.5999999999999999e-67Initial program 98.8%
Taylor expanded in y around -inf 93.6%
if 2.5999999999999999e-67 < t Initial program 90.8%
Taylor expanded in z around inf 81.1%
associate-/l*87.7%
Simplified87.7%
Final simplification88.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -5.2e-107) (not (<= y 9.4e+27))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5.2e-107) || !(y <= 9.4e+27)) {
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 ((y <= (-5.2d-107)) .or. (.not. (y <= 9.4d+27))) 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 ((y <= -5.2e-107) || !(y <= 9.4e+27)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -5.2e-107) or not (y <= 9.4e+27): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -5.2e-107) || !(y <= 9.4e+27)) 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 ((y <= -5.2e-107) || ~((y <= 9.4e+27))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5.2e-107], N[Not[LessEqual[y, 9.4e+27]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{-107} \lor \neg \left(y \leq 9.4 \cdot 10^{+27}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -5.2000000000000001e-107 or 9.39999999999999952e27 < y Initial program 91.5%
Taylor expanded in t around 0 90.7%
Taylor expanded in x around 0 50.2%
associate-*l/55.8%
Applied egg-rr55.8%
if -5.2000000000000001e-107 < y < 9.39999999999999952e27Initial program 99.2%
Taylor expanded in y around 0 66.1%
Final simplification60.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.02e-106) (not (<= y 1.95e+28))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.02e-106) || !(y <= 1.95e+28)) {
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.02d-106)) .or. (.not. (y <= 1.95d+28))) 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.02e-106) || !(y <= 1.95e+28)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.02e-106) or not (y <= 1.95e+28): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.02e-106) || !(y <= 1.95e+28)) 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.02e-106) || ~((y <= 1.95e+28))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.02e-106], N[Not[LessEqual[y, 1.95e+28]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.02 \cdot 10^{-106} \lor \neg \left(y \leq 1.95 \cdot 10^{+28}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.02e-106 or 1.9499999999999999e28 < y Initial program 91.5%
Taylor expanded in y around -inf 81.4%
Taylor expanded in z around inf 50.2%
associate-/l*65.1%
Simplified52.4%
if -1.02e-106 < y < 1.9499999999999999e28Initial program 99.2%
Taylor expanded in y around 0 66.1%
Final simplification58.8%
(FPCore (x y z t) :precision binary64 (if (<= y -1.02e-106) (* z (/ y t)) (if (<= y 1.32e+28) x (/ z (/ t y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.02e-106) {
tmp = z * (y / t);
} else if (y <= 1.32e+28) {
tmp = x;
} else {
tmp = z / (t / 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 (y <= (-1.02d-106)) then
tmp = z * (y / t)
else if (y <= 1.32d+28) then
tmp = x
else
tmp = z / (t / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.02e-106) {
tmp = z * (y / t);
} else if (y <= 1.32e+28) {
tmp = x;
} else {
tmp = z / (t / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.02e-106: tmp = z * (y / t) elif y <= 1.32e+28: tmp = x else: tmp = z / (t / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.02e-106) tmp = Float64(z * Float64(y / t)); elseif (y <= 1.32e+28) tmp = x; else tmp = Float64(z / Float64(t / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.02e-106) tmp = z * (y / t); elseif (y <= 1.32e+28) tmp = x; else tmp = z / (t / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.02e-106], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.32e+28], x, N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.02 \cdot 10^{-106}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;y \leq 1.32 \cdot 10^{+28}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\end{array}
\end{array}
if y < -1.02e-106Initial program 90.9%
Taylor expanded in t around 0 89.6%
Taylor expanded in x around 0 47.4%
associate-*l/52.6%
Applied egg-rr52.6%
if -1.02e-106 < y < 1.3199999999999999e28Initial program 99.2%
Taylor expanded in y around 0 66.1%
if 1.3199999999999999e28 < y Initial program 92.1%
Taylor expanded in t around 0 92.1%
Taylor expanded in x around 0 53.6%
associate-*l/59.5%
Applied egg-rr59.5%
*-commutative59.5%
clear-num59.5%
div-inv59.9%
Applied egg-rr59.9%
Final simplification60.7%
(FPCore (x y z t) :precision binary64 (if (<= x 4.1e+189) x (* t (/ x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 4.1e+189) {
tmp = x;
} else {
tmp = t * (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 (x <= 4.1d+189) then
tmp = x
else
tmp = t * (x / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 4.1e+189) {
tmp = x;
} else {
tmp = t * (x / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 4.1e+189: tmp = x else: tmp = t * (x / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 4.1e+189) tmp = x; else tmp = Float64(t * Float64(x / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 4.1e+189) tmp = x; else tmp = t * (x / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 4.1e+189], x, N[(t * N[(x / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.1 \cdot 10^{+189}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{t}\\
\end{array}
\end{array}
if x < 4.1000000000000002e189Initial program 94.9%
Taylor expanded in y around 0 38.8%
if 4.1000000000000002e189 < x Initial program 96.4%
Taylor expanded in t around 0 86.3%
Taylor expanded in t around inf 25.3%
*-commutative25.3%
Simplified25.3%
*-commutative25.3%
associate-/l*51.8%
Applied egg-rr51.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 95.1%
Taylor expanded in z around 0 91.6%
+-commutative91.6%
*-commutative91.6%
associate-*r/91.1%
mul-1-neg91.1%
associate-/l*92.5%
distribute-lft-neg-in92.5%
distribute-rgt-in97.3%
sub-neg97.3%
Simplified97.3%
Final simplification97.3%
(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 95.1%
Taylor expanded in y around 0 38.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 2024186
(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)))