
(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 90.6%
Taylor expanded in z around 0 85.9%
+-commutative85.9%
*-commutative85.9%
associate-*r/85.0%
mul-1-neg85.0%
associate-/l*90.5%
distribute-lft-neg-in90.5%
distribute-rgt-in97.3%
sub-neg97.3%
Simplified97.3%
Taylor expanded in y around 0 90.6%
associate-/l*93.1%
*-commutative93.1%
associate-/r/97.6%
Simplified97.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))))
(if (<= y -4.4e+60)
t_1
(if (<= y 5.4e-21) x (if (<= y 9e+117) t_1 (* x (/ y (- t))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (y <= -4.4e+60) {
tmp = t_1;
} else if (y <= 5.4e-21) {
tmp = x;
} else if (y <= 9e+117) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = y * (z / t)
if (y <= (-4.4d+60)) then
tmp = t_1
else if (y <= 5.4d-21) then
tmp = x
else if (y <= 9d+117) then
tmp = t_1
else
tmp = x * (y / -t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (y <= -4.4e+60) {
tmp = t_1;
} else if (y <= 5.4e-21) {
tmp = x;
} else if (y <= 9e+117) {
tmp = t_1;
} else {
tmp = x * (y / -t);
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) tmp = 0 if y <= -4.4e+60: tmp = t_1 elif y <= 5.4e-21: tmp = x elif y <= 9e+117: tmp = t_1 else: tmp = x * (y / -t) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) tmp = 0.0 if (y <= -4.4e+60) tmp = t_1; elseif (y <= 5.4e-21) tmp = x; elseif (y <= 9e+117) tmp = t_1; else tmp = Float64(x * Float64(y / Float64(-t))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); tmp = 0.0; if (y <= -4.4e+60) tmp = t_1; elseif (y <= 5.4e-21) tmp = x; elseif (y <= 9e+117) tmp = t_1; else tmp = x * (y / -t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.4e+60], t$95$1, If[LessEqual[y, 5.4e-21], x, If[LessEqual[y, 9e+117], t$95$1, N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
\mathbf{if}\;y \leq -4.4 \cdot 10^{+60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{-21}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+117}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{-t}\\
\end{array}
\end{array}
if y < -4.39999999999999992e60 or 5.4000000000000002e-21 < y < 9e117Initial program 81.0%
Taylor expanded in y around -inf 71.9%
Taylor expanded in z around inf 48.3%
associate-/l*73.2%
Simplified60.8%
if -4.39999999999999992e60 < y < 5.4000000000000002e-21Initial program 98.4%
Taylor expanded in y around 0 66.3%
if 9e117 < y Initial program 85.8%
Taylor expanded in x around inf 67.7%
mul-1-neg67.7%
unsub-neg67.7%
Simplified67.7%
Taylor expanded in y around inf 53.2%
mul-1-neg53.2%
distribute-frac-neg253.2%
Simplified53.2%
(FPCore (x y z t) :precision binary64 (if (<= x -4e+63) (* x (- 1.0 (/ y t))) (if (<= x 2.55e+51) (+ x (/ z (/ t y))) (* x (- 1.0 (* y (/ 1.0 t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4e+63) {
tmp = x * (1.0 - (y / t));
} else if (x <= 2.55e+51) {
tmp = x + (z / (t / y));
} else {
tmp = x * (1.0 - (y * (1.0 / 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 <= (-4d+63)) then
tmp = x * (1.0d0 - (y / t))
else if (x <= 2.55d+51) then
tmp = x + (z / (t / y))
else
tmp = x * (1.0d0 - (y * (1.0d0 / t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4e+63) {
tmp = x * (1.0 - (y / t));
} else if (x <= 2.55e+51) {
tmp = x + (z / (t / y));
} else {
tmp = x * (1.0 - (y * (1.0 / t)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4e+63: tmp = x * (1.0 - (y / t)) elif x <= 2.55e+51: tmp = x + (z / (t / y)) else: tmp = x * (1.0 - (y * (1.0 / t))) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4e+63) tmp = Float64(x * Float64(1.0 - Float64(y / t))); elseif (x <= 2.55e+51) tmp = Float64(x + Float64(z / Float64(t / y))); else tmp = Float64(x * Float64(1.0 - Float64(y * Float64(1.0 / t)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -4e+63) tmp = x * (1.0 - (y / t)); elseif (x <= 2.55e+51) tmp = x + (z / (t / y)); else tmp = x * (1.0 - (y * (1.0 / t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4e+63], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.55e+51], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y * N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{+63}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{elif}\;x \leq 2.55 \cdot 10^{+51}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y \cdot \frac{1}{t}\right)\\
\end{array}
\end{array}
if x < -4.00000000000000023e63Initial program 80.0%
Taylor expanded in x around inf 92.6%
mul-1-neg92.6%
unsub-neg92.6%
Simplified92.6%
if -4.00000000000000023e63 < x < 2.55000000000000005e51Initial program 93.9%
Taylor expanded in z around 0 89.6%
+-commutative89.6%
*-commutative89.6%
associate-*r/88.9%
mul-1-neg88.9%
associate-/l*89.4%
distribute-lft-neg-in89.4%
distribute-rgt-in95.2%
sub-neg95.2%
Simplified95.2%
Taylor expanded in y around 0 93.9%
associate-/l*94.9%
*-commutative94.9%
associate-/r/95.8%
Simplified95.8%
Taylor expanded in z around inf 87.0%
if 2.55000000000000005e51 < x Initial program 93.1%
Taylor expanded in x around inf 92.9%
mul-1-neg92.9%
unsub-neg92.9%
Simplified92.9%
clear-num93.0%
associate-/r/92.9%
Applied egg-rr92.9%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1e+63) (not (<= x 1.4e+51))) (* x (- 1.0 (/ y t))) (+ x (/ z (/ t y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1e+63) || !(x <= 1.4e+51)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (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 ((x <= (-1d+63)) .or. (.not. (x <= 1.4d+51))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = x + (z / (t / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1e+63) || !(x <= 1.4e+51)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (z / (t / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1e+63) or not (x <= 1.4e+51): tmp = x * (1.0 - (y / t)) else: tmp = x + (z / (t / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1e+63) || !(x <= 1.4e+51)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(z / Float64(t / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1e+63) || ~((x <= 1.4e+51))) tmp = x * (1.0 - (y / t)); else tmp = x + (z / (t / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1e+63], N[Not[LessEqual[x, 1.4e+51]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{+63} \lor \neg \left(x \leq 1.4 \cdot 10^{+51}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\end{array}
\end{array}
if x < -1.00000000000000006e63 or 1.40000000000000002e51 < x Initial program 86.6%
Taylor expanded in x around inf 92.7%
mul-1-neg92.7%
unsub-neg92.7%
Simplified92.7%
if -1.00000000000000006e63 < x < 1.40000000000000002e51Initial program 93.9%
Taylor expanded in z around 0 89.6%
+-commutative89.6%
*-commutative89.6%
associate-*r/88.9%
mul-1-neg88.9%
associate-/l*89.4%
distribute-lft-neg-in89.4%
distribute-rgt-in95.2%
sub-neg95.2%
Simplified95.2%
Taylor expanded in y around 0 93.9%
associate-/l*94.9%
*-commutative94.9%
associate-/r/95.8%
Simplified95.8%
Taylor expanded in z around inf 87.0%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.4e+66) (not (<= x 2.8e+50))) (* x (- 1.0 (/ y t))) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.4e+66) || !(x <= 2.8e+50)) {
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 <= (-1.4d+66)) .or. (.not. (x <= 2.8d+50))) 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 <= -1.4e+66) || !(x <= 2.8e+50)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.4e+66) or not (x <= 2.8e+50): 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 <= -1.4e+66) || !(x <= 2.8e+50)) 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 <= -1.4e+66) || ~((x <= 2.8e+50))) 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, -1.4e+66], N[Not[LessEqual[x, 2.8e+50]], $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 -1.4 \cdot 10^{+66} \lor \neg \left(x \leq 2.8 \cdot 10^{+50}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -1.4e66 or 2.7999999999999998e50 < x Initial program 86.6%
Taylor expanded in x around inf 92.7%
mul-1-neg92.7%
unsub-neg92.7%
Simplified92.7%
if -1.4e66 < x < 2.7999999999999998e50Initial program 93.9%
Taylor expanded in z around 0 89.6%
+-commutative89.6%
*-commutative89.6%
associate-*r/88.9%
mul-1-neg88.9%
associate-/l*89.4%
distribute-lft-neg-in89.4%
distribute-rgt-in95.2%
sub-neg95.2%
Simplified95.2%
Taylor expanded in z around inf 86.6%
Final simplification89.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.6e+60) (not (<= x 1.15e+51))) (* x (- 1.0 (/ y t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.6e+60) || !(x <= 1.15e+51)) {
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 <= (-4.6d+60)) .or. (.not. (x <= 1.15d+51))) 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 <= -4.6e+60) || !(x <= 1.15e+51)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.6e+60) or not (x <= 1.15e+51): 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 <= -4.6e+60) || !(x <= 1.15e+51)) 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 <= -4.6e+60) || ~((x <= 1.15e+51))) 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, -4.6e+60], N[Not[LessEqual[x, 1.15e+51]], $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 -4.6 \cdot 10^{+60} \lor \neg \left(x \leq 1.15 \cdot 10^{+51}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -4.60000000000000034e60 or 1.15000000000000003e51 < x Initial program 86.6%
Taylor expanded in x around inf 92.7%
mul-1-neg92.7%
unsub-neg92.7%
Simplified92.7%
if -4.60000000000000034e60 < x < 1.15000000000000003e51Initial program 93.9%
Taylor expanded in z around inf 82.3%
associate-/l*83.2%
Simplified83.2%
Final simplification87.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.4e+154) (not (<= z 5.7e+84))) (* (- z x) (/ y t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.4e+154) || !(z <= 5.7e+84)) {
tmp = (z - x) * (y / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-5.4d+154)) .or. (.not. (z <= 5.7d+84))) then
tmp = (z - x) * (y / t)
else
tmp = x * (1.0d0 - (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.4e+154) || !(z <= 5.7e+84)) {
tmp = (z - x) * (y / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.4e+154) or not (z <= 5.7e+84): tmp = (z - x) * (y / t) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.4e+154) || !(z <= 5.7e+84)) tmp = Float64(Float64(z - x) * Float64(y / t)); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.4e+154) || ~((z <= 5.7e+84))) tmp = (z - x) * (y / t); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.4e+154], N[Not[LessEqual[z, 5.7e+84]], $MachinePrecision]], N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{+154} \lor \neg \left(z \leq 5.7 \cdot 10^{+84}\right):\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -5.40000000000000011e154 or 5.6999999999999997e84 < z Initial program 86.1%
Taylor expanded in y around -inf 65.0%
Taylor expanded in z around 0 53.7%
+-commutative74.8%
*-commutative74.8%
associate-*r/84.0%
mul-1-neg84.0%
associate-/l*87.4%
distribute-lft-neg-in87.4%
distribute-rgt-in99.8%
sub-neg99.8%
Simplified78.7%
if -5.40000000000000011e154 < z < 5.6999999999999997e84Initial program 92.8%
Taylor expanded in x around inf 82.1%
mul-1-neg82.1%
unsub-neg82.1%
Simplified82.1%
Final simplification81.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.4e+144) (not (<= z 4.2e+203))) (* y (/ z t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.4e+144) || !(z <= 4.2e+203)) {
tmp = y * (z / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.4d+144)) .or. (.not. (z <= 4.2d+203))) then
tmp = y * (z / t)
else
tmp = x * (1.0d0 - (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.4e+144) || !(z <= 4.2e+203)) {
tmp = y * (z / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.4e+144) or not (z <= 4.2e+203): tmp = y * (z / t) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.4e+144) || !(z <= 4.2e+203)) tmp = Float64(y * Float64(z / t)); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.4e+144) || ~((z <= 4.2e+203))) tmp = y * (z / t); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.4e+144], N[Not[LessEqual[z, 4.2e+203]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+144} \lor \neg \left(z \leq 4.2 \cdot 10^{+203}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -1.40000000000000003e144 or 4.19999999999999967e203 < z Initial program 85.4%
Taylor expanded in y around -inf 66.0%
Taylor expanded in z around inf 64.0%
associate-/l*90.1%
Simplified73.6%
if -1.40000000000000003e144 < z < 4.19999999999999967e203Initial program 92.2%
Taylor expanded in x around inf 79.5%
mul-1-neg79.5%
unsub-neg79.5%
Simplified79.5%
Final simplification78.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.6e+58) (not (<= y 2.25e-20))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.6e+58) || !(y <= 2.25e-20)) {
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.6d+58)) .or. (.not. (y <= 2.25d-20))) 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.6e+58) || !(y <= 2.25e-20)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.6e+58) or not (y <= 2.25e-20): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.6e+58) || !(y <= 2.25e-20)) 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.6e+58) || ~((y <= 2.25e-20))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.6e+58], N[Not[LessEqual[y, 2.25e-20]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{+58} \lor \neg \left(y \leq 2.25 \cdot 10^{-20}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.60000000000000008e58 or 2.2500000000000001e-20 < y Initial program 83.0%
Taylor expanded in y around -inf 75.0%
Taylor expanded in z around inf 45.4%
associate-/l*66.0%
Simplified53.3%
if -1.60000000000000008e58 < y < 2.2500000000000001e-20Initial program 98.4%
Taylor expanded in y around 0 66.3%
Final simplification59.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 90.6%
Taylor expanded in z around 0 85.9%
+-commutative85.9%
*-commutative85.9%
associate-*r/85.0%
mul-1-neg85.0%
associate-/l*90.5%
distribute-lft-neg-in90.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 90.6%
Taylor expanded in y around 0 40.6%
(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 2024180
(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)))