
(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 12 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 (if (<= y 4e+155) (+ x (/ (- z x) (/ t y))) (+ x (* y (/ (- z x) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4e+155) {
tmp = x + ((z - x) / (t / y));
} else {
tmp = x + (y * ((z - 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 (y <= 4d+155) then
tmp = x + ((z - x) / (t / y))
else
tmp = x + (y * ((z - x) / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4e+155) {
tmp = x + ((z - x) / (t / y));
} else {
tmp = x + (y * ((z - x) / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 4e+155: tmp = x + ((z - x) / (t / y)) else: tmp = x + (y * ((z - x) / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 4e+155) tmp = Float64(x + Float64(Float64(z - x) / Float64(t / y))); else tmp = Float64(x + Float64(y * Float64(Float64(z - x) / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 4e+155) tmp = x + ((z - x) / (t / y)); else tmp = x + (y * ((z - x) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 4e+155], N[(x + N[(N[(z - x), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4 \cdot 10^{+155}:\\
\;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\
\end{array}
\end{array}
if y < 4.00000000000000003e155Initial program 94.3%
Taylor expanded in z around 0 90.8%
+-commutative90.8%
*-commutative90.8%
associate-*r/90.6%
mul-1-neg90.6%
associate-/l*93.9%
distribute-lft-neg-in93.9%
distribute-rgt-in98.6%
sub-neg98.6%
Simplified98.6%
*-commutative98.6%
clear-num98.6%
un-div-inv99.0%
Applied egg-rr99.0%
if 4.00000000000000003e155 < y Initial program 88.1%
+-commutative88.1%
associate-/l*99.7%
fma-define99.7%
Simplified99.7%
fma-undefine99.7%
Applied egg-rr99.7%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.9e+20) (not (<= t 3.1e-170))) (+ x (/ z (/ t y))) (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.9e+20) || !(t <= 3.1e-170)) {
tmp = x + (z / (t / y));
} else {
tmp = (y * (z - 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 ((t <= (-1.9d+20)) .or. (.not. (t <= 3.1d-170))) then
tmp = x + (z / (t / y))
else
tmp = (y * (z - x)) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.9e+20) || !(t <= 3.1e-170)) {
tmp = x + (z / (t / y));
} else {
tmp = (y * (z - x)) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.9e+20) or not (t <= 3.1e-170): tmp = x + (z / (t / y)) else: tmp = (y * (z - x)) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.9e+20) || !(t <= 3.1e-170)) tmp = Float64(x + Float64(z / Float64(t / y))); else tmp = Float64(Float64(y * Float64(z - x)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.9e+20) || ~((t <= 3.1e-170))) tmp = x + (z / (t / y)); else tmp = (y * (z - x)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.9e+20], N[Not[LessEqual[t, 3.1e-170]], $MachinePrecision]], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{+20} \lor \neg \left(t \leq 3.1 \cdot 10^{-170}\right):\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(z - x\right)}{t}\\
\end{array}
\end{array}
if t < -1.9e20 or 3.09999999999999986e-170 < t Initial program 90.6%
Taylor expanded in z around 0 89.3%
+-commutative89.3%
*-commutative89.3%
associate-*r/92.1%
mul-1-neg92.1%
associate-/l*97.4%
distribute-lft-neg-in97.4%
distribute-rgt-in98.7%
sub-neg98.7%
Simplified98.7%
*-commutative98.7%
clear-num98.7%
un-div-inv98.7%
Applied egg-rr98.7%
Taylor expanded in z around inf 87.5%
if -1.9e20 < t < 3.09999999999999986e-170Initial program 98.8%
Taylor expanded in y around -inf 89.1%
Final simplification88.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -150000000000.0) (not (<= z 2e-72))) (+ x (/ z (/ t y))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -150000000000.0) || !(z <= 2e-72)) {
tmp = x + (z / (t / y));
} 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 <= (-150000000000.0d0)) .or. (.not. (z <= 2d-72))) then
tmp = x + (z / (t / y))
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 <= -150000000000.0) || !(z <= 2e-72)) {
tmp = x + (z / (t / y));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -150000000000.0) or not (z <= 2e-72): tmp = x + (z / (t / y)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -150000000000.0) || !(z <= 2e-72)) tmp = Float64(x + Float64(z / Float64(t / y))); 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 <= -150000000000.0) || ~((z <= 2e-72))) tmp = x + (z / (t / y)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -150000000000.0], N[Not[LessEqual[z, 2e-72]], $MachinePrecision]], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -150000000000 \lor \neg \left(z \leq 2 \cdot 10^{-72}\right):\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -1.5e11 or 1.9999999999999999e-72 < z Initial program 91.4%
Taylor expanded in z around 0 85.1%
+-commutative85.1%
*-commutative85.1%
associate-*r/88.3%
mul-1-neg88.3%
associate-/l*90.8%
distribute-lft-neg-in90.8%
distribute-rgt-in97.8%
sub-neg97.8%
Simplified97.8%
*-commutative97.8%
clear-num97.8%
un-div-inv97.9%
Applied egg-rr97.9%
Taylor expanded in z around inf 88.9%
if -1.5e11 < z < 1.9999999999999999e-72Initial program 96.6%
Taylor expanded in x around inf 85.8%
mul-1-neg85.8%
unsub-neg85.8%
Simplified85.8%
Final simplification87.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -125000000000.0) (not (<= z 1.1e-72))) (+ x (* z (/ y t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -125000000000.0) || !(z <= 1.1e-72)) {
tmp = x + (z * (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 <= (-125000000000.0d0)) .or. (.not. (z <= 1.1d-72))) then
tmp = x + (z * (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 <= -125000000000.0) || !(z <= 1.1e-72)) {
tmp = x + (z * (y / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -125000000000.0) or not (z <= 1.1e-72): tmp = x + (z * (y / t)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -125000000000.0) || !(z <= 1.1e-72)) tmp = Float64(x + Float64(z * 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 <= -125000000000.0) || ~((z <= 1.1e-72))) tmp = x + (z * (y / t)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -125000000000.0], N[Not[LessEqual[z, 1.1e-72]], $MachinePrecision]], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -125000000000 \lor \neg \left(z \leq 1.1 \cdot 10^{-72}\right):\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -1.25e11 or 1.10000000000000001e-72 < z Initial program 91.4%
Taylor expanded in z around 0 85.1%
+-commutative85.1%
*-commutative85.1%
associate-*r/88.3%
mul-1-neg88.3%
associate-/l*90.8%
distribute-lft-neg-in90.8%
distribute-rgt-in97.8%
sub-neg97.8%
Simplified97.8%
Taylor expanded in z around inf 88.8%
if -1.25e11 < z < 1.10000000000000001e-72Initial program 96.6%
Taylor expanded in x around inf 85.8%
mul-1-neg85.8%
unsub-neg85.8%
Simplified85.8%
Final simplification87.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.5e+67) (not (<= x 7.4e-75))) (* x (- 1.0 (/ y t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.5e+67) || !(x <= 7.4e-75)) {
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 <= (-3.5d+67)) .or. (.not. (x <= 7.4d-75))) 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 <= -3.5e+67) || !(x <= 7.4e-75)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.5e+67) or not (x <= 7.4e-75): 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 <= -3.5e+67) || !(x <= 7.4e-75)) 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 <= -3.5e+67) || ~((x <= 7.4e-75))) 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, -3.5e+67], N[Not[LessEqual[x, 7.4e-75]], $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 -3.5 \cdot 10^{+67} \lor \neg \left(x \leq 7.4 \cdot 10^{-75}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -3.5e67 or 7.40000000000000047e-75 < x Initial program 92.7%
Taylor expanded in x around inf 89.5%
mul-1-neg89.5%
unsub-neg89.5%
Simplified89.5%
if -3.5e67 < x < 7.40000000000000047e-75Initial program 94.7%
Taylor expanded in z around inf 84.1%
associate-/l*82.4%
Simplified82.4%
Final simplification86.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.85e+61) (not (<= x 2.8e-100))) (* x (- 1.0 (/ y t))) (* (- z x) (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.85e+61) || !(x <= 2.8e-100)) {
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.85d+61)) .or. (.not. (x <= 2.8d-100))) 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.85e+61) || !(x <= 2.8e-100)) {
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.85e+61) or not (x <= 2.8e-100): 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.85e+61) || !(x <= 2.8e-100)) 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.85e+61) || ~((x <= 2.8e-100))) 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.85e+61], N[Not[LessEqual[x, 2.8e-100]], $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.85 \cdot 10^{+61} \lor \neg \left(x \leq 2.8 \cdot 10^{-100}\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.85000000000000001e61 or 2.79999999999999995e-100 < x Initial program 93.2%
Taylor expanded in x around inf 87.4%
mul-1-neg87.4%
unsub-neg87.4%
Simplified87.4%
if -1.85000000000000001e61 < x < 2.79999999999999995e-100Initial program 94.3%
Taylor expanded in y around -inf 68.8%
Taylor expanded in z around 0 65.3%
+-commutative90.8%
*-commutative90.8%
associate-*r/90.1%
mul-1-neg90.1%
associate-/l*88.0%
distribute-lft-neg-in88.0%
distribute-rgt-in94.3%
sub-neg94.3%
Simplified68.9%
Final simplification78.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.2e-100) (not (<= x 1.08e-187))) (* x (- 1.0 (/ y t))) (/ (* y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.2e-100) || !(x <= 1.08e-187)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (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.2d-100)) .or. (.not. (x <= 1.08d-187))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = (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.2e-100) || !(x <= 1.08e-187)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y * z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.2e-100) or not (x <= 1.08e-187): tmp = x * (1.0 - (y / t)) else: tmp = (y * z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.2e-100) || !(x <= 1.08e-187)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(Float64(y * z) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.2e-100) || ~((x <= 1.08e-187))) tmp = x * (1.0 - (y / t)); else tmp = (y * z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.2e-100], N[Not[LessEqual[x, 1.08e-187]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{-100} \lor \neg \left(x \leq 1.08 \cdot 10^{-187}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\end{array}
\end{array}
if x < -4.20000000000000019e-100 or 1.08e-187 < x Initial program 92.8%
Taylor expanded in x around inf 77.6%
mul-1-neg77.6%
unsub-neg77.6%
Simplified77.6%
if -4.20000000000000019e-100 < x < 1.08e-187Initial program 96.8%
Taylor expanded in y around -inf 78.0%
Taylor expanded in z around inf 74.6%
Final simplification76.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -0.122) (not (<= y 1.55e+61))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -0.122) || !(y <= 1.55e+61)) {
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 <= (-0.122d0)) .or. (.not. (y <= 1.55d+61))) 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 <= -0.122) || !(y <= 1.55e+61)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -0.122) or not (y <= 1.55e+61): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -0.122) || !(y <= 1.55e+61)) 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 <= -0.122) || ~((y <= 1.55e+61))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -0.122], N[Not[LessEqual[y, 1.55e+61]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.122 \lor \neg \left(y \leq 1.55 \cdot 10^{+61}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -0.122 or 1.55e61 < y Initial program 88.5%
Taylor expanded in z around inf 61.9%
Taylor expanded in y around inf 65.0%
+-commutative65.0%
Simplified65.0%
Taylor expanded in z around inf 51.0%
if -0.122 < y < 1.55e61Initial program 97.9%
Taylor expanded in y around 0 63.9%
Final simplification58.2%
(FPCore (x y z t) :precision binary64 (if (<= t -2.4e+98) x (if (<= t 1.1e-24) (/ (* y z) t) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.4e+98) {
tmp = x;
} else if (t <= 1.1e-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 (t <= (-2.4d+98)) then
tmp = x
else if (t <= 1.1d-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 (t <= -2.4e+98) {
tmp = x;
} else if (t <= 1.1e-24) {
tmp = (y * z) / t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.4e+98: tmp = x elif t <= 1.1e-24: tmp = (y * z) / t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.4e+98) tmp = x; elseif (t <= 1.1e-24) tmp = Float64(Float64(y * z) / t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.4e+98) tmp = x; elseif (t <= 1.1e-24) tmp = (y * z) / t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.4e+98], x, If[LessEqual[t, 1.1e-24], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.4 \cdot 10^{+98}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.1 \cdot 10^{-24}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -2.3999999999999999e98 or 1.10000000000000001e-24 < t Initial program 88.1%
Taylor expanded in y around 0 70.8%
if -2.3999999999999999e98 < t < 1.10000000000000001e-24Initial program 98.5%
Taylor expanded in y around -inf 81.3%
Taylor expanded in z around inf 52.7%
(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.7%
Taylor expanded in z around 0 89.7%
+-commutative89.7%
*-commutative89.7%
associate-*r/88.6%
mul-1-neg88.6%
associate-/l*91.4%
distribute-lft-neg-in91.4%
distribute-rgt-in97.0%
sub-neg97.0%
Simplified97.0%
*-commutative97.0%
clear-num97.0%
un-div-inv97.4%
Applied egg-rr97.4%
(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.7%
Taylor expanded in z around 0 89.7%
+-commutative89.7%
*-commutative89.7%
associate-*r/88.6%
mul-1-neg88.6%
associate-/l*91.4%
distribute-lft-neg-in91.4%
distribute-rgt-in97.0%
sub-neg97.0%
Simplified97.0%
Final simplification97.0%
(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.7%
Taylor expanded in y around 0 43.3%
(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 2024135
(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)))