
(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 10 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 91.3%
div-inv91.3%
*-commutative91.3%
associate-*l*97.1%
Applied egg-rr97.1%
div-inv97.1%
clear-num97.0%
un-div-inv97.2%
Applied egg-rr97.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* y (/ z t)))))
(if (<= t -8.2e-57)
t_1
(if (<= t 7.8e-77)
(/ (* (- z x) y) t)
(if (<= t 3.6e-24) (* x (- 1.0 (/ y t))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x + (y * (z / t));
double tmp;
if (t <= -8.2e-57) {
tmp = t_1;
} else if (t <= 7.8e-77) {
tmp = ((z - x) * y) / t;
} else if (t <= 3.6e-24) {
tmp = x * (1.0 - (y / t));
} else {
tmp = t_1;
}
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 = x + (y * (z / t))
if (t <= (-8.2d-57)) then
tmp = t_1
else if (t <= 7.8d-77) then
tmp = ((z - x) * y) / t
else if (t <= 3.6d-24) then
tmp = x * (1.0d0 - (y / t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + (y * (z / t));
double tmp;
if (t <= -8.2e-57) {
tmp = t_1;
} else if (t <= 7.8e-77) {
tmp = ((z - x) * y) / t;
} else if (t <= 3.6e-24) {
tmp = x * (1.0 - (y / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (y * (z / t)) tmp = 0 if t <= -8.2e-57: tmp = t_1 elif t <= 7.8e-77: tmp = ((z - x) * y) / t elif t <= 3.6e-24: tmp = x * (1.0 - (y / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(y * Float64(z / t))) tmp = 0.0 if (t <= -8.2e-57) tmp = t_1; elseif (t <= 7.8e-77) tmp = Float64(Float64(Float64(z - x) * y) / t); elseif (t <= 3.6e-24) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (y * (z / t)); tmp = 0.0; if (t <= -8.2e-57) tmp = t_1; elseif (t <= 7.8e-77) tmp = ((z - x) * y) / t; elseif (t <= 3.6e-24) tmp = x * (1.0 - (y / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -8.2e-57], t$95$1, If[LessEqual[t, 7.8e-77], N[(N[(N[(z - x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 3.6e-24], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z}{t}\\
\mathbf{if}\;t \leq -8.2 \cdot 10^{-57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7.8 \cdot 10^{-77}:\\
\;\;\;\;\frac{\left(z - x\right) \cdot y}{t}\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{-24}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -8.2000000000000003e-57 or 3.6000000000000001e-24 < t Initial program 86.3%
Taylor expanded in z around inf 83.0%
associate-/l*88.5%
Simplified88.5%
if -8.2000000000000003e-57 < t < 7.79999999999999958e-77Initial program 97.9%
Taylor expanded in y around -inf 93.2%
if 7.79999999999999958e-77 < t < 3.6000000000000001e-24Initial program 99.5%
Taylor expanded in x around inf 95.2%
mul-1-neg95.2%
unsub-neg95.2%
Simplified95.2%
Final simplification90.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.2e-20) (not (<= z 1.3e-38))) (+ x (* y (/ z t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.2e-20) || !(z <= 1.3e-38)) {
tmp = x + (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.2d-20)) .or. (.not. (z <= 1.3d-38))) then
tmp = x + (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.2e-20) || !(z <= 1.3e-38)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.2e-20) or not (z <= 1.3e-38): tmp = x + (y * (z / t)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.2e-20) || !(z <= 1.3e-38)) tmp = Float64(x + 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.2e-20) || ~((z <= 1.3e-38))) tmp = x + (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.2e-20], N[Not[LessEqual[z, 1.3e-38]], $MachinePrecision]], N[(x + N[(y * N[(z / 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 -1.2 \cdot 10^{-20} \lor \neg \left(z \leq 1.3 \cdot 10^{-38}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -1.19999999999999996e-20 or 1.30000000000000005e-38 < z Initial program 90.6%
Taylor expanded in z around inf 84.3%
associate-/l*86.9%
Simplified86.9%
if -1.19999999999999996e-20 < z < 1.30000000000000005e-38Initial program 92.3%
Taylor expanded in x around inf 88.7%
mul-1-neg88.7%
unsub-neg88.7%
Simplified88.7%
Final simplification87.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7.4e+28) (not (<= t 5.6e-77))) (* x (- 1.0 (/ y t))) (* y (/ (- z x) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.4e+28) || !(t <= 5.6e-77)) {
tmp = x * (1.0 - (y / t));
} 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 <= (-7.4d+28)) .or. (.not. (t <= 5.6d-77))) then
tmp = x * (1.0d0 - (y / t))
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 <= -7.4e+28) || !(t <= 5.6e-77)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y * ((z - x) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7.4e+28) or not (t <= 5.6e-77): tmp = x * (1.0 - (y / t)) else: tmp = y * ((z - x) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7.4e+28) || !(t <= 5.6e-77)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(y * Float64(Float64(z - x) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -7.4e+28) || ~((t <= 5.6e-77))) tmp = x * (1.0 - (y / t)); else tmp = y * ((z - x) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7.4e+28], N[Not[LessEqual[t, 5.6e-77]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.4 \cdot 10^{+28} \lor \neg \left(t \leq 5.6 \cdot 10^{-77}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\end{array}
\end{array}
if t < -7.3999999999999998e28 or 5.5999999999999999e-77 < t Initial program 85.6%
Taylor expanded in x around inf 75.5%
mul-1-neg75.5%
unsub-neg75.5%
Simplified75.5%
if -7.3999999999999998e28 < t < 5.5999999999999999e-77Initial program 98.2%
Taylor expanded in y around -inf 89.2%
associate-/l*84.3%
*-commutative84.3%
Applied egg-rr84.3%
Final simplification79.5%
(FPCore (x y z t) :precision binary64 (if (<= z -1.12e-20) (+ x (* y (/ z t))) (if (<= z 5.6e-39) (* x (- 1.0 (/ y t))) (+ x (* z (/ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.12e-20) {
tmp = x + (y * (z / t));
} else if (z <= 5.6e-39) {
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 (z <= (-1.12d-20)) then
tmp = x + (y * (z / t))
else if (z <= 5.6d-39) 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 (z <= -1.12e-20) {
tmp = x + (y * (z / t));
} else if (z <= 5.6e-39) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.12e-20: tmp = x + (y * (z / t)) elif z <= 5.6e-39: tmp = x * (1.0 - (y / t)) else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.12e-20) tmp = Float64(x + Float64(y * Float64(z / t))); elseif (z <= 5.6e-39) 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 (z <= -1.12e-20) tmp = x + (y * (z / t)); elseif (z <= 5.6e-39) tmp = x * (1.0 - (y / t)); else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.12e-20], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.6e-39], 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}\;z \leq -1.12 \cdot 10^{-20}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{-39}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -1.12000000000000002e-20Initial program 91.4%
Taylor expanded in z around inf 85.1%
associate-/l*87.6%
Simplified87.6%
if -1.12000000000000002e-20 < z < 5.6000000000000003e-39Initial program 92.3%
Taylor expanded in x around inf 88.7%
mul-1-neg88.7%
unsub-neg88.7%
Simplified88.7%
if 5.6000000000000003e-39 < z Initial program 89.8%
Taylor expanded in z around 0 78.1%
+-commutative78.1%
*-commutative78.1%
associate-*r/85.8%
mul-1-neg85.8%
associate-/l*85.7%
distribute-lft-neg-in85.7%
distribute-rgt-in98.7%
sub-neg98.7%
Simplified98.7%
Taylor expanded in z around inf 90.0%
Final simplification88.8%
(FPCore (x y z t) :precision binary64 (if (<= z -2.6e+94) (/ y (/ t z)) (if (<= z 4.9e+84) (* x (- 1.0 (/ y t))) (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.6e+94) {
tmp = y / (t / z);
} else if (z <= 4.9e+84) {
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 (z <= (-2.6d+94)) then
tmp = y / (t / z)
else if (z <= 4.9d+84) 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 (z <= -2.6e+94) {
tmp = y / (t / z);
} else if (z <= 4.9e+84) {
tmp = x * (1.0 - (y / t));
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.6e+94: tmp = y / (t / z) elif z <= 4.9e+84: tmp = x * (1.0 - (y / t)) else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.6e+94) tmp = Float64(y / Float64(t / z)); elseif (z <= 4.9e+84) 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 (z <= -2.6e+94) tmp = y / (t / z); elseif (z <= 4.9e+84) tmp = x * (1.0 - (y / t)); else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.6e+94], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.9e+84], 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}\;z \leq -2.6 \cdot 10^{+94}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{+84}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -2.5999999999999999e94Initial program 90.1%
Taylor expanded in y around -inf 68.5%
Taylor expanded in z around inf 65.0%
associate-/l*91.0%
Simplified69.3%
clear-num69.2%
un-div-inv69.3%
Applied egg-rr69.3%
if -2.5999999999999999e94 < z < 4.9e84Initial program 93.0%
Taylor expanded in x around inf 79.3%
mul-1-neg79.3%
unsub-neg79.3%
Simplified79.3%
if 4.9e84 < z Initial program 86.8%
Taylor expanded in y around -inf 74.7%
Taylor expanded in z around inf 72.1%
associate-/l*87.3%
Simplified72.6%
clear-num72.5%
un-div-inv73.9%
Applied egg-rr73.9%
associate-/r/77.9%
Applied egg-rr77.9%
Final simplification77.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.7e+61) (not (<= y 2.4e-51))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.7e+61) || !(y <= 2.4e-51)) {
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 <= (-3.7d+61)) .or. (.not. (y <= 2.4d-51))) 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 <= -3.7e+61) || !(y <= 2.4e-51)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.7e+61) or not (y <= 2.4e-51): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.7e+61) || !(y <= 2.4e-51)) 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 <= -3.7e+61) || ~((y <= 2.4e-51))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.7e+61], N[Not[LessEqual[y, 2.4e-51]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{+61} \lor \neg \left(y \leq 2.4 \cdot 10^{-51}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.70000000000000003e61 or 2.4e-51 < y Initial program 85.1%
Taylor expanded in y around -inf 74.6%
Taylor expanded in z around inf 53.1%
associate-/l*71.7%
Simplified58.4%
if -3.70000000000000003e61 < y < 2.4e-51Initial program 97.6%
Taylor expanded in y around 0 63.2%
Final simplification60.8%
(FPCore (x y z t) :precision binary64 (if (<= t -1.25e-23) x (if (<= t 6.7e-77) (* z (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.25e-23) {
tmp = x;
} else if (t <= 6.7e-77) {
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 <= (-1.25d-23)) then
tmp = x
else if (t <= 6.7d-77) 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 <= -1.25e-23) {
tmp = x;
} else if (t <= 6.7e-77) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.25e-23: tmp = x elif t <= 6.7e-77: tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.25e-23) tmp = x; elseif (t <= 6.7e-77) 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 <= -1.25e-23) tmp = x; elseif (t <= 6.7e-77) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.25e-23], x, If[LessEqual[t, 6.7e-77], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.25 \cdot 10^{-23}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 6.7 \cdot 10^{-77}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.2500000000000001e-23 or 6.6999999999999997e-77 < t Initial program 86.6%
Taylor expanded in y around 0 60.8%
if -1.2500000000000001e-23 < t < 6.6999999999999997e-77Initial program 98.0%
Taylor expanded in y around -inf 92.7%
Taylor expanded in z around inf 65.2%
associate-/l*65.9%
Simplified60.5%
clear-num60.4%
un-div-inv61.1%
Applied egg-rr61.1%
associate-/r/65.3%
Applied egg-rr65.3%
Final simplification62.7%
(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 91.3%
Taylor expanded in z around 0 85.8%
+-commutative85.8%
*-commutative85.8%
associate-*r/85.3%
mul-1-neg85.3%
associate-/l*88.8%
distribute-lft-neg-in88.8%
distribute-rgt-in97.1%
sub-neg97.1%
Simplified97.1%
Final simplification97.1%
(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 91.3%
Taylor expanded in y around 0 39.2%
(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 2024157
(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)))