
(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 9 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 (* (/ y t) (- z x))))
double code(double x, double y, double z, double t) {
return x + ((y / t) * (z - 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 + ((y / t) * (z - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y / t) * (z - x));
}
def code(x, y, z, t): return x + ((y / t) * (z - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y / t) * Float64(z - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y / t) * (z - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{t} \cdot \left(z - x\right)
\end{array}
Initial program 94.4%
Taylor expanded in z around 0 90.8%
+-commutative90.8%
mul-1-neg90.8%
*-commutative90.8%
associate-/l*90.1%
associate-/l*93.7%
distribute-lft-neg-in93.7%
distribute-rgt-in98.4%
sub-neg98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ y (- t)))))
(if (<= y -9e+43)
t_1
(if (<= y -5.4e-139)
(* y (/ z t))
(if (<= y 7.6e-20)
x
(if (<= y 3.3e+75) t_1 (if (<= y 2.8e+109) x (* (/ y t) z))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (y / -t);
double tmp;
if (y <= -9e+43) {
tmp = t_1;
} else if (y <= -5.4e-139) {
tmp = y * (z / t);
} else if (y <= 7.6e-20) {
tmp = x;
} else if (y <= 3.3e+75) {
tmp = t_1;
} else if (y <= 2.8e+109) {
tmp = x;
} 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) :: t_1
real(8) :: tmp
t_1 = x * (y / -t)
if (y <= (-9d+43)) then
tmp = t_1
else if (y <= (-5.4d-139)) then
tmp = y * (z / t)
else if (y <= 7.6d-20) then
tmp = x
else if (y <= 3.3d+75) then
tmp = t_1
else if (y <= 2.8d+109) then
tmp = x
else
tmp = (y / t) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (y / -t);
double tmp;
if (y <= -9e+43) {
tmp = t_1;
} else if (y <= -5.4e-139) {
tmp = y * (z / t);
} else if (y <= 7.6e-20) {
tmp = x;
} else if (y <= 3.3e+75) {
tmp = t_1;
} else if (y <= 2.8e+109) {
tmp = x;
} else {
tmp = (y / t) * z;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (y / -t) tmp = 0 if y <= -9e+43: tmp = t_1 elif y <= -5.4e-139: tmp = y * (z / t) elif y <= 7.6e-20: tmp = x elif y <= 3.3e+75: tmp = t_1 elif y <= 2.8e+109: tmp = x else: tmp = (y / t) * z return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(y / Float64(-t))) tmp = 0.0 if (y <= -9e+43) tmp = t_1; elseif (y <= -5.4e-139) tmp = Float64(y * Float64(z / t)); elseif (y <= 7.6e-20) tmp = x; elseif (y <= 3.3e+75) tmp = t_1; elseif (y <= 2.8e+109) tmp = x; else tmp = Float64(Float64(y / t) * z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (y / -t); tmp = 0.0; if (y <= -9e+43) tmp = t_1; elseif (y <= -5.4e-139) tmp = y * (z / t); elseif (y <= 7.6e-20) tmp = x; elseif (y <= 3.3e+75) tmp = t_1; elseif (y <= 2.8e+109) tmp = x; else tmp = (y / t) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9e+43], t$95$1, If[LessEqual[y, -5.4e-139], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.6e-20], x, If[LessEqual[y, 3.3e+75], t$95$1, If[LessEqual[y, 2.8e+109], x, N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{-t}\\
\mathbf{if}\;y \leq -9 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -5.4 \cdot 10^{-139}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{-20}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+75}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+109}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\end{array}
\end{array}
if y < -9e43 or 7.5999999999999995e-20 < y < 3.29999999999999998e75Initial program 91.5%
Taylor expanded in x around inf 80.7%
mul-1-neg80.7%
unsub-neg80.7%
Simplified80.7%
Taylor expanded in y around inf 64.8%
mul-1-neg64.8%
distribute-frac-neg64.8%
Simplified64.8%
if -9e43 < y < -5.3999999999999997e-139Initial program 96.0%
Taylor expanded in y around -inf 71.1%
Taylor expanded in z around inf 60.2%
associate-/l*64.0%
Simplified64.0%
if -5.3999999999999997e-139 < y < 7.5999999999999995e-20 or 3.29999999999999998e75 < y < 2.8000000000000002e109Initial program 98.1%
Taylor expanded in y around 0 73.0%
if 2.8000000000000002e109 < y Initial program 89.2%
Taylor expanded in y around -inf 85.1%
Taylor expanded in z around inf 57.1%
associate-*l/65.1%
Applied egg-rr65.1%
Final simplification68.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.9e-51) (not (<= x 1.35e-30))) (* x (- 1.0 (/ y t))) (* (/ y t) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.9e-51) || !(x <= 1.35e-30)) {
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 ((x <= (-2.9d-51)) .or. (.not. (x <= 1.35d-30))) 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 ((x <= -2.9e-51) || !(x <= 1.35e-30)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y / t) * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.9e-51) or not (x <= 1.35e-30): tmp = x * (1.0 - (y / t)) else: tmp = (y / t) * z return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.9e-51) || !(x <= 1.35e-30)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(Float64(y / t) * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.9e-51) || ~((x <= 1.35e-30))) tmp = x * (1.0 - (y / t)); else tmp = (y / t) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.9e-51], N[Not[LessEqual[x, 1.35e-30]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{-51} \lor \neg \left(x \leq 1.35 \cdot 10^{-30}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\end{array}
\end{array}
if x < -2.89999999999999973e-51 or 1.34999999999999994e-30 < x Initial program 94.3%
Taylor expanded in x around inf 91.0%
mul-1-neg91.0%
unsub-neg91.0%
Simplified91.0%
if -2.89999999999999973e-51 < x < 1.34999999999999994e-30Initial program 94.4%
Taylor expanded in y around -inf 69.0%
Taylor expanded in z around inf 62.7%
associate-*l/65.7%
Applied egg-rr65.7%
Final simplification82.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.1e-47) (not (<= x 9.2e-27))) (* x (- 1.0 (/ y t))) (* y (/ (- z x) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.1e-47) || !(x <= 9.2e-27)) {
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 ((x <= (-1.1d-47)) .or. (.not. (x <= 9.2d-27))) 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 ((x <= -1.1e-47) || !(x <= 9.2e-27)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y * ((z - x) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.1e-47) or not (x <= 9.2e-27): tmp = x * (1.0 - (y / t)) else: tmp = y * ((z - x) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.1e-47) || !(x <= 9.2e-27)) 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 ((x <= -1.1e-47) || ~((x <= 9.2e-27))) 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[x, -1.1e-47], N[Not[LessEqual[x, 9.2e-27]], $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}\;x \leq -1.1 \cdot 10^{-47} \lor \neg \left(x \leq 9.2 \cdot 10^{-27}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\end{array}
\end{array}
if x < -1.10000000000000009e-47 or 9.1999999999999998e-27 < x Initial program 94.3%
Taylor expanded in x around inf 91.0%
mul-1-neg91.0%
unsub-neg91.0%
Simplified91.0%
if -1.10000000000000009e-47 < x < 9.1999999999999998e-27Initial program 94.4%
Taylor expanded in y around -inf 69.0%
associate-/l*71.3%
*-commutative71.3%
Applied egg-rr71.3%
Final simplification84.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.1e-14) (not (<= x 3.6e-27))) (* x (- 1.0 (/ y t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.1e-14) || !(x <= 3.6e-27)) {
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 <= (-1.1d-14)) .or. (.not. (x <= 3.6d-27))) 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 <= -1.1e-14) || !(x <= 3.6e-27)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.1e-14) or not (x <= 3.6e-27): 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 <= -1.1e-14) || !(x <= 3.6e-27)) 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 <= -1.1e-14) || ~((x <= 3.6e-27))) 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, -1.1e-14], N[Not[LessEqual[x, 3.6e-27]], $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 -1.1 \cdot 10^{-14} \lor \neg \left(x \leq 3.6 \cdot 10^{-27}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -1.1e-14 or 3.5999999999999999e-27 < x Initial program 94.1%
Taylor expanded in x around inf 91.4%
mul-1-neg91.4%
unsub-neg91.4%
Simplified91.4%
if -1.1e-14 < x < 3.5999999999999999e-27Initial program 94.7%
Taylor expanded in z around inf 88.8%
associate-/l*62.8%
Simplified90.9%
Final simplification91.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.4e+109) (not (<= x 3.9e-25))) (* x (- 1.0 (/ y t))) (+ x (* (/ y t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.4e+109) || !(x <= 3.9e-25)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((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 ((x <= (-2.4d+109)) .or. (.not. (x <= 3.9d-25))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = x + ((y / t) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.4e+109) || !(x <= 3.9e-25)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((y / t) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.4e+109) or not (x <= 3.9e-25): tmp = x * (1.0 - (y / t)) else: tmp = x + ((y / t) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.4e+109) || !(x <= 3.9e-25)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(Float64(y / t) * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.4e+109) || ~((x <= 3.9e-25))) tmp = x * (1.0 - (y / t)); else tmp = x + ((y / t) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.4e+109], N[Not[LessEqual[x, 3.9e-25]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+109} \lor \neg \left(x \leq 3.9 \cdot 10^{-25}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\end{array}
\end{array}
if x < -2.39999999999999987e109 or 3.9e-25 < x Initial program 92.5%
Taylor expanded in x around inf 95.1%
mul-1-neg95.1%
unsub-neg95.1%
Simplified95.1%
if -2.39999999999999987e109 < x < 3.9e-25Initial program 96.1%
Taylor expanded in z around inf 85.9%
associate-/l*51.1%
Simplified84.7%
clear-num84.7%
un-div-inv85.4%
Applied egg-rr85.4%
associate-/r/89.4%
Applied egg-rr89.4%
Final simplification92.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -5.4e-139) (not (<= y 2.6e+109))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5.4e-139) || !(y <= 2.6e+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 ((y <= (-5.4d-139)) .or. (.not. (y <= 2.6d+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 ((y <= -5.4e-139) || !(y <= 2.6e+109)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -5.4e-139) or not (y <= 2.6e+109): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -5.4e-139) || !(y <= 2.6e+109)) 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 <= -5.4e-139) || ~((y <= 2.6e+109))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5.4e-139], N[Not[LessEqual[y, 2.6e+109]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.4 \cdot 10^{-139} \lor \neg \left(y \leq 2.6 \cdot 10^{+109}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -5.3999999999999997e-139 or 2.5999999999999998e109 < y Initial program 90.7%
Taylor expanded in y around -inf 79.6%
Taylor expanded in z around inf 50.7%
associate-/l*54.2%
Simplified54.2%
if -5.3999999999999997e-139 < y < 2.5999999999999998e109Initial program 98.3%
Taylor expanded in y around 0 68.1%
Final simplification60.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.4e-138) (not (<= y 7.4e+109))) (* (/ y t) z) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.4e-138) || !(y <= 7.4e+109)) {
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 ((y <= (-2.4d-138)) .or. (.not. (y <= 7.4d+109))) 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 ((y <= -2.4e-138) || !(y <= 7.4e+109)) {
tmp = (y / t) * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.4e-138) or not (y <= 7.4e+109): tmp = (y / t) * z else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.4e-138) || !(y <= 7.4e+109)) tmp = Float64(Float64(y / t) * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.4e-138) || ~((y <= 7.4e+109))) tmp = (y / t) * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.4e-138], N[Not[LessEqual[y, 7.4e+109]], $MachinePrecision]], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{-138} \lor \neg \left(y \leq 7.4 \cdot 10^{+109}\right):\\
\;\;\;\;\frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.3999999999999999e-138 or 7.40000000000000041e109 < y Initial program 90.7%
Taylor expanded in y around -inf 79.6%
Taylor expanded in z around inf 50.7%
associate-*l/57.6%
Applied egg-rr57.6%
if -2.3999999999999999e-138 < y < 7.40000000000000041e109Initial program 98.3%
Taylor expanded in y around 0 68.1%
Final simplification62.6%
(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.4%
Taylor expanded in y around 0 40.6%
Final simplification40.6%
(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 2024039
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:herbie-target
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))