
(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 (<= t -3e-88) (+ x (* y (/ (- z x) t))) (+ x (* (- z x) (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3e-88) {
tmp = x + (y * ((z - x) / t));
} else {
tmp = x + ((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 (t <= (-3d-88)) then
tmp = x + (y * ((z - x) / t))
else
tmp = x + ((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 (t <= -3e-88) {
tmp = x + (y * ((z - x) / t));
} else {
tmp = x + ((z - x) * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3e-88: tmp = x + (y * ((z - x) / t)) else: tmp = x + ((z - x) * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3e-88) tmp = Float64(x + Float64(y * Float64(Float64(z - x) / t))); else tmp = Float64(x + Float64(Float64(z - x) * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -3e-88) tmp = x + (y * ((z - x) / t)); else tmp = x + ((z - x) * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3e-88], N[(x + N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{-88}:\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\
\end{array}
\end{array}
if t < -2.9999999999999999e-88Initial program 89.6%
+-commutative89.6%
associate-/l*98.8%
fma-define98.8%
Simplified98.8%
fma-undefine98.8%
Applied egg-rr98.8%
if -2.9999999999999999e-88 < t Initial program 95.6%
Taylor expanded in z around 0 89.8%
+-commutative89.8%
*-commutative89.8%
associate-*r/90.0%
mul-1-neg90.0%
associate-/l*87.0%
distribute-lft-neg-in87.0%
distribute-rgt-in98.6%
sub-neg98.6%
Simplified98.6%
Final simplification98.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -9.2e-107) (not (<= t 46000000.0))) (+ x (* y (/ z t))) (* (- z x) (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9.2e-107) || !(t <= 46000000.0)) {
tmp = x + (y * (z / 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 ((t <= (-9.2d-107)) .or. (.not. (t <= 46000000.0d0))) then
tmp = x + (y * (z / 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 ((t <= -9.2e-107) || !(t <= 46000000.0)) {
tmp = x + (y * (z / t));
} else {
tmp = (z - x) * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -9.2e-107) or not (t <= 46000000.0): tmp = x + (y * (z / t)) else: tmp = (z - x) * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -9.2e-107) || !(t <= 46000000.0)) tmp = Float64(x + Float64(y * Float64(z / 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 ((t <= -9.2e-107) || ~((t <= 46000000.0))) tmp = x + (y * (z / t)); else tmp = (z - x) * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -9.2e-107], N[Not[LessEqual[t, 46000000.0]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.2 \cdot 10^{-107} \lor \neg \left(t \leq 46000000\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\end{array}
\end{array}
if t < -9.20000000000000014e-107 or 4.6e7 < t Initial program 89.2%
Taylor expanded in z around inf 82.9%
associate-/l*87.2%
Simplified87.2%
if -9.20000000000000014e-107 < t < 4.6e7Initial program 99.9%
Taylor expanded in y around -inf 94.7%
Taylor expanded in z around 0 85.3%
+-commutative90.5%
*-commutative90.5%
associate-*r/85.9%
mul-1-neg85.9%
associate-/l*79.2%
distribute-lft-neg-in79.2%
distribute-rgt-in98.1%
sub-neg98.1%
Simplified92.9%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7.2e+60) (not (<= t 9.8e+123))) (* x (- 1.0 (/ y t))) (* (- z x) (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.2e+60) || !(t <= 9.8e+123)) {
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 ((t <= (-7.2d+60)) .or. (.not. (t <= 9.8d+123))) 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 ((t <= -7.2e+60) || !(t <= 9.8e+123)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (z - x) * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7.2e+60) or not (t <= 9.8e+123): tmp = x * (1.0 - (y / t)) else: tmp = (z - x) * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7.2e+60) || !(t <= 9.8e+123)) 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 ((t <= -7.2e+60) || ~((t <= 9.8e+123))) 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[t, -7.2e+60], N[Not[LessEqual[t, 9.8e+123]], $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}\;t \leq -7.2 \cdot 10^{+60} \lor \neg \left(t \leq 9.8 \cdot 10^{+123}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\end{array}
\end{array}
if t < -7.19999999999999935e60 or 9.79999999999999952e123 < t Initial program 85.9%
Taylor expanded in x around inf 84.2%
mul-1-neg84.2%
unsub-neg84.2%
Simplified84.2%
if -7.19999999999999935e60 < t < 9.79999999999999952e123Initial program 98.2%
Taylor expanded in y around -inf 84.6%
Taylor expanded in z around 0 77.8%
+-commutative91.4%
*-commutative91.4%
associate-*r/88.7%
mul-1-neg88.7%
associate-/l*84.8%
distribute-lft-neg-in84.8%
distribute-rgt-in97.9%
sub-neg97.9%
Simplified84.3%
Final simplification84.2%
(FPCore (x y z t) :precision binary64 (if (<= t -2.2e-110) (+ x (/ y (/ t z))) (if (<= t 3.1e-27) (/ (* y (- z x)) t) (+ x (* z (/ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.2e-110) {
tmp = x + (y / (t / z));
} else if (t <= 3.1e-27) {
tmp = (y * (z - x)) / 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 (t <= (-2.2d-110)) then
tmp = x + (y / (t / z))
else if (t <= 3.1d-27) then
tmp = (y * (z - x)) / 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 (t <= -2.2e-110) {
tmp = x + (y / (t / z));
} else if (t <= 3.1e-27) {
tmp = (y * (z - x)) / t;
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.2e-110: tmp = x + (y / (t / z)) elif t <= 3.1e-27: tmp = (y * (z - x)) / t else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.2e-110) tmp = Float64(x + Float64(y / Float64(t / z))); elseif (t <= 3.1e-27) tmp = Float64(Float64(y * Float64(z - x)) / 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 (t <= -2.2e-110) tmp = x + (y / (t / z)); elseif (t <= 3.1e-27) tmp = (y * (z - x)) / t; else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.2e-110], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.1e-27], N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.2 \cdot 10^{-110}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{-27}:\\
\;\;\;\;\frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if t < -2.1999999999999999e-110Initial program 90.5%
Taylor expanded in z around inf 83.2%
associate-/l*85.1%
Simplified85.1%
clear-num85.1%
un-div-inv85.1%
Applied egg-rr85.1%
if -2.1999999999999999e-110 < t < 3.0999999999999998e-27Initial program 99.9%
Taylor expanded in y around -inf 94.6%
if 3.0999999999999998e-27 < t Initial program 87.6%
Taylor expanded in z around 0 87.6%
+-commutative87.6%
*-commutative87.6%
associate-*r/96.2%
mul-1-neg96.2%
associate-/l*97.7%
distribute-lft-neg-in97.7%
distribute-rgt-in99.3%
sub-neg99.3%
Simplified99.3%
Taylor expanded in z around inf 91.6%
Final simplification90.5%
(FPCore (x y z t) :precision binary64 (if (<= t -5.5e-104) (+ x (/ y (/ t z))) (if (<= t 3.45e-28) (* (- z x) (/ y t)) (+ x (* z (/ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.5e-104) {
tmp = x + (y / (t / z));
} else if (t <= 3.45e-28) {
tmp = (z - x) * (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 (t <= (-5.5d-104)) then
tmp = x + (y / (t / z))
else if (t <= 3.45d-28) then
tmp = (z - x) * (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 (t <= -5.5e-104) {
tmp = x + (y / (t / z));
} else if (t <= 3.45e-28) {
tmp = (z - x) * (y / t);
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -5.5e-104: tmp = x + (y / (t / z)) elif t <= 3.45e-28: tmp = (z - x) * (y / t) else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -5.5e-104) tmp = Float64(x + Float64(y / Float64(t / z))); elseif (t <= 3.45e-28) tmp = Float64(Float64(z - x) * 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 (t <= -5.5e-104) tmp = x + (y / (t / z)); elseif (t <= 3.45e-28) tmp = (z - x) * (y / t); else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -5.5e-104], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.45e-28], N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{-104}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;t \leq 3.45 \cdot 10^{-28}:\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if t < -5.4999999999999998e-104Initial program 90.5%
Taylor expanded in z around inf 83.2%
associate-/l*85.1%
Simplified85.1%
clear-num85.1%
un-div-inv85.1%
Applied egg-rr85.1%
if -5.4999999999999998e-104 < t < 3.45000000000000001e-28Initial program 99.9%
Taylor expanded in y around -inf 94.6%
Taylor expanded in z around 0 85.0%
+-commutative90.4%
*-commutative90.4%
associate-*r/85.7%
mul-1-neg85.7%
associate-/l*79.8%
distribute-lft-neg-in79.8%
distribute-rgt-in98.1%
sub-neg98.1%
Simplified92.8%
if 3.45000000000000001e-28 < t Initial program 87.6%
Taylor expanded in z around 0 87.6%
+-commutative87.6%
*-commutative87.6%
associate-*r/96.2%
mul-1-neg96.2%
associate-/l*97.7%
distribute-lft-neg-in97.7%
distribute-rgt-in99.3%
sub-neg99.3%
Simplified99.3%
Taylor expanded in z around inf 91.6%
Final simplification89.8%
(FPCore (x y z t) :precision binary64 (if (<= t -6.2e-106) (+ x (* y (/ z t))) (if (<= t 7.2e-26) (* (- z x) (/ y t)) (+ x (* z (/ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6.2e-106) {
tmp = x + (y * (z / t));
} else if (t <= 7.2e-26) {
tmp = (z - x) * (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 (t <= (-6.2d-106)) then
tmp = x + (y * (z / t))
else if (t <= 7.2d-26) then
tmp = (z - x) * (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 (t <= -6.2e-106) {
tmp = x + (y * (z / t));
} else if (t <= 7.2e-26) {
tmp = (z - x) * (y / t);
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -6.2e-106: tmp = x + (y * (z / t)) elif t <= 7.2e-26: tmp = (z - x) * (y / t) else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -6.2e-106) tmp = Float64(x + Float64(y * Float64(z / t))); elseif (t <= 7.2e-26) tmp = Float64(Float64(z - x) * 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 (t <= -6.2e-106) tmp = x + (y * (z / t)); elseif (t <= 7.2e-26) tmp = (z - x) * (y / t); else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -6.2e-106], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.2e-26], N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{-106}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{-26}:\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if t < -6.19999999999999971e-106Initial program 90.5%
Taylor expanded in z around inf 83.2%
associate-/l*85.1%
Simplified85.1%
if -6.19999999999999971e-106 < t < 7.2000000000000003e-26Initial program 99.9%
Taylor expanded in y around -inf 94.6%
Taylor expanded in z around 0 85.0%
+-commutative90.4%
*-commutative90.4%
associate-*r/85.7%
mul-1-neg85.7%
associate-/l*79.8%
distribute-lft-neg-in79.8%
distribute-rgt-in98.1%
sub-neg98.1%
Simplified92.8%
if 7.2000000000000003e-26 < t Initial program 87.6%
Taylor expanded in z around 0 87.6%
+-commutative87.6%
*-commutative87.6%
associate-*r/96.2%
mul-1-neg96.2%
associate-/l*97.7%
distribute-lft-neg-in97.7%
distribute-rgt-in99.3%
sub-neg99.3%
Simplified99.3%
Taylor expanded in z around inf 91.6%
Final simplification89.8%
(FPCore (x y z t) :precision binary64 (if (<= z -1e+89) (/ (* y z) t) (if (<= z 1.6e+44) (* x (- 1.0 (/ y t))) (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1e+89) {
tmp = (y * z) / t;
} else if (z <= 1.6e+44) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y / (t / z);
}
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 <= (-1d+89)) then
tmp = (y * z) / t
else if (z <= 1.6d+44) then
tmp = x * (1.0d0 - (y / t))
else
tmp = y / (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1e+89) {
tmp = (y * z) / t;
} else if (z <= 1.6e+44) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y / (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1e+89: tmp = (y * z) / t elif z <= 1.6e+44: tmp = x * (1.0 - (y / t)) else: tmp = y / (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1e+89) tmp = Float64(Float64(y * z) / t); elseif (z <= 1.6e+44) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(y / Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1e+89) tmp = (y * z) / t; elseif (z <= 1.6e+44) tmp = x * (1.0 - (y / t)); else tmp = y / (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1e+89], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 1.6e+44], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+89}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+44}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if z < -9.99999999999999995e88Initial program 90.2%
Taylor expanded in y around -inf 70.0%
Taylor expanded in z around inf 67.1%
if -9.99999999999999995e88 < z < 1.60000000000000002e44Initial program 95.6%
Taylor expanded in x around inf 82.9%
mul-1-neg82.9%
unsub-neg82.9%
Simplified82.9%
if 1.60000000000000002e44 < z Initial program 91.0%
Taylor expanded in y around -inf 73.4%
Taylor expanded in z around inf 70.3%
associate-/l*92.3%
Simplified73.1%
clear-num92.3%
un-div-inv93.3%
Applied egg-rr74.1%
(FPCore (x y z t) :precision binary64 (if (<= t -3.5e+57) x (if (<= t 5.1e+109) (/ (* y z) t) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.5e+57) {
tmp = x;
} else if (t <= 5.1e+109) {
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 <= (-3.5d+57)) then
tmp = x
else if (t <= 5.1d+109) 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 <= -3.5e+57) {
tmp = x;
} else if (t <= 5.1e+109) {
tmp = (y * z) / t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.5e+57: tmp = x elif t <= 5.1e+109: tmp = (y * z) / t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.5e+57) tmp = x; elseif (t <= 5.1e+109) 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 <= -3.5e+57) tmp = x; elseif (t <= 5.1e+109) tmp = (y * z) / t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.5e+57], x, If[LessEqual[t, 5.1e+109], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.5 \cdot 10^{+57}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 5.1 \cdot 10^{+109}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -3.4999999999999997e57 or 5.0999999999999999e109 < t Initial program 85.2%
Taylor expanded in y around 0 73.5%
if -3.4999999999999997e57 < t < 5.0999999999999999e109Initial program 98.7%
Taylor expanded in y around -inf 85.6%
Taylor expanded in z around inf 59.2%
(FPCore (x y z t) :precision binary64 (if (<= t -4.5e+61) x (if (<= t 1.36e+113) (/ y (/ t z)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.5e+61) {
tmp = x;
} else if (t <= 1.36e+113) {
tmp = y / (t / z);
} 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 <= (-4.5d+61)) then
tmp = x
else if (t <= 1.36d+113) then
tmp = y / (t / z)
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 <= -4.5e+61) {
tmp = x;
} else if (t <= 1.36e+113) {
tmp = y / (t / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.5e+61: tmp = x elif t <= 1.36e+113: tmp = y / (t / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.5e+61) tmp = x; elseif (t <= 1.36e+113) tmp = Float64(y / Float64(t / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4.5e+61) tmp = x; elseif (t <= 1.36e+113) tmp = y / (t / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.5e+61], x, If[LessEqual[t, 1.36e+113], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.5 \cdot 10^{+61}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.36 \cdot 10^{+113}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -4.5e61 or 1.35999999999999997e113 < t Initial program 85.2%
Taylor expanded in y around 0 73.5%
if -4.5e61 < t < 1.35999999999999997e113Initial program 98.7%
Taylor expanded in y around -inf 85.6%
Taylor expanded in z around inf 59.2%
associate-/l*67.6%
Simplified55.1%
clear-num67.6%
un-div-inv68.3%
Applied egg-rr55.7%
(FPCore (x y z t) :precision binary64 (if (<= t -3.4e+62) x (if (<= t 2.7e+112) (* y (/ z t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.4e+62) {
tmp = x;
} else if (t <= 2.7e+112) {
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 <= (-3.4d+62)) then
tmp = x
else if (t <= 2.7d+112) 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 <= -3.4e+62) {
tmp = x;
} else if (t <= 2.7e+112) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.4e+62: tmp = x elif t <= 2.7e+112: tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.4e+62) tmp = x; elseif (t <= 2.7e+112) 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 (t <= -3.4e+62) tmp = x; elseif (t <= 2.7e+112) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.4e+62], x, If[LessEqual[t, 2.7e+112], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.4 \cdot 10^{+62}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{+112}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -3.40000000000000014e62 or 2.7000000000000001e112 < t Initial program 85.2%
Taylor expanded in y around 0 73.5%
if -3.40000000000000014e62 < t < 2.7000000000000001e112Initial program 98.7%
Taylor expanded in y around -inf 85.6%
Taylor expanded in z around inf 59.2%
associate-/l*67.6%
Simplified55.1%
(FPCore (x y z t) :precision binary64 (+ x (* (- z x) (/ y t))))
double code(double x, double y, double z, double t) {
return x + ((z - x) * (y / t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((z - x) * (y / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) * (y / t));
}
def code(x, y, z, t): return x + ((z - x) * (y / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) * Float64(y / t))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) * (y / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - x\right) \cdot \frac{y}{t}
\end{array}
Initial program 93.6%
Taylor expanded in z around 0 89.3%
+-commutative89.3%
*-commutative89.3%
associate-*r/87.8%
mul-1-neg87.8%
associate-/l*88.6%
distribute-lft-neg-in88.6%
distribute-rgt-in96.9%
sub-neg96.9%
Simplified96.9%
Final simplification96.9%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 93.6%
Taylor expanded in y around 0 37.1%
(FPCore (x y z t) :precision binary64 (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x - ((x * (y / t)) + (-z * (y / t)))
end function
public static double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
def code(x, y, z, t): return x - ((x * (y / t)) + (-z * (y / t)))
function code(x, y, z, t) return Float64(x - Float64(Float64(x * Float64(y / t)) + Float64(Float64(-z) * Float64(y / t)))) end
function tmp = code(x, y, z, t) tmp = x - ((x * (y / t)) + (-z * (y / t))); end
code[x_, y_, z_, t_] := N[(x - N[(N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision] + N[((-z) * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)
\end{array}
herbie shell --seed 2024116
(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)))