
(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
(let* ((t_1 (+ x (/ (* y (- z x)) t))))
(if (or (<= t_1 -4e+278) (not (<= t_1 5e+288)))
(+ x (* (- z x) (/ y t)))
(+ x (/ (- (* y z) (* x y)) t)))))
double code(double x, double y, double z, double t) {
double t_1 = x + ((y * (z - x)) / t);
double tmp;
if ((t_1 <= -4e+278) || !(t_1 <= 5e+288)) {
tmp = x + ((z - x) * (y / t));
} else {
tmp = x + (((y * 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) :: t_1
real(8) :: tmp
t_1 = x + ((y * (z - x)) / t)
if ((t_1 <= (-4d+278)) .or. (.not. (t_1 <= 5d+288))) then
tmp = x + ((z - x) * (y / t))
else
tmp = x + (((y * z) - (x * y)) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + ((y * (z - x)) / t);
double tmp;
if ((t_1 <= -4e+278) || !(t_1 <= 5e+288)) {
tmp = x + ((z - x) * (y / t));
} else {
tmp = x + (((y * z) - (x * y)) / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((y * (z - x)) / t) tmp = 0 if (t_1 <= -4e+278) or not (t_1 <= 5e+288): tmp = x + ((z - x) * (y / t)) else: tmp = x + (((y * z) - (x * y)) / t) return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(y * Float64(z - x)) / t)) tmp = 0.0 if ((t_1 <= -4e+278) || !(t_1 <= 5e+288)) tmp = Float64(x + Float64(Float64(z - x) * Float64(y / t))); else tmp = Float64(x + Float64(Float64(Float64(y * z) - Float64(x * y)) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + ((y * (z - x)) / t); tmp = 0.0; if ((t_1 <= -4e+278) || ~((t_1 <= 5e+288))) tmp = x + ((z - x) * (y / t)); else tmp = x + (((y * z) - (x * y)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -4e+278], N[Not[LessEqual[t$95$1, 5e+288]], $MachinePrecision]], N[(x + N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(y * z), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+278} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+288}\right):\\
\;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z - x \cdot y}{t}\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -3.99999999999999985e278 or 5.0000000000000003e288 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 82.2%
Taylor expanded in z around 0 67.5%
+-commutative67.5%
*-commutative67.5%
associate-*r/71.2%
mul-1-neg71.2%
associate-/l*71.9%
distribute-lft-neg-in71.9%
distribute-rgt-in99.9%
sub-neg99.9%
Simplified99.9%
if -3.99999999999999985e278 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 5.0000000000000003e288Initial program 99.8%
sub-neg99.8%
distribute-rgt-in99.8%
Applied egg-rr99.8%
distribute-lft-neg-out99.8%
unsub-neg99.8%
*-commutative99.8%
*-commutative99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* y (- z x)) t))))
(if (or (<= t_1 -4e+278) (not (<= t_1 5e+288)))
(+ x (* (- z x) (/ y t)))
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = x + ((y * (z - x)) / t);
double tmp;
if ((t_1 <= -4e+278) || !(t_1 <= 5e+288)) {
tmp = x + ((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 - x)) / t)
if ((t_1 <= (-4d+278)) .or. (.not. (t_1 <= 5d+288))) then
tmp = x + ((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 - x)) / t);
double tmp;
if ((t_1 <= -4e+278) || !(t_1 <= 5e+288)) {
tmp = x + ((z - x) * (y / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((y * (z - x)) / t) tmp = 0 if (t_1 <= -4e+278) or not (t_1 <= 5e+288): tmp = x + ((z - x) * (y / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(y * Float64(z - x)) / t)) tmp = 0.0 if ((t_1 <= -4e+278) || !(t_1 <= 5e+288)) tmp = Float64(x + 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 - x)) / t); tmp = 0.0; if ((t_1 <= -4e+278) || ~((t_1 <= 5e+288))) tmp = x + ((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[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -4e+278], N[Not[LessEqual[t$95$1, 5e+288]], $MachinePrecision]], N[(x + N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+278} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+288}\right):\\
\;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -3.99999999999999985e278 or 5.0000000000000003e288 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 82.2%
Taylor expanded in z around 0 67.5%
+-commutative67.5%
*-commutative67.5%
associate-*r/71.2%
mul-1-neg71.2%
associate-/l*71.9%
distribute-lft-neg-in71.9%
distribute-rgt-in99.9%
sub-neg99.9%
Simplified99.9%
if -3.99999999999999985e278 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 5.0000000000000003e288Initial program 99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.8e-122) (not (<= x 1.02e-150))) (* x (- 1.0 (/ y t))) (/ (* y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.8e-122) || !(x <= 1.02e-150)) {
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 <= (-7.8d-122)) .or. (.not. (x <= 1.02d-150))) 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 <= -7.8e-122) || !(x <= 1.02e-150)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y * z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.8e-122) or not (x <= 1.02e-150): tmp = x * (1.0 - (y / t)) else: tmp = (y * z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7.8e-122) || !(x <= 1.02e-150)) 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 <= -7.8e-122) || ~((x <= 1.02e-150))) 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, -7.8e-122], N[Not[LessEqual[x, 1.02e-150]], $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 -7.8 \cdot 10^{-122} \lor \neg \left(x \leq 1.02 \cdot 10^{-150}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\end{array}
\end{array}
if x < -7.79999999999999979e-122 or 1.0199999999999999e-150 < x Initial program 92.9%
Taylor expanded in x around inf 81.9%
mul-1-neg81.9%
unsub-neg81.9%
Simplified81.9%
if -7.79999999999999979e-122 < x < 1.0199999999999999e-150Initial program 98.5%
Taylor expanded in y around -inf 83.1%
Taylor expanded in z around inf 72.4%
Final simplification78.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -0.00185) (not (<= y 6.5e+60))) (* (- z x) (/ y t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -0.00185) || !(y <= 6.5e+60)) {
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 ((y <= (-0.00185d0)) .or. (.not. (y <= 6.5d+60))) 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 ((y <= -0.00185) || !(y <= 6.5e+60)) {
tmp = (z - x) * (y / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -0.00185) or not (y <= 6.5e+60): tmp = (z - x) * (y / t) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -0.00185) || !(y <= 6.5e+60)) 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 ((y <= -0.00185) || ~((y <= 6.5e+60))) 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[y, -0.00185], N[Not[LessEqual[y, 6.5e+60]], $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}\;y \leq -0.00185 \lor \neg \left(y \leq 6.5 \cdot 10^{+60}\right):\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if y < -0.0018500000000000001 or 6.49999999999999931e60 < y Initial program 88.5%
Taylor expanded in y around -inf 83.0%
Taylor expanded in z around 0 73.7%
+-commutative79.1%
*-commutative79.1%
associate-*r/76.6%
mul-1-neg76.6%
associate-/l*77.9%
distribute-lft-neg-in77.9%
distribute-rgt-in95.0%
sub-neg95.0%
Simplified87.0%
if -0.0018500000000000001 < y < 6.49999999999999931e60Initial program 99.9%
Taylor expanded in x around inf 76.5%
mul-1-neg76.5%
unsub-neg76.5%
Simplified76.5%
Final simplification81.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.14) (not (<= x 5.4e-37))) (* x (- 1.0 (/ y t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.14) || !(x <= 5.4e-37)) {
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 <= (-0.14d0)) .or. (.not. (x <= 5.4d-37))) 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 <= -0.14) || !(x <= 5.4e-37)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -0.14) or not (x <= 5.4e-37): 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 <= -0.14) || !(x <= 5.4e-37)) 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 <= -0.14) || ~((x <= 5.4e-37))) 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, -0.14], N[Not[LessEqual[x, 5.4e-37]], $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 -0.14 \lor \neg \left(x \leq 5.4 \cdot 10^{-37}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -0.14000000000000001 or 5.40000000000000032e-37 < x Initial program 92.0%
Taylor expanded in x around inf 88.8%
mul-1-neg88.8%
unsub-neg88.8%
Simplified88.8%
if -0.14000000000000001 < x < 5.40000000000000032e-37Initial program 97.4%
Taylor expanded in z around inf 83.3%
associate-/l*60.4%
Simplified83.2%
Final simplification86.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.028) (not (<= x 4.6e+16))) (* x (- 1.0 (/ y t))) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.028) || !(x <= 4.6e+16)) {
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 <= (-0.028d0)) .or. (.not. (x <= 4.6d+16))) 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 <= -0.028) || !(x <= 4.6e+16)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -0.028) or not (x <= 4.6e+16): 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 <= -0.028) || !(x <= 4.6e+16)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(Float64(y * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -0.028) || ~((x <= 4.6e+16))) 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, -0.028], N[Not[LessEqual[x, 4.6e+16]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.028 \lor \neg \left(x \leq 4.6 \cdot 10^{+16}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if x < -0.0280000000000000006 or 4.6e16 < x Initial program 91.5%
Taylor expanded in x around inf 89.6%
mul-1-neg89.6%
unsub-neg89.6%
Simplified89.6%
if -0.0280000000000000006 < x < 4.6e16Initial program 97.6%
Taylor expanded in z around inf 83.1%
Final simplification86.2%
(FPCore (x y z t) :precision binary64 (if (<= x -0.35) (* x (- 1.0 (/ y t))) (if (<= x 6.6e+16) (+ x (/ (* y z) t)) (- x (/ x (/ t y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.35) {
tmp = x * (1.0 - (y / t));
} else if (x <= 6.6e+16) {
tmp = x + ((y * z) / t);
} else {
tmp = x - (x / (t / y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-0.35d0)) then
tmp = x * (1.0d0 - (y / t))
else if (x <= 6.6d+16) then
tmp = x + ((y * z) / t)
else
tmp = x - (x / (t / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.35) {
tmp = x * (1.0 - (y / t));
} else if (x <= 6.6e+16) {
tmp = x + ((y * z) / t);
} else {
tmp = x - (x / (t / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -0.35: tmp = x * (1.0 - (y / t)) elif x <= 6.6e+16: tmp = x + ((y * z) / t) else: tmp = x - (x / (t / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -0.35) tmp = Float64(x * Float64(1.0 - Float64(y / t))); elseif (x <= 6.6e+16) tmp = Float64(x + Float64(Float64(y * z) / t)); else tmp = Float64(x - Float64(x / Float64(t / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -0.35) tmp = x * (1.0 - (y / t)); elseif (x <= 6.6e+16) tmp = x + ((y * z) / t); else tmp = x - (x / (t / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -0.35], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.6e+16], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x - N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.35:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{+16}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{x}{\frac{t}{y}}\\
\end{array}
\end{array}
if x < -0.34999999999999998Initial program 91.6%
Taylor expanded in x around inf 90.0%
mul-1-neg90.0%
unsub-neg90.0%
Simplified90.0%
if -0.34999999999999998 < x < 6.6e16Initial program 97.6%
Taylor expanded in z around inf 83.1%
if 6.6e16 < x Initial program 91.4%
Taylor expanded in z around 0 87.7%
+-commutative87.7%
*-commutative87.7%
associate-*r/85.9%
mul-1-neg85.9%
associate-/l*92.7%
distribute-lft-neg-in92.7%
distribute-rgt-in99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around 0 84.0%
associate-*r/84.0%
associate-*r*84.0%
mul-1-neg84.0%
Simplified84.0%
associate-/l*89.2%
add-sqr-sqrt0.0%
sqrt-unprod12.8%
sqr-neg12.8%
sqrt-unprod37.3%
add-sqr-sqrt37.3%
cancel-sign-sub37.3%
clear-num37.3%
un-div-inv37.3%
add-sqr-sqrt0.0%
sqrt-unprod59.6%
sqr-neg59.6%
sqrt-unprod89.3%
add-sqr-sqrt89.3%
Applied egg-rr89.3%
Final simplification86.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -320000.0) (not (<= y 1.25e+61))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -320000.0) || !(y <= 1.25e+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 <= (-320000.0d0)) .or. (.not. (y <= 1.25d+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 <= -320000.0) || !(y <= 1.25e+61)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -320000.0) or not (y <= 1.25e+61): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -320000.0) || !(y <= 1.25e+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 <= -320000.0) || ~((y <= 1.25e+61))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -320000.0], N[Not[LessEqual[y, 1.25e+61]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -320000 \lor \neg \left(y \leq 1.25 \cdot 10^{+61}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.2e5 or 1.25000000000000004e61 < y Initial program 89.2%
Taylor expanded in y around -inf 83.7%
Taylor expanded in z around inf 50.4%
associate-/l*54.2%
Simplified54.2%
if -3.2e5 < y < 1.25000000000000004e61Initial program 99.2%
Taylor expanded in y around 0 58.7%
Final simplification56.6%
(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 94.6%
Taylor expanded in z around 0 90.3%
+-commutative90.3%
*-commutative90.3%
associate-*r/88.2%
mul-1-neg88.2%
associate-/l*88.4%
distribute-lft-neg-in88.4%
distribute-rgt-in96.7%
sub-neg96.7%
Simplified96.7%
Final simplification96.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 94.6%
Taylor expanded in y around 0 36.1%
Final simplification36.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 2024067
(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)))