
(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 11 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 92.4%
associate-*l/96.9%
Simplified96.9%
Final simplification96.9%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -5.5e-193)
(not (or (<= z 4e-245) (and (not (<= z 2.5e-157)) (<= z 3.6e-117)))))
(+ x (* (/ y t) z))
(* (- y) (/ x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.5e-193) || !((z <= 4e-245) || (!(z <= 2.5e-157) && (z <= 3.6e-117)))) {
tmp = x + ((y / t) * z);
} else {
tmp = -y * (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 ((z <= (-5.5d-193)) .or. (.not. (z <= 4d-245) .or. (.not. (z <= 2.5d-157)) .and. (z <= 3.6d-117))) then
tmp = x + ((y / t) * z)
else
tmp = -y * (x / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.5e-193) || !((z <= 4e-245) || (!(z <= 2.5e-157) && (z <= 3.6e-117)))) {
tmp = x + ((y / t) * z);
} else {
tmp = -y * (x / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.5e-193) or not ((z <= 4e-245) or (not (z <= 2.5e-157) and (z <= 3.6e-117))): tmp = x + ((y / t) * z) else: tmp = -y * (x / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.5e-193) || !((z <= 4e-245) || (!(z <= 2.5e-157) && (z <= 3.6e-117)))) tmp = Float64(x + Float64(Float64(y / t) * z)); else tmp = Float64(Float64(-y) * Float64(x / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.5e-193) || ~(((z <= 4e-245) || (~((z <= 2.5e-157)) && (z <= 3.6e-117))))) tmp = x + ((y / t) * z); else tmp = -y * (x / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.5e-193], N[Not[Or[LessEqual[z, 4e-245], And[N[Not[LessEqual[z, 2.5e-157]], $MachinePrecision], LessEqual[z, 3.6e-117]]]], $MachinePrecision]], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[((-y) * N[(x / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{-193} \lor \neg \left(z \leq 4 \cdot 10^{-245} \lor \neg \left(z \leq 2.5 \cdot 10^{-157}\right) \land z \leq 3.6 \cdot 10^{-117}\right):\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(-y\right) \cdot \frac{x}{t}\\
\end{array}
\end{array}
if z < -5.50000000000000014e-193 or 3.9999999999999997e-245 < z < 2.5000000000000001e-157 or 3.6e-117 < z Initial program 91.9%
associate-*l/98.9%
Simplified98.9%
Taylor expanded in z around inf 80.6%
associate-*l/86.2%
*-commutative86.2%
Simplified86.2%
if -5.50000000000000014e-193 < z < 3.9999999999999997e-245 or 2.5000000000000001e-157 < z < 3.6e-117Initial program 94.6%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
associate-*r/99.8%
neg-mul-199.8%
Simplified99.8%
associate-/r/89.5%
add-sqr-sqrt46.6%
sqrt-unprod55.5%
sqr-neg55.5%
sqrt-unprod15.9%
add-sqr-sqrt25.4%
frac-2neg25.4%
distribute-frac-neg25.4%
cancel-sign-sub-inv25.4%
*-commutative25.4%
add-sqr-sqrt9.5%
sqrt-unprod48.7%
sqr-neg48.7%
sqrt-unprod42.8%
add-sqr-sqrt89.5%
Applied egg-rr89.5%
Taylor expanded in y around inf 69.6%
mul-1-neg69.6%
associate-*l/73.1%
distribute-lft-neg-out73.1%
*-commutative73.1%
distribute-neg-frac73.1%
Simplified73.1%
Final simplification83.4%
(FPCore (x y z t)
:precision binary64
(if (<= z -5.4e-193)
(+ x (/ z (/ t y)))
(if (or (<= z 4.5e-245) (and (not (<= z 2.4e-157)) (<= z 3.6e-117)))
(* (- y) (/ x t))
(+ x (* (/ y t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.4e-193) {
tmp = x + (z / (t / y));
} else if ((z <= 4.5e-245) || (!(z <= 2.4e-157) && (z <= 3.6e-117))) {
tmp = -y * (x / 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 (z <= (-5.4d-193)) then
tmp = x + (z / (t / y))
else if ((z <= 4.5d-245) .or. (.not. (z <= 2.4d-157)) .and. (z <= 3.6d-117)) then
tmp = -y * (x / 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 (z <= -5.4e-193) {
tmp = x + (z / (t / y));
} else if ((z <= 4.5e-245) || (!(z <= 2.4e-157) && (z <= 3.6e-117))) {
tmp = -y * (x / t);
} else {
tmp = x + ((y / t) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.4e-193: tmp = x + (z / (t / y)) elif (z <= 4.5e-245) or (not (z <= 2.4e-157) and (z <= 3.6e-117)): tmp = -y * (x / t) else: tmp = x + ((y / t) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.4e-193) tmp = Float64(x + Float64(z / Float64(t / y))); elseif ((z <= 4.5e-245) || (!(z <= 2.4e-157) && (z <= 3.6e-117))) tmp = Float64(Float64(-y) * Float64(x / 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 (z <= -5.4e-193) tmp = x + (z / (t / y)); elseif ((z <= 4.5e-245) || (~((z <= 2.4e-157)) && (z <= 3.6e-117))) tmp = -y * (x / t); else tmp = x + ((y / t) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.4e-193], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 4.5e-245], And[N[Not[LessEqual[z, 2.4e-157]], $MachinePrecision], LessEqual[z, 3.6e-117]]], N[((-y) * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{-193}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-245} \lor \neg \left(z \leq 2.4 \cdot 10^{-157}\right) \land z \leq 3.6 \cdot 10^{-117}:\\
\;\;\;\;\left(-y\right) \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\end{array}
\end{array}
if z < -5.3999999999999998e-193Initial program 92.1%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 76.7%
associate-*l/84.3%
*-commutative84.3%
Simplified84.3%
clear-num84.2%
un-div-inv84.4%
Applied egg-rr84.4%
if -5.3999999999999998e-193 < z < 4.49999999999999969e-245 or 2.4e-157 < z < 3.6e-117Initial program 94.6%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
associate-*r/99.8%
neg-mul-199.8%
Simplified99.8%
associate-/r/89.5%
add-sqr-sqrt46.6%
sqrt-unprod55.5%
sqr-neg55.5%
sqrt-unprod15.9%
add-sqr-sqrt25.4%
frac-2neg25.4%
distribute-frac-neg25.4%
cancel-sign-sub-inv25.4%
*-commutative25.4%
add-sqr-sqrt9.5%
sqrt-unprod48.7%
sqr-neg48.7%
sqrt-unprod42.8%
add-sqr-sqrt89.5%
Applied egg-rr89.5%
Taylor expanded in y around inf 69.6%
mul-1-neg69.6%
associate-*l/73.1%
distribute-lft-neg-out73.1%
*-commutative73.1%
distribute-neg-frac73.1%
Simplified73.1%
if 4.49999999999999969e-245 < z < 2.4e-157 or 3.6e-117 < z Initial program 91.7%
associate-*l/98.0%
Simplified98.0%
Taylor expanded in z around inf 84.2%
associate-*l/87.9%
*-commutative87.9%
Simplified87.9%
Final simplification83.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y) (/ x t))))
(if (<= z -5.4e-193)
(+ x (/ z (/ t y)))
(if (<= z 8e-244)
t_1
(if (<= z 2.5e-157)
(+ x (/ (* y z) t))
(if (<= z 1.22e-115) t_1 (+ x (* (/ y t) z))))))))
double code(double x, double y, double z, double t) {
double t_1 = -y * (x / t);
double tmp;
if (z <= -5.4e-193) {
tmp = x + (z / (t / y));
} else if (z <= 8e-244) {
tmp = t_1;
} else if (z <= 2.5e-157) {
tmp = x + ((y * z) / t);
} else if (z <= 1.22e-115) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = -y * (x / t)
if (z <= (-5.4d-193)) then
tmp = x + (z / (t / y))
else if (z <= 8d-244) then
tmp = t_1
else if (z <= 2.5d-157) then
tmp = x + ((y * z) / t)
else if (z <= 1.22d-115) then
tmp = t_1
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 t_1 = -y * (x / t);
double tmp;
if (z <= -5.4e-193) {
tmp = x + (z / (t / y));
} else if (z <= 8e-244) {
tmp = t_1;
} else if (z <= 2.5e-157) {
tmp = x + ((y * z) / t);
} else if (z <= 1.22e-115) {
tmp = t_1;
} else {
tmp = x + ((y / t) * z);
}
return tmp;
}
def code(x, y, z, t): t_1 = -y * (x / t) tmp = 0 if z <= -5.4e-193: tmp = x + (z / (t / y)) elif z <= 8e-244: tmp = t_1 elif z <= 2.5e-157: tmp = x + ((y * z) / t) elif z <= 1.22e-115: tmp = t_1 else: tmp = x + ((y / t) * z) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-y) * Float64(x / t)) tmp = 0.0 if (z <= -5.4e-193) tmp = Float64(x + Float64(z / Float64(t / y))); elseif (z <= 8e-244) tmp = t_1; elseif (z <= 2.5e-157) tmp = Float64(x + Float64(Float64(y * z) / t)); elseif (z <= 1.22e-115) tmp = t_1; else tmp = Float64(x + Float64(Float64(y / t) * z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -y * (x / t); tmp = 0.0; if (z <= -5.4e-193) tmp = x + (z / (t / y)); elseif (z <= 8e-244) tmp = t_1; elseif (z <= 2.5e-157) tmp = x + ((y * z) / t); elseif (z <= 1.22e-115) tmp = t_1; else tmp = x + ((y / t) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-y) * N[(x / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.4e-193], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8e-244], t$95$1, If[LessEqual[z, 2.5e-157], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.22e-115], t$95$1, N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-y\right) \cdot \frac{x}{t}\\
\mathbf{if}\;z \leq -5.4 \cdot 10^{-193}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-244}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-157}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\mathbf{elif}\;z \leq 1.22 \cdot 10^{-115}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\end{array}
\end{array}
if z < -5.3999999999999998e-193Initial program 92.1%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 76.7%
associate-*l/84.3%
*-commutative84.3%
Simplified84.3%
clear-num84.2%
un-div-inv84.4%
Applied egg-rr84.4%
if -5.3999999999999998e-193 < z < 7.9999999999999994e-244 or 2.5000000000000001e-157 < z < 1.22000000000000009e-115Initial program 94.6%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
associate-*r/99.8%
neg-mul-199.8%
Simplified99.8%
associate-/r/89.5%
add-sqr-sqrt46.6%
sqrt-unprod55.5%
sqr-neg55.5%
sqrt-unprod15.9%
add-sqr-sqrt25.4%
frac-2neg25.4%
distribute-frac-neg25.4%
cancel-sign-sub-inv25.4%
*-commutative25.4%
add-sqr-sqrt9.5%
sqrt-unprod48.7%
sqr-neg48.7%
sqrt-unprod42.8%
add-sqr-sqrt89.5%
Applied egg-rr89.5%
Taylor expanded in y around inf 69.6%
mul-1-neg69.6%
associate-*l/73.1%
distribute-lft-neg-out73.1%
*-commutative73.1%
distribute-neg-frac73.1%
Simplified73.1%
if 7.9999999999999994e-244 < z < 2.5000000000000001e-157Initial program 94.0%
associate-*l/94.3%
Simplified94.3%
Taylor expanded in z around inf 81.5%
if 1.22000000000000009e-115 < z Initial program 91.3%
associate-*l/98.6%
Simplified98.6%
Taylor expanded in z around inf 84.7%
associate-*l/90.0%
*-commutative90.0%
Simplified90.0%
Final simplification83.8%
(FPCore (x y z t) :precision binary64 (if (<= z -7e-97) (+ x (/ z (/ t y))) (if (<= z 1e-59) (- x (* x (/ y t))) (+ x (* (/ y t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7e-97) {
tmp = x + (z / (t / y));
} else if (z <= 1e-59) {
tmp = x - (x * (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 (z <= (-7d-97)) then
tmp = x + (z / (t / y))
else if (z <= 1d-59) then
tmp = x - (x * (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 (z <= -7e-97) {
tmp = x + (z / (t / y));
} else if (z <= 1e-59) {
tmp = x - (x * (y / t));
} else {
tmp = x + ((y / t) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7e-97: tmp = x + (z / (t / y)) elif z <= 1e-59: tmp = x - (x * (y / t)) else: tmp = x + ((y / t) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7e-97) tmp = Float64(x + Float64(z / Float64(t / y))); elseif (z <= 1e-59) tmp = Float64(x - Float64(x * 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 (z <= -7e-97) tmp = x + (z / (t / y)); elseif (z <= 1e-59) tmp = x - (x * (y / t)); else tmp = x + ((y / t) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7e-97], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e-59], N[(x - N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{-97}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;z \leq 10^{-59}:\\
\;\;\;\;x - x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\end{array}
\end{array}
if z < -7.00000000000000038e-97Initial program 91.5%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in z around inf 79.9%
associate-*l/88.3%
*-commutative88.3%
Simplified88.3%
clear-num88.2%
un-div-inv88.3%
Applied egg-rr88.3%
if -7.00000000000000038e-97 < z < 1e-59Initial program 93.5%
associate-/l*96.1%
Simplified96.1%
Taylor expanded in z around 0 91.6%
associate-*r/91.6%
neg-mul-191.6%
Simplified91.6%
associate-/r/89.1%
add-sqr-sqrt46.5%
sqrt-unprod60.1%
sqr-neg60.1%
sqrt-unprod21.8%
add-sqr-sqrt42.2%
frac-2neg42.2%
distribute-frac-neg42.2%
cancel-sign-sub-inv42.2%
*-commutative42.2%
add-sqr-sqrt20.4%
sqrt-unprod56.0%
sqr-neg56.0%
sqrt-unprod42.5%
add-sqr-sqrt89.1%
Applied egg-rr89.1%
if 1e-59 < z Initial program 92.0%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in z around inf 86.8%
associate-*l/93.1%
*-commutative93.1%
Simplified93.1%
Final simplification90.0%
(FPCore (x y z t) :precision binary64 (if (<= z -7e-98) (+ x (/ z (/ t y))) (if (<= z 8.5e-60) (- x (/ y (/ t x))) (+ x (* (/ y t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7e-98) {
tmp = x + (z / (t / y));
} else if (z <= 8.5e-60) {
tmp = x - (y / (t / x));
} 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 (z <= (-7d-98)) then
tmp = x + (z / (t / y))
else if (z <= 8.5d-60) then
tmp = x - (y / (t / x))
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 (z <= -7e-98) {
tmp = x + (z / (t / y));
} else if (z <= 8.5e-60) {
tmp = x - (y / (t / x));
} else {
tmp = x + ((y / t) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7e-98: tmp = x + (z / (t / y)) elif z <= 8.5e-60: tmp = x - (y / (t / x)) else: tmp = x + ((y / t) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7e-98) tmp = Float64(x + Float64(z / Float64(t / y))); elseif (z <= 8.5e-60) tmp = Float64(x - Float64(y / Float64(t / x))); 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 (z <= -7e-98) tmp = x + (z / (t / y)); elseif (z <= 8.5e-60) tmp = x - (y / (t / x)); else tmp = x + ((y / t) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7e-98], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e-60], N[(x - N[(y / N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{-98}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-60}:\\
\;\;\;\;x - \frac{y}{\frac{t}{x}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\end{array}
\end{array}
if z < -7.0000000000000004e-98Initial program 91.5%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in z around inf 79.9%
associate-*l/88.3%
*-commutative88.3%
Simplified88.3%
clear-num88.2%
un-div-inv88.3%
Applied egg-rr88.3%
if -7.0000000000000004e-98 < z < 8.50000000000000044e-60Initial program 93.5%
associate-/l*96.1%
Simplified96.1%
Taylor expanded in z around 0 91.6%
associate-*r/91.6%
neg-mul-191.6%
Simplified91.6%
Taylor expanded in x around 0 89.1%
distribute-lft-in89.1%
mul-1-neg89.1%
distribute-rgt-neg-in89.1%
unsub-neg89.1%
*-rgt-identity89.1%
*-commutative89.1%
associate-/r/91.6%
Simplified91.6%
if 8.50000000000000044e-60 < z Initial program 92.0%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in z around inf 86.8%
associate-*l/93.1%
*-commutative93.1%
Simplified93.1%
Final simplification91.0%
(FPCore (x y z t) :precision binary64 (if (<= z -5.5e-97) (+ x (/ z (/ t y))) (if (<= z 1.8e-60) (- x (* y (/ x t))) (+ x (* (/ y t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.5e-97) {
tmp = x + (z / (t / y));
} else if (z <= 1.8e-60) {
tmp = x - (y * (x / 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 (z <= (-5.5d-97)) then
tmp = x + (z / (t / y))
else if (z <= 1.8d-60) then
tmp = x - (y * (x / 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 (z <= -5.5e-97) {
tmp = x + (z / (t / y));
} else if (z <= 1.8e-60) {
tmp = x - (y * (x / t));
} else {
tmp = x + ((y / t) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.5e-97: tmp = x + (z / (t / y)) elif z <= 1.8e-60: tmp = x - (y * (x / t)) else: tmp = x + ((y / t) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.5e-97) tmp = Float64(x + Float64(z / Float64(t / y))); elseif (z <= 1.8e-60) tmp = Float64(x - Float64(y * Float64(x / 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 (z <= -5.5e-97) tmp = x + (z / (t / y)); elseif (z <= 1.8e-60) tmp = x - (y * (x / t)); else tmp = x + ((y / t) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.5e-97], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e-60], N[(x - N[(y * N[(x / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{-97}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-60}:\\
\;\;\;\;x - y \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\end{array}
\end{array}
if z < -5.49999999999999948e-97Initial program 91.5%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in z around inf 79.9%
associate-*l/88.3%
*-commutative88.3%
Simplified88.3%
clear-num88.2%
un-div-inv88.3%
Applied egg-rr88.3%
if -5.49999999999999948e-97 < z < 1.8e-60Initial program 93.5%
associate-/l*96.1%
Simplified96.1%
Taylor expanded in z around 0 91.6%
associate-*r/91.6%
neg-mul-191.6%
Simplified91.6%
frac-2neg91.6%
div-inv91.6%
distribute-frac-neg91.6%
remove-double-neg91.6%
clear-num92.4%
Applied egg-rr92.4%
if 1.8e-60 < z Initial program 92.0%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in z around inf 86.8%
associate-*l/93.1%
*-commutative93.1%
Simplified93.1%
Final simplification91.3%
(FPCore (x y z t) :precision binary64 (if (<= t -5.6e+19) x (if (<= t 4.7e+83) (/ (- x) (/ t y)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.6e+19) {
tmp = x;
} else if (t <= 4.7e+83) {
tmp = -x / (t / y);
} 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 <= (-5.6d+19)) then
tmp = x
else if (t <= 4.7d+83) then
tmp = -x / (t / y)
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 <= -5.6e+19) {
tmp = x;
} else if (t <= 4.7e+83) {
tmp = -x / (t / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -5.6e+19: tmp = x elif t <= 4.7e+83: tmp = -x / (t / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -5.6e+19) tmp = x; elseif (t <= 4.7e+83) tmp = Float64(Float64(-x) / Float64(t / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -5.6e+19) tmp = x; elseif (t <= 4.7e+83) tmp = -x / (t / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -5.6e+19], x, If[LessEqual[t, 4.7e+83], N[((-x) / N[(t / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.6 \cdot 10^{+19}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 4.7 \cdot 10^{+83}:\\
\;\;\;\;\frac{-x}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -5.6e19 or 4.6999999999999999e83 < t Initial program 84.3%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 82.9%
associate-*l/93.3%
*-commutative93.3%
Simplified93.3%
Taylor expanded in x around inf 70.0%
if -5.6e19 < t < 4.6999999999999999e83Initial program 98.5%
associate-/l*92.1%
Simplified92.1%
Taylor expanded in z around 0 57.8%
associate-*r/57.8%
neg-mul-157.8%
Simplified57.8%
associate-/r/58.6%
add-sqr-sqrt32.5%
sqrt-unprod35.9%
sqr-neg35.9%
sqrt-unprod7.9%
add-sqr-sqrt16.5%
frac-2neg16.5%
distribute-frac-neg16.5%
cancel-sign-sub-inv16.5%
*-commutative16.5%
add-sqr-sqrt8.6%
sqrt-unprod31.5%
sqr-neg31.5%
sqrt-unprod26.0%
add-sqr-sqrt58.6%
Applied egg-rr58.6%
Taylor expanded in y around inf 48.0%
mul-1-neg48.0%
associate-*r/46.2%
distribute-rgt-neg-in46.2%
distribute-neg-frac46.2%
Simplified46.2%
distribute-frac-neg46.2%
distribute-rgt-neg-out46.2%
add-sqr-sqrt28.4%
sqrt-unprod29.5%
sqr-neg29.5%
sqrt-unprod2.9%
add-sqr-sqrt6.6%
clear-num6.6%
un-div-inv6.6%
add-sqr-sqrt2.9%
sqrt-unprod30.1%
sqr-neg30.1%
sqrt-unprod29.6%
add-sqr-sqrt46.8%
Applied egg-rr46.8%
Final simplification56.7%
(FPCore (x y z t) :precision binary64 (if (<= t -4.6e+18) x (if (<= t 4.3e+83) (/ (- y) (/ t x)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.6e+18) {
tmp = x;
} else if (t <= 4.3e+83) {
tmp = -y / (t / x);
} 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.6d+18)) then
tmp = x
else if (t <= 4.3d+83) then
tmp = -y / (t / x)
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.6e+18) {
tmp = x;
} else if (t <= 4.3e+83) {
tmp = -y / (t / x);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.6e+18: tmp = x elif t <= 4.3e+83: tmp = -y / (t / x) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.6e+18) tmp = x; elseif (t <= 4.3e+83) tmp = Float64(Float64(-y) / Float64(t / x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4.6e+18) tmp = x; elseif (t <= 4.3e+83) tmp = -y / (t / x); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.6e+18], x, If[LessEqual[t, 4.3e+83], N[((-y) / N[(t / x), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.6 \cdot 10^{+18}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 4.3 \cdot 10^{+83}:\\
\;\;\;\;\frac{-y}{\frac{t}{x}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -4.6e18 or 4.3e83 < t Initial program 84.3%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 82.9%
associate-*l/93.3%
*-commutative93.3%
Simplified93.3%
Taylor expanded in x around inf 70.0%
if -4.6e18 < t < 4.3e83Initial program 98.5%
associate-/l*92.1%
Simplified92.1%
Taylor expanded in z around 0 57.8%
associate-*r/57.8%
neg-mul-157.8%
Simplified57.8%
associate-/r/58.6%
add-sqr-sqrt32.5%
sqrt-unprod35.9%
sqr-neg35.9%
sqrt-unprod7.9%
add-sqr-sqrt16.5%
frac-2neg16.5%
distribute-frac-neg16.5%
cancel-sign-sub-inv16.5%
*-commutative16.5%
add-sqr-sqrt8.6%
sqrt-unprod31.5%
sqr-neg31.5%
sqrt-unprod26.0%
add-sqr-sqrt58.6%
Applied egg-rr58.6%
Taylor expanded in y around inf 48.0%
mul-1-neg48.0%
associate-*r/46.2%
distribute-rgt-neg-in46.2%
distribute-neg-frac46.2%
Simplified46.2%
Taylor expanded in x around 0 48.0%
mul-1-neg48.0%
*-commutative48.0%
associate-*l/46.2%
associate-/r/47.8%
Simplified47.8%
Final simplification57.3%
(FPCore (x y z t) :precision binary64 (if (<= t -1.16e+21) x (if (<= t 4.3e+83) (* (- y) (/ x t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.16e+21) {
tmp = x;
} else if (t <= 4.3e+83) {
tmp = -y * (x / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-1.16d+21)) then
tmp = x
else if (t <= 4.3d+83) then
tmp = -y * (x / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.16e+21) {
tmp = x;
} else if (t <= 4.3e+83) {
tmp = -y * (x / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.16e+21: tmp = x elif t <= 4.3e+83: tmp = -y * (x / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.16e+21) tmp = x; elseif (t <= 4.3e+83) tmp = Float64(Float64(-y) * Float64(x / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.16e+21) tmp = x; elseif (t <= 4.3e+83) tmp = -y * (x / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.16e+21], x, If[LessEqual[t, 4.3e+83], N[((-y) * N[(x / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.16 \cdot 10^{+21}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 4.3 \cdot 10^{+83}:\\
\;\;\;\;\left(-y\right) \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.16e21 or 4.3e83 < t Initial program 84.3%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 82.9%
associate-*l/93.3%
*-commutative93.3%
Simplified93.3%
Taylor expanded in x around inf 70.0%
if -1.16e21 < t < 4.3e83Initial program 98.5%
associate-/l*92.1%
Simplified92.1%
Taylor expanded in z around 0 57.8%
associate-*r/57.8%
neg-mul-157.8%
Simplified57.8%
associate-/r/58.6%
add-sqr-sqrt32.5%
sqrt-unprod35.9%
sqr-neg35.9%
sqrt-unprod7.9%
add-sqr-sqrt16.5%
frac-2neg16.5%
distribute-frac-neg16.5%
cancel-sign-sub-inv16.5%
*-commutative16.5%
add-sqr-sqrt8.6%
sqrt-unprod31.5%
sqr-neg31.5%
sqrt-unprod26.0%
add-sqr-sqrt58.6%
Applied egg-rr58.6%
Taylor expanded in y around inf 48.0%
mul-1-neg48.0%
associate-*l/48.5%
distribute-lft-neg-out48.5%
*-commutative48.5%
distribute-neg-frac48.5%
Simplified48.5%
Final simplification57.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 92.4%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in z around inf 69.5%
associate-*l/74.5%
*-commutative74.5%
Simplified74.5%
Taylor expanded in x around inf 37.4%
Final simplification37.4%
(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 2023290
(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)))