
(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 13 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 89.9%
Taylor expanded in z around 0 85.2%
+-commutative85.2%
*-commutative85.2%
associate-*r/86.8%
mul-1-neg86.8%
associate-/l*88.8%
distribute-lft-neg-in88.8%
distribute-rgt-in98.7%
sub-neg98.7%
Simplified98.7%
*-commutative98.7%
clear-num98.6%
un-div-inv99.2%
Applied egg-rr99.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (/ y t))))
(if (<= z -5.4e+63)
t_1
(if (<= z -1.65e-179)
x
(if (<= z -1.02e-296) (/ x (/ (- t) y)) (if (<= z 260.0) x t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (y / t);
double tmp;
if (z <= -5.4e+63) {
tmp = t_1;
} else if (z <= -1.65e-179) {
tmp = x;
} else if (z <= -1.02e-296) {
tmp = x / (-t / y);
} else if (z <= 260.0) {
tmp = x;
} 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 = z * (y / t)
if (z <= (-5.4d+63)) then
tmp = t_1
else if (z <= (-1.65d-179)) then
tmp = x
else if (z <= (-1.02d-296)) then
tmp = x / (-t / y)
else if (z <= 260.0d0) then
tmp = x
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 = z * (y / t);
double tmp;
if (z <= -5.4e+63) {
tmp = t_1;
} else if (z <= -1.65e-179) {
tmp = x;
} else if (z <= -1.02e-296) {
tmp = x / (-t / y);
} else if (z <= 260.0) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (y / t) tmp = 0 if z <= -5.4e+63: tmp = t_1 elif z <= -1.65e-179: tmp = x elif z <= -1.02e-296: tmp = x / (-t / y) elif z <= 260.0: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(y / t)) tmp = 0.0 if (z <= -5.4e+63) tmp = t_1; elseif (z <= -1.65e-179) tmp = x; elseif (z <= -1.02e-296) tmp = Float64(x / Float64(Float64(-t) / y)); elseif (z <= 260.0) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (y / t); tmp = 0.0; if (z <= -5.4e+63) tmp = t_1; elseif (z <= -1.65e-179) tmp = x; elseif (z <= -1.02e-296) tmp = x / (-t / y); elseif (z <= 260.0) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.4e+63], t$95$1, If[LessEqual[z, -1.65e-179], x, If[LessEqual[z, -1.02e-296], N[(x / N[((-t) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 260.0], x, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{t}\\
\mathbf{if}\;z \leq -5.4 \cdot 10^{+63}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.65 \cdot 10^{-179}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -1.02 \cdot 10^{-296}:\\
\;\;\;\;\frac{x}{\frac{-t}{y}}\\
\mathbf{elif}\;z \leq 260:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.40000000000000035e63 or 260 < z Initial program 88.5%
Taylor expanded in y around -inf 69.8%
Taylor expanded in z around inf 60.4%
associate-/l*81.7%
Simplified62.3%
clear-num81.7%
un-div-inv81.5%
Applied egg-rr62.1%
associate-/r/89.6%
Applied egg-rr70.0%
if -5.40000000000000035e63 < z < -1.6499999999999999e-179 or -1.02000000000000002e-296 < z < 260Initial program 92.5%
Taylor expanded in y around 0 57.0%
if -1.6499999999999999e-179 < z < -1.02000000000000002e-296Initial program 85.1%
Taylor expanded in y around -inf 59.8%
Taylor expanded in z around 0 53.3%
mul-1-neg78.6%
associate-/l*86.1%
distribute-rgt-neg-in86.1%
mul-1-neg86.1%
associate-*r/86.1%
mul-1-neg86.1%
Simplified60.8%
add-sqr-sqrt37.0%
sqrt-unprod26.1%
sqr-neg26.1%
sqrt-unprod0.7%
add-sqr-sqrt1.8%
clear-num1.8%
div-inv1.8%
frac-2neg1.8%
distribute-frac-neg21.8%
add-sqr-sqrt1.1%
sqrt-unprod13.9%
sqr-neg13.9%
sqrt-unprod23.8%
add-sqr-sqrt63.4%
Applied egg-rr63.4%
Final simplification63.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (/ y t))))
(if (<= z -3.7e+62)
t_1
(if (<= z -7e-180)
x
(if (<= z -1.1e-296) (* x (/ y (- t))) (if (<= z 2.2) x t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (y / t);
double tmp;
if (z <= -3.7e+62) {
tmp = t_1;
} else if (z <= -7e-180) {
tmp = x;
} else if (z <= -1.1e-296) {
tmp = x * (y / -t);
} else if (z <= 2.2) {
tmp = x;
} 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 = z * (y / t)
if (z <= (-3.7d+62)) then
tmp = t_1
else if (z <= (-7d-180)) then
tmp = x
else if (z <= (-1.1d-296)) then
tmp = x * (y / -t)
else if (z <= 2.2d0) then
tmp = x
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 = z * (y / t);
double tmp;
if (z <= -3.7e+62) {
tmp = t_1;
} else if (z <= -7e-180) {
tmp = x;
} else if (z <= -1.1e-296) {
tmp = x * (y / -t);
} else if (z <= 2.2) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (y / t) tmp = 0 if z <= -3.7e+62: tmp = t_1 elif z <= -7e-180: tmp = x elif z <= -1.1e-296: tmp = x * (y / -t) elif z <= 2.2: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(y / t)) tmp = 0.0 if (z <= -3.7e+62) tmp = t_1; elseif (z <= -7e-180) tmp = x; elseif (z <= -1.1e-296) tmp = Float64(x * Float64(y / Float64(-t))); elseif (z <= 2.2) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (y / t); tmp = 0.0; if (z <= -3.7e+62) tmp = t_1; elseif (z <= -7e-180) tmp = x; elseif (z <= -1.1e-296) tmp = x * (y / -t); elseif (z <= 2.2) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.7e+62], t$95$1, If[LessEqual[z, -7e-180], x, If[LessEqual[z, -1.1e-296], N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2], x, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{t}\\
\mathbf{if}\;z \leq -3.7 \cdot 10^{+62}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -7 \cdot 10^{-180}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{-296}:\\
\;\;\;\;x \cdot \frac{y}{-t}\\
\mathbf{elif}\;z \leq 2.2:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.70000000000000014e62 or 2.2000000000000002 < z Initial program 88.5%
Taylor expanded in y around -inf 69.8%
Taylor expanded in z around inf 60.4%
associate-/l*81.7%
Simplified62.3%
clear-num81.7%
un-div-inv81.5%
Applied egg-rr62.1%
associate-/r/89.6%
Applied egg-rr70.0%
if -3.70000000000000014e62 < z < -7.0000000000000001e-180 or -1.10000000000000006e-296 < z < 2.2000000000000002Initial program 92.5%
Taylor expanded in y around 0 57.0%
if -7.0000000000000001e-180 < z < -1.10000000000000006e-296Initial program 85.1%
Taylor expanded in y around -inf 59.8%
Taylor expanded in z around 0 53.3%
mul-1-neg78.6%
associate-/l*86.1%
distribute-rgt-neg-in86.1%
mul-1-neg86.1%
associate-*r/86.1%
mul-1-neg86.1%
Simplified60.8%
Final simplification63.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* z (/ y t)))))
(if (<= z -8.5e-6)
t_1
(if (<= z 0.5)
(- x (* x (/ y t)))
(if (<= z 5.5e+150) (/ (- z x) (/ t y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x + (z * (y / t));
double tmp;
if (z <= -8.5e-6) {
tmp = t_1;
} else if (z <= 0.5) {
tmp = x - (x * (y / t));
} else if (z <= 5.5e+150) {
tmp = (z - x) / (t / y);
} 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 + (z * (y / t))
if (z <= (-8.5d-6)) then
tmp = t_1
else if (z <= 0.5d0) then
tmp = x - (x * (y / t))
else if (z <= 5.5d+150) then
tmp = (z - x) / (t / y)
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 + (z * (y / t));
double tmp;
if (z <= -8.5e-6) {
tmp = t_1;
} else if (z <= 0.5) {
tmp = x - (x * (y / t));
} else if (z <= 5.5e+150) {
tmp = (z - x) / (t / y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (z * (y / t)) tmp = 0 if z <= -8.5e-6: tmp = t_1 elif z <= 0.5: tmp = x - (x * (y / t)) elif z <= 5.5e+150: tmp = (z - x) / (t / y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(z * Float64(y / t))) tmp = 0.0 if (z <= -8.5e-6) tmp = t_1; elseif (z <= 0.5) tmp = Float64(x - Float64(x * Float64(y / t))); elseif (z <= 5.5e+150) tmp = Float64(Float64(z - x) / Float64(t / y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (z * (y / t)); tmp = 0.0; if (z <= -8.5e-6) tmp = t_1; elseif (z <= 0.5) tmp = x - (x * (y / t)); elseif (z <= 5.5e+150) tmp = (z - x) / (t / y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.5e-6], t$95$1, If[LessEqual[z, 0.5], N[(x - N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.5e+150], N[(N[(z - x), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot \frac{y}{t}\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x - x \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{+150}:\\
\;\;\;\;\frac{z - x}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.4999999999999999e-6 or 5.50000000000000017e150 < z Initial program 86.9%
Taylor expanded in z around inf 85.1%
associate-/l*87.1%
Simplified87.1%
clear-num87.1%
un-div-inv86.2%
Applied egg-rr86.2%
associate-/r/94.9%
Applied egg-rr94.9%
if -8.4999999999999999e-6 < z < 0.5Initial program 92.5%
Taylor expanded in z around 0 82.1%
mul-1-neg82.1%
associate-/l*86.7%
distribute-rgt-neg-in86.7%
mul-1-neg86.7%
associate-*r/86.7%
mul-1-neg86.7%
Simplified86.7%
if 0.5 < z < 5.50000000000000017e150Initial program 89.1%
Taylor expanded in y around -inf 81.1%
associate-/l*81.0%
*-commutative81.0%
Applied egg-rr81.0%
associate-/r/89.0%
Applied egg-rr89.0%
Final simplification90.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* z (/ y t)))))
(if (<= z -0.012)
t_1
(if (<= z 2600000.0)
(* x (- 1.0 (/ y t)))
(if (<= z 5.5e+150) (/ (- z x) (/ t y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x + (z * (y / t));
double tmp;
if (z <= -0.012) {
tmp = t_1;
} else if (z <= 2600000.0) {
tmp = x * (1.0 - (y / t));
} else if (z <= 5.5e+150) {
tmp = (z - x) / (t / y);
} 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 + (z * (y / t))
if (z <= (-0.012d0)) then
tmp = t_1
else if (z <= 2600000.0d0) then
tmp = x * (1.0d0 - (y / t))
else if (z <= 5.5d+150) then
tmp = (z - x) / (t / y)
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 + (z * (y / t));
double tmp;
if (z <= -0.012) {
tmp = t_1;
} else if (z <= 2600000.0) {
tmp = x * (1.0 - (y / t));
} else if (z <= 5.5e+150) {
tmp = (z - x) / (t / y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (z * (y / t)) tmp = 0 if z <= -0.012: tmp = t_1 elif z <= 2600000.0: tmp = x * (1.0 - (y / t)) elif z <= 5.5e+150: tmp = (z - x) / (t / y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(z * Float64(y / t))) tmp = 0.0 if (z <= -0.012) tmp = t_1; elseif (z <= 2600000.0) tmp = Float64(x * Float64(1.0 - Float64(y / t))); elseif (z <= 5.5e+150) tmp = Float64(Float64(z - x) / Float64(t / y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (z * (y / t)); tmp = 0.0; if (z <= -0.012) tmp = t_1; elseif (z <= 2600000.0) tmp = x * (1.0 - (y / t)); elseif (z <= 5.5e+150) tmp = (z - x) / (t / y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.012], t$95$1, If[LessEqual[z, 2600000.0], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.5e+150], N[(N[(z - x), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot \frac{y}{t}\\
\mathbf{if}\;z \leq -0.012:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2600000:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{+150}:\\
\;\;\;\;\frac{z - x}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.012 or 5.50000000000000017e150 < z Initial program 86.9%
Taylor expanded in z around inf 85.1%
associate-/l*87.1%
Simplified87.1%
clear-num87.1%
un-div-inv86.2%
Applied egg-rr86.2%
associate-/r/94.9%
Applied egg-rr94.9%
if -0.012 < z < 2.6e6Initial program 92.5%
Taylor expanded in x around inf 86.7%
mul-1-neg86.7%
unsub-neg86.7%
Simplified86.7%
if 2.6e6 < z < 5.50000000000000017e150Initial program 89.1%
Taylor expanded in y around -inf 81.1%
associate-/l*81.0%
*-commutative81.0%
Applied egg-rr81.0%
associate-/r/89.0%
Applied egg-rr89.0%
Final simplification90.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* z (/ y t)))))
(if (<= z -3.6e-5)
t_1
(if (<= z 52000000.0)
(* x (- 1.0 (/ y t)))
(if (<= z 5.5e+150) (* (- z x) (/ y t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x + (z * (y / t));
double tmp;
if (z <= -3.6e-5) {
tmp = t_1;
} else if (z <= 52000000.0) {
tmp = x * (1.0 - (y / t));
} else if (z <= 5.5e+150) {
tmp = (z - x) * (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 + (z * (y / t))
if (z <= (-3.6d-5)) then
tmp = t_1
else if (z <= 52000000.0d0) then
tmp = x * (1.0d0 - (y / t))
else if (z <= 5.5d+150) then
tmp = (z - x) * (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 + (z * (y / t));
double tmp;
if (z <= -3.6e-5) {
tmp = t_1;
} else if (z <= 52000000.0) {
tmp = x * (1.0 - (y / t));
} else if (z <= 5.5e+150) {
tmp = (z - x) * (y / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (z * (y / t)) tmp = 0 if z <= -3.6e-5: tmp = t_1 elif z <= 52000000.0: tmp = x * (1.0 - (y / t)) elif z <= 5.5e+150: tmp = (z - x) * (y / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(z * Float64(y / t))) tmp = 0.0 if (z <= -3.6e-5) tmp = t_1; elseif (z <= 52000000.0) tmp = Float64(x * Float64(1.0 - Float64(y / t))); elseif (z <= 5.5e+150) tmp = Float64(Float64(z - x) * Float64(y / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (z * (y / t)); tmp = 0.0; if (z <= -3.6e-5) tmp = t_1; elseif (z <= 52000000.0) tmp = x * (1.0 - (y / t)); elseif (z <= 5.5e+150) tmp = (z - x) * (y / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.6e-5], t$95$1, If[LessEqual[z, 52000000.0], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.5e+150], N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot \frac{y}{t}\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 52000000:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{+150}:\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.60000000000000009e-5 or 5.50000000000000017e150 < z Initial program 86.9%
Taylor expanded in z around inf 85.1%
associate-/l*87.1%
Simplified87.1%
clear-num87.1%
un-div-inv86.2%
Applied egg-rr86.2%
associate-/r/94.9%
Applied egg-rr94.9%
if -3.60000000000000009e-5 < z < 5.2e7Initial program 92.5%
Taylor expanded in x around inf 86.7%
mul-1-neg86.7%
unsub-neg86.7%
Simplified86.7%
if 5.2e7 < z < 5.50000000000000017e150Initial program 89.1%
Taylor expanded in y around -inf 81.1%
Taylor expanded in z around 0 75.2%
+-commutative83.2%
*-commutative83.2%
associate-*r/88.5%
mul-1-neg88.5%
associate-/l*85.4%
distribute-lft-neg-in85.4%
distribute-rgt-in99.7%
sub-neg99.7%
Simplified88.9%
Final simplification90.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* y (/ z t)))))
(if (<= z -6.4e+40)
t_1
(if (<= z 0.5)
(* x (- 1.0 (/ y t)))
(if (<= z 9e+159) (* (- z x) (/ y t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x + (y * (z / t));
double tmp;
if (z <= -6.4e+40) {
tmp = t_1;
} else if (z <= 0.5) {
tmp = x * (1.0 - (y / t));
} else if (z <= 9e+159) {
tmp = (z - x) * (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 (z <= (-6.4d+40)) then
tmp = t_1
else if (z <= 0.5d0) then
tmp = x * (1.0d0 - (y / t))
else if (z <= 9d+159) then
tmp = (z - x) * (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 (z <= -6.4e+40) {
tmp = t_1;
} else if (z <= 0.5) {
tmp = x * (1.0 - (y / t));
} else if (z <= 9e+159) {
tmp = (z - x) * (y / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (y * (z / t)) tmp = 0 if z <= -6.4e+40: tmp = t_1 elif z <= 0.5: tmp = x * (1.0 - (y / t)) elif z <= 9e+159: tmp = (z - x) * (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 (z <= -6.4e+40) tmp = t_1; elseif (z <= 0.5) tmp = Float64(x * Float64(1.0 - Float64(y / t))); elseif (z <= 9e+159) tmp = Float64(Float64(z - x) * 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 (z <= -6.4e+40) tmp = t_1; elseif (z <= 0.5) tmp = x * (1.0 - (y / t)); elseif (z <= 9e+159) tmp = (z - x) * (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[z, -6.4e+40], t$95$1, If[LessEqual[z, 0.5], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9e+159], N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z}{t}\\
\mathbf{if}\;z \leq -6.4 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+159}:\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.39999999999999961e40 or 9.00000000000000053e159 < z Initial program 88.7%
Taylor expanded in z around inf 85.6%
associate-/l*87.9%
Simplified87.9%
if -6.39999999999999961e40 < z < 0.5Initial program 91.5%
Taylor expanded in x around inf 86.8%
mul-1-neg86.8%
unsub-neg86.8%
Simplified86.8%
if 0.5 < z < 9.00000000000000053e159Initial program 87.1%
Taylor expanded in y around -inf 79.5%
Taylor expanded in z around 0 73.9%
+-commutative81.5%
*-commutative81.5%
associate-*r/89.1%
mul-1-neg89.1%
associate-/l*86.2%
distribute-lft-neg-in86.2%
distribute-rgt-in99.7%
sub-neg99.7%
Simplified89.4%
Final simplification87.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9.8e+60) (not (<= z 0.8))) (* (- z x) (/ y t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.8e+60) || !(z <= 0.8)) {
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 <= (-9.8d+60)) .or. (.not. (z <= 0.8d0))) 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 <= -9.8e+60) || !(z <= 0.8)) {
tmp = (z - x) * (y / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9.8e+60) or not (z <= 0.8): 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 <= -9.8e+60) || !(z <= 0.8)) 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 <= -9.8e+60) || ~((z <= 0.8))) 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, -9.8e+60], N[Not[LessEqual[z, 0.8]], $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 -9.8 \cdot 10^{+60} \lor \neg \left(z \leq 0.8\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 < -9.8000000000000005e60 or 0.80000000000000004 < z Initial program 88.5%
Taylor expanded in y around -inf 69.8%
Taylor expanded in z around 0 61.9%
+-commutative80.6%
*-commutative80.6%
associate-*r/89.4%
mul-1-neg89.4%
associate-/l*86.7%
distribute-lft-neg-in86.7%
distribute-rgt-in99.6%
sub-neg99.6%
Simplified80.2%
if -9.8000000000000005e60 < z < 0.80000000000000004Initial program 91.1%
Taylor expanded in x around inf 86.5%
mul-1-neg86.5%
unsub-neg86.5%
Simplified86.5%
Final simplification83.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.4e+184) (not (<= z 4.2e+40))) (* z (/ y t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.4e+184) || !(z <= 4.2e+40)) {
tmp = 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 <= (-1.4d+184)) .or. (.not. (z <= 4.2d+40))) then
tmp = 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 <= -1.4e+184) || !(z <= 4.2e+40)) {
tmp = z * (y / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.4e+184) or not (z <= 4.2e+40): tmp = z * (y / t) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.4e+184) || !(z <= 4.2e+40)) tmp = 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 <= -1.4e+184) || ~((z <= 4.2e+40))) tmp = z * (y / t); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.4e+184], N[Not[LessEqual[z, 4.2e+40]], $MachinePrecision]], N[(z * 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 -1.4 \cdot 10^{+184} \lor \neg \left(z \leq 4.2 \cdot 10^{+40}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -1.39999999999999995e184 or 4.2000000000000002e40 < z Initial program 86.9%
Taylor expanded in y around -inf 69.7%
Taylor expanded in z around inf 63.8%
associate-/l*82.3%
Simplified64.2%
clear-num82.3%
un-div-inv82.3%
Applied egg-rr64.2%
associate-/r/92.7%
Applied egg-rr74.4%
if -1.39999999999999995e184 < z < 4.2000000000000002e40Initial program 91.5%
Taylor expanded in x around inf 82.0%
mul-1-neg82.0%
unsub-neg82.0%
Simplified82.0%
Final simplification79.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.5e+66) (not (<= z 0.082))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.5e+66) || !(z <= 0.082)) {
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 ((z <= (-4.5d+66)) .or. (.not. (z <= 0.082d0))) 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 ((z <= -4.5e+66) || !(z <= 0.082)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.5e+66) or not (z <= 0.082): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.5e+66) || !(z <= 0.082)) 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 ((z <= -4.5e+66) || ~((z <= 0.082))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.5e+66], N[Not[LessEqual[z, 0.082]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+66} \lor \neg \left(z \leq 0.082\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.4999999999999998e66 or 0.0820000000000000034 < z Initial program 88.5%
Taylor expanded in y around -inf 69.8%
Taylor expanded in z around inf 60.4%
associate-/l*81.7%
Simplified62.3%
clear-num81.7%
un-div-inv81.5%
Applied egg-rr62.1%
associate-/r/89.6%
Applied egg-rr70.0%
if -4.4999999999999998e66 < z < 0.0820000000000000034Initial program 91.1%
Taylor expanded in y around 0 51.4%
Final simplification59.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.2e+62) (not (<= z 14000.0))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.2e+62) || !(z <= 14000.0)) {
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 ((z <= (-6.2d+62)) .or. (.not. (z <= 14000.0d0))) 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 ((z <= -6.2e+62) || !(z <= 14000.0)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.2e+62) or not (z <= 14000.0): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.2e+62) || !(z <= 14000.0)) 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 ((z <= -6.2e+62) || ~((z <= 14000.0))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.2e+62], N[Not[LessEqual[z, 14000.0]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+62} \lor \neg \left(z \leq 14000\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -6.20000000000000029e62 or 14000 < z Initial program 88.5%
Taylor expanded in y around -inf 69.8%
Taylor expanded in z around inf 60.4%
associate-/l*81.7%
Simplified62.3%
if -6.20000000000000029e62 < z < 14000Initial program 91.1%
Taylor expanded in y around 0 51.4%
Final simplification56.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 89.9%
Taylor expanded in z around 0 85.2%
+-commutative85.2%
*-commutative85.2%
associate-*r/86.8%
mul-1-neg86.8%
associate-/l*88.8%
distribute-lft-neg-in88.8%
distribute-rgt-in98.7%
sub-neg98.7%
Simplified98.7%
Final simplification98.7%
(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 89.9%
Taylor expanded in y around 0 37.8%
(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 2024107
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:alt
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))