
(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 95.0%
associate-*l/97.8%
Simplified97.8%
Final simplification97.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- (/ x t)))))
(if (<= t -9.2e+167)
x
(if (<= t -85000000.0)
(* y (/ z t))
(if (<= t -8.1e-75)
t_1
(if (<= t -1.25e-98)
(/ (* y z) t)
(if (<= t 1.75e-193) t_1 (if (<= t 6e-20) (* (/ y t) z) x))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * -(x / t);
double tmp;
if (t <= -9.2e+167) {
tmp = x;
} else if (t <= -85000000.0) {
tmp = y * (z / t);
} else if (t <= -8.1e-75) {
tmp = t_1;
} else if (t <= -1.25e-98) {
tmp = (y * z) / t;
} else if (t <= 1.75e-193) {
tmp = t_1;
} else if (t <= 6e-20) {
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) :: t_1
real(8) :: tmp
t_1 = y * -(x / t)
if (t <= (-9.2d+167)) then
tmp = x
else if (t <= (-85000000.0d0)) then
tmp = y * (z / t)
else if (t <= (-8.1d-75)) then
tmp = t_1
else if (t <= (-1.25d-98)) then
tmp = (y * z) / t
else if (t <= 1.75d-193) then
tmp = t_1
else if (t <= 6d-20) 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 t_1 = y * -(x / t);
double tmp;
if (t <= -9.2e+167) {
tmp = x;
} else if (t <= -85000000.0) {
tmp = y * (z / t);
} else if (t <= -8.1e-75) {
tmp = t_1;
} else if (t <= -1.25e-98) {
tmp = (y * z) / t;
} else if (t <= 1.75e-193) {
tmp = t_1;
} else if (t <= 6e-20) {
tmp = (y / t) * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * -(x / t) tmp = 0 if t <= -9.2e+167: tmp = x elif t <= -85000000.0: tmp = y * (z / t) elif t <= -8.1e-75: tmp = t_1 elif t <= -1.25e-98: tmp = (y * z) / t elif t <= 1.75e-193: tmp = t_1 elif t <= 6e-20: tmp = (y / t) * z else: tmp = x return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(-Float64(x / t))) tmp = 0.0 if (t <= -9.2e+167) tmp = x; elseif (t <= -85000000.0) tmp = Float64(y * Float64(z / t)); elseif (t <= -8.1e-75) tmp = t_1; elseif (t <= -1.25e-98) tmp = Float64(Float64(y * z) / t); elseif (t <= 1.75e-193) tmp = t_1; elseif (t <= 6e-20) tmp = Float64(Float64(y / t) * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * -(x / t); tmp = 0.0; if (t <= -9.2e+167) tmp = x; elseif (t <= -85000000.0) tmp = y * (z / t); elseif (t <= -8.1e-75) tmp = t_1; elseif (t <= -1.25e-98) tmp = (y * z) / t; elseif (t <= 1.75e-193) tmp = t_1; elseif (t <= 6e-20) tmp = (y / t) * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-N[(x / t), $MachinePrecision])), $MachinePrecision]}, If[LessEqual[t, -9.2e+167], x, If[LessEqual[t, -85000000.0], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -8.1e-75], t$95$1, If[LessEqual[t, -1.25e-98], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 1.75e-193], t$95$1, If[LessEqual[t, 6e-20], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], x]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(-\frac{x}{t}\right)\\
\mathbf{if}\;t \leq -9.2 \cdot 10^{+167}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -85000000:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;t \leq -8.1 \cdot 10^{-75}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -1.25 \cdot 10^{-98}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;t \leq 1.75 \cdot 10^{-193}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 6 \cdot 10^{-20}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -9.19999999999999952e167 or 6.00000000000000057e-20 < t Initial program 91.7%
associate-*l/99.5%
Simplified99.5%
Taylor expanded in y around 0 64.1%
if -9.19999999999999952e167 < t < -8.5e7Initial program 90.7%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in y around inf 67.5%
Taylor expanded in z around inf 48.9%
if -8.5e7 < t < -8.10000000000000034e-75 or -1.25000000000000005e-98 < t < 1.75000000000000002e-193Initial program 98.5%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in y around inf 75.6%
Taylor expanded in z around 0 65.1%
associate-*r/65.1%
neg-mul-165.1%
Simplified65.1%
if -8.10000000000000034e-75 < t < -1.25000000000000005e-98Initial program 99.3%
associate-*l/73.9%
Simplified73.9%
Taylor expanded in y around inf 72.2%
sub-div72.0%
div-inv72.2%
Applied egg-rr72.2%
Taylor expanded in z around inf 85.4%
if 1.75000000000000002e-193 < t < 6.00000000000000057e-20Initial program 99.8%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in y around inf 84.5%
*-commutative84.5%
sub-div84.5%
associate-/r/94.5%
Applied egg-rr94.5%
Taylor expanded in z around inf 71.2%
*-commutative71.2%
associate-*r/73.6%
Simplified73.6%
Final simplification64.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x (- y)) t)))
(if (<= t -1.06e+169)
x
(if (<= t -45000000.0)
(* y (/ z t))
(if (<= t -3.5e-75)
t_1
(if (<= t -9e-100)
(/ (* y z) t)
(if (<= t 3.25e-193) t_1 (if (<= t 6.5e-20) (* (/ y t) z) x))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * -y) / t;
double tmp;
if (t <= -1.06e+169) {
tmp = x;
} else if (t <= -45000000.0) {
tmp = y * (z / t);
} else if (t <= -3.5e-75) {
tmp = t_1;
} else if (t <= -9e-100) {
tmp = (y * z) / t;
} else if (t <= 3.25e-193) {
tmp = t_1;
} else if (t <= 6.5e-20) {
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) :: t_1
real(8) :: tmp
t_1 = (x * -y) / t
if (t <= (-1.06d+169)) then
tmp = x
else if (t <= (-45000000.0d0)) then
tmp = y * (z / t)
else if (t <= (-3.5d-75)) then
tmp = t_1
else if (t <= (-9d-100)) then
tmp = (y * z) / t
else if (t <= 3.25d-193) then
tmp = t_1
else if (t <= 6.5d-20) 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 t_1 = (x * -y) / t;
double tmp;
if (t <= -1.06e+169) {
tmp = x;
} else if (t <= -45000000.0) {
tmp = y * (z / t);
} else if (t <= -3.5e-75) {
tmp = t_1;
} else if (t <= -9e-100) {
tmp = (y * z) / t;
} else if (t <= 3.25e-193) {
tmp = t_1;
} else if (t <= 6.5e-20) {
tmp = (y / t) * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * -y) / t tmp = 0 if t <= -1.06e+169: tmp = x elif t <= -45000000.0: tmp = y * (z / t) elif t <= -3.5e-75: tmp = t_1 elif t <= -9e-100: tmp = (y * z) / t elif t <= 3.25e-193: tmp = t_1 elif t <= 6.5e-20: tmp = (y / t) * z else: tmp = x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * Float64(-y)) / t) tmp = 0.0 if (t <= -1.06e+169) tmp = x; elseif (t <= -45000000.0) tmp = Float64(y * Float64(z / t)); elseif (t <= -3.5e-75) tmp = t_1; elseif (t <= -9e-100) tmp = Float64(Float64(y * z) / t); elseif (t <= 3.25e-193) tmp = t_1; elseif (t <= 6.5e-20) tmp = Float64(Float64(y / t) * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * -y) / t; tmp = 0.0; if (t <= -1.06e+169) tmp = x; elseif (t <= -45000000.0) tmp = y * (z / t); elseif (t <= -3.5e-75) tmp = t_1; elseif (t <= -9e-100) tmp = (y * z) / t; elseif (t <= 3.25e-193) tmp = t_1; elseif (t <= 6.5e-20) tmp = (y / t) * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * (-y)), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t, -1.06e+169], x, If[LessEqual[t, -45000000.0], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -3.5e-75], t$95$1, If[LessEqual[t, -9e-100], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 3.25e-193], t$95$1, If[LessEqual[t, 6.5e-20], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], x]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot \left(-y\right)}{t}\\
\mathbf{if}\;t \leq -1.06 \cdot 10^{+169}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -45000000:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;t \leq -3.5 \cdot 10^{-75}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -9 \cdot 10^{-100}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;t \leq 3.25 \cdot 10^{-193}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 6.5 \cdot 10^{-20}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.05999999999999995e169 or 6.50000000000000032e-20 < t Initial program 91.7%
associate-*l/99.5%
Simplified99.5%
Taylor expanded in y around 0 64.1%
if -1.05999999999999995e169 < t < -4.5e7Initial program 90.7%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in y around inf 67.5%
Taylor expanded in z around inf 48.9%
if -4.5e7 < t < -3.49999999999999985e-75 or -9.0000000000000002e-100 < t < 3.2500000000000002e-193Initial program 98.5%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in x around inf 80.1%
*-commutative80.1%
distribute-lft-in80.1%
*-rgt-identity80.1%
mul-1-neg80.1%
distribute-rgt-neg-in80.1%
unsub-neg80.1%
Simplified80.1%
Taylor expanded in x around 0 80.2%
Taylor expanded in y around inf 71.1%
associate-*r/71.1%
neg-mul-171.1%
distribute-rgt-neg-in71.1%
Simplified71.1%
if -3.49999999999999985e-75 < t < -9.0000000000000002e-100Initial program 99.3%
associate-*l/73.9%
Simplified73.9%
Taylor expanded in y around inf 72.2%
sub-div72.0%
div-inv72.2%
Applied egg-rr72.2%
Taylor expanded in z around inf 85.4%
if 3.2500000000000002e-193 < t < 6.50000000000000032e-20Initial program 99.8%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in y around inf 84.5%
*-commutative84.5%
sub-div84.5%
associate-/r/94.5%
Applied egg-rr94.5%
Taylor expanded in z around inf 71.2%
*-commutative71.2%
associate-*r/73.6%
Simplified73.6%
Final simplification66.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.2e-111) (not (<= t 2.4e-194))) (+ x (* (/ y t) z)) (/ (* x (- y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.2e-111) || !(t <= 2.4e-194)) {
tmp = x + ((y / t) * z);
} else {
tmp = (x * -y) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-2.2d-111)) .or. (.not. (t <= 2.4d-194))) then
tmp = x + ((y / t) * z)
else
tmp = (x * -y) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.2e-111) || !(t <= 2.4e-194)) {
tmp = x + ((y / t) * z);
} else {
tmp = (x * -y) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.2e-111) or not (t <= 2.4e-194): tmp = x + ((y / t) * z) else: tmp = (x * -y) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.2e-111) || !(t <= 2.4e-194)) tmp = Float64(x + Float64(Float64(y / t) * z)); else tmp = Float64(Float64(x * Float64(-y)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.2e-111) || ~((t <= 2.4e-194))) tmp = x + ((y / t) * z); else tmp = (x * -y) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.2e-111], N[Not[LessEqual[t, 2.4e-194]], $MachinePrecision]], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[(x * (-y)), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.2 \cdot 10^{-111} \lor \neg \left(t \leq 2.4 \cdot 10^{-194}\right):\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(-y\right)}{t}\\
\end{array}
\end{array}
if t < -2.2e-111 or 2.4e-194 < t Initial program 93.9%
associate-*l/98.2%
Simplified98.2%
Taylor expanded in z around inf 80.0%
associate-*l/81.3%
*-commutative81.3%
Simplified81.3%
if -2.2e-111 < t < 2.4e-194Initial program 98.2%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in x around inf 78.7%
*-commutative78.7%
distribute-lft-in78.7%
*-rgt-identity78.7%
mul-1-neg78.7%
distribute-rgt-neg-in78.7%
unsub-neg78.7%
Simplified78.7%
Taylor expanded in x around 0 78.9%
Taylor expanded in y around inf 74.0%
associate-*r/74.0%
neg-mul-174.0%
distribute-rgt-neg-in74.0%
Simplified74.0%
Final simplification79.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.65e-7) (not (<= z 2.9e+17))) (+ x (* (/ y t) z)) (- x (* x (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.65e-7) || !(z <= 2.9e+17)) {
tmp = x + ((y / t) * z);
} else {
tmp = x - (x * (y / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.65d-7)) .or. (.not. (z <= 2.9d+17))) then
tmp = x + ((y / t) * z)
else
tmp = x - (x * (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.65e-7) || !(z <= 2.9e+17)) {
tmp = x + ((y / t) * z);
} else {
tmp = x - (x * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.65e-7) or not (z <= 2.9e+17): tmp = x + ((y / t) * z) else: tmp = x - (x * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.65e-7) || !(z <= 2.9e+17)) tmp = Float64(x + Float64(Float64(y / t) * z)); else tmp = Float64(x - Float64(x * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.65e-7) || ~((z <= 2.9e+17))) tmp = x + ((y / t) * z); else tmp = x - (x * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.65e-7], N[Not[LessEqual[z, 2.9e+17]], $MachinePrecision]], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x - N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{-7} \lor \neg \left(z \leq 2.9 \cdot 10^{+17}\right):\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -1.6500000000000001e-7 or 2.9e17 < z Initial program 92.9%
associate-*l/98.7%
Simplified98.7%
Taylor expanded in z around inf 86.0%
associate-*l/88.6%
*-commutative88.6%
Simplified88.6%
if -1.6500000000000001e-7 < z < 2.9e17Initial program 96.9%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in x around inf 87.1%
*-commutative87.1%
distribute-lft-in87.1%
*-rgt-identity87.1%
mul-1-neg87.1%
distribute-rgt-neg-in87.1%
unsub-neg87.1%
Simplified87.1%
Final simplification87.8%
(FPCore (x y z t) :precision binary64 (if (<= t -1.2e-112) (+ x (/ y (/ t z))) (if (<= t 7.6e-194) (/ (* x (- y)) t) (+ x (* (/ y t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.2e-112) {
tmp = x + (y / (t / z));
} else if (t <= 7.6e-194) {
tmp = (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 (t <= (-1.2d-112)) then
tmp = x + (y / (t / z))
else if (t <= 7.6d-194) then
tmp = (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 (t <= -1.2e-112) {
tmp = x + (y / (t / z));
} else if (t <= 7.6e-194) {
tmp = (x * -y) / t;
} else {
tmp = x + ((y / t) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.2e-112: tmp = x + (y / (t / z)) elif t <= 7.6e-194: tmp = (x * -y) / t else: tmp = x + ((y / t) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.2e-112) tmp = Float64(x + Float64(y / Float64(t / z))); elseif (t <= 7.6e-194) tmp = Float64(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 (t <= -1.2e-112) tmp = x + (y / (t / z)); elseif (t <= 7.6e-194) tmp = (x * -y) / t; else tmp = x + ((y / t) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.2e-112], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.6e-194], N[(N[(x * (-y)), $MachinePrecision] / t), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{-112}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;t \leq 7.6 \cdot 10^{-194}:\\
\;\;\;\;\frac{x \cdot \left(-y\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\end{array}
\end{array}
if t < -1.2e-112Initial program 91.4%
associate-/l*98.1%
Simplified98.1%
Taylor expanded in z around inf 81.4%
if -1.2e-112 < t < 7.6000000000000006e-194Initial program 98.2%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in x around inf 78.7%
*-commutative78.7%
distribute-lft-in78.7%
*-rgt-identity78.7%
mul-1-neg78.7%
distribute-rgt-neg-in78.7%
unsub-neg78.7%
Simplified78.7%
Taylor expanded in x around 0 78.9%
Taylor expanded in y around inf 74.0%
associate-*r/74.0%
neg-mul-174.0%
distribute-rgt-neg-in74.0%
Simplified74.0%
if 7.6000000000000006e-194 < t Initial program 95.7%
associate-*l/99.4%
Simplified99.4%
Taylor expanded in z around inf 79.5%
associate-*l/82.3%
*-commutative82.3%
Simplified82.3%
Final simplification80.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -5.2e-135) (not (<= y 0.041))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5.2e-135) || !(y <= 0.041)) {
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.2d-135)) .or. (.not. (y <= 0.041d0))) 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.2e-135) || !(y <= 0.041)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -5.2e-135) or not (y <= 0.041): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -5.2e-135) || !(y <= 0.041)) 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.2e-135) || ~((y <= 0.041))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5.2e-135], N[Not[LessEqual[y, 0.041]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{-135} \lor \neg \left(y \leq 0.041\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -5.20000000000000008e-135 or 0.0410000000000000017 < y Initial program 92.7%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in y around inf 78.7%
Taylor expanded in z around inf 48.6%
if -5.20000000000000008e-135 < y < 0.0410000000000000017Initial program 98.8%
associate-*l/98.8%
Simplified98.8%
Taylor expanded in y around 0 65.9%
Final simplification55.0%
(FPCore (x y z t) :precision binary64 (if (<= y -6.2e-138) (* (/ y t) z) (if (<= y 0.24) x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.2e-138) {
tmp = (y / t) * z;
} else if (y <= 0.24) {
tmp = x;
} 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 (y <= (-6.2d-138)) then
tmp = (y / t) * z
else if (y <= 0.24d0) then
tmp = x
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 (y <= -6.2e-138) {
tmp = (y / t) * z;
} else if (y <= 0.24) {
tmp = x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -6.2e-138: tmp = (y / t) * z elif y <= 0.24: tmp = x else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -6.2e-138) tmp = Float64(Float64(y / t) * z); elseif (y <= 0.24) tmp = x; else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -6.2e-138) tmp = (y / t) * z; elseif (y <= 0.24) tmp = x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -6.2e-138], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[y, 0.24], x, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{-138}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\mathbf{elif}\;y \leq 0.24:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if y < -6.1999999999999996e-138Initial program 91.8%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in y around inf 72.1%
*-commutative72.1%
sub-div75.2%
associate-/r/78.4%
Applied egg-rr78.4%
Taylor expanded in z around inf 45.8%
*-commutative45.8%
associate-*r/50.2%
Simplified50.2%
if -6.1999999999999996e-138 < y < 0.23999999999999999Initial program 98.8%
associate-*l/98.8%
Simplified98.8%
Taylor expanded in y around 0 65.9%
if 0.23999999999999999 < y Initial program 94.0%
associate-*l/95.6%
Simplified95.6%
Taylor expanded in y around inf 88.4%
Taylor expanded in z around inf 50.1%
Final simplification56.0%
(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 95.0%
associate-*l/97.8%
Simplified97.8%
Taylor expanded in y around 0 35.9%
Final simplification35.9%
(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 2023174
(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)))