
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= y 2e-22) (+ (- x (/ y (* z 3.0))) (* (/ t z) (/ 0.3333333333333333 y))) (+ x (* (/ -0.3333333333333333 z) (- y (/ t y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2e-22) {
tmp = (x - (y / (z * 3.0))) + ((t / z) * (0.3333333333333333 / y));
} else {
tmp = x + ((-0.3333333333333333 / z) * (y - (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 (y <= 2d-22) then
tmp = (x - (y / (z * 3.0d0))) + ((t / z) * (0.3333333333333333d0 / y))
else
tmp = x + (((-0.3333333333333333d0) / z) * (y - (t / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2e-22) {
tmp = (x - (y / (z * 3.0))) + ((t / z) * (0.3333333333333333 / y));
} else {
tmp = x + ((-0.3333333333333333 / z) * (y - (t / y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 2e-22: tmp = (x - (y / (z * 3.0))) + ((t / z) * (0.3333333333333333 / y)) else: tmp = x + ((-0.3333333333333333 / z) * (y - (t / y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 2e-22) tmp = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(Float64(t / z) * Float64(0.3333333333333333 / y))); else tmp = Float64(x + Float64(Float64(-0.3333333333333333 / z) * Float64(y - Float64(t / y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 2e-22) tmp = (x - (y / (z * 3.0))) + ((t / z) * (0.3333333333333333 / y)); else tmp = x + ((-0.3333333333333333 / z) * (y - (t / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 2e-22], N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(-0.3333333333333333 / z), $MachinePrecision] * N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{-22}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)\\
\end{array}
\end{array}
if y < 2.0000000000000001e-22Initial program 96.3%
associate-/r*98.1%
Simplified98.1%
Taylor expanded in t around 0 96.2%
*-commutative96.2%
associate-*l/96.3%
*-commutative96.3%
times-frac98.1%
Simplified98.1%
if 2.0000000000000001e-22 < y Initial program 96.9%
associate-+l-96.9%
sub-neg96.9%
sub-neg96.9%
distribute-neg-in96.9%
unsub-neg96.9%
neg-mul-196.9%
associate-*r/96.9%
associate-*l/96.9%
distribute-neg-frac96.9%
neg-mul-196.9%
times-frac98.3%
distribute-lft-out--99.8%
*-commutative99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification98.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ t z) (/ 0.3333333333333333 y))))
(if (<= y -9.5e+115)
(/ y (* z -3.0))
(if (<= y -3.7e-18)
x
(if (<= y 6e-122)
t_1
(if (<= y 1.02e-48)
x
(if (<= y 4800000000.0)
t_1
(if (<= y 2e+60) x (/ (* y -0.3333333333333333) z)))))))))
double code(double x, double y, double z, double t) {
double t_1 = (t / z) * (0.3333333333333333 / y);
double tmp;
if (y <= -9.5e+115) {
tmp = y / (z * -3.0);
} else if (y <= -3.7e-18) {
tmp = x;
} else if (y <= 6e-122) {
tmp = t_1;
} else if (y <= 1.02e-48) {
tmp = x;
} else if (y <= 4800000000.0) {
tmp = t_1;
} else if (y <= 2e+60) {
tmp = x;
} else {
tmp = (y * -0.3333333333333333) / 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 = (t / z) * (0.3333333333333333d0 / y)
if (y <= (-9.5d+115)) then
tmp = y / (z * (-3.0d0))
else if (y <= (-3.7d-18)) then
tmp = x
else if (y <= 6d-122) then
tmp = t_1
else if (y <= 1.02d-48) then
tmp = x
else if (y <= 4800000000.0d0) then
tmp = t_1
else if (y <= 2d+60) then
tmp = x
else
tmp = (y * (-0.3333333333333333d0)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (t / z) * (0.3333333333333333 / y);
double tmp;
if (y <= -9.5e+115) {
tmp = y / (z * -3.0);
} else if (y <= -3.7e-18) {
tmp = x;
} else if (y <= 6e-122) {
tmp = t_1;
} else if (y <= 1.02e-48) {
tmp = x;
} else if (y <= 4800000000.0) {
tmp = t_1;
} else if (y <= 2e+60) {
tmp = x;
} else {
tmp = (y * -0.3333333333333333) / z;
}
return tmp;
}
def code(x, y, z, t): t_1 = (t / z) * (0.3333333333333333 / y) tmp = 0 if y <= -9.5e+115: tmp = y / (z * -3.0) elif y <= -3.7e-18: tmp = x elif y <= 6e-122: tmp = t_1 elif y <= 1.02e-48: tmp = x elif y <= 4800000000.0: tmp = t_1 elif y <= 2e+60: tmp = x else: tmp = (y * -0.3333333333333333) / z return tmp
function code(x, y, z, t) t_1 = Float64(Float64(t / z) * Float64(0.3333333333333333 / y)) tmp = 0.0 if (y <= -9.5e+115) tmp = Float64(y / Float64(z * -3.0)); elseif (y <= -3.7e-18) tmp = x; elseif (y <= 6e-122) tmp = t_1; elseif (y <= 1.02e-48) tmp = x; elseif (y <= 4800000000.0) tmp = t_1; elseif (y <= 2e+60) tmp = x; else tmp = Float64(Float64(y * -0.3333333333333333) / z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (t / z) * (0.3333333333333333 / y); tmp = 0.0; if (y <= -9.5e+115) tmp = y / (z * -3.0); elseif (y <= -3.7e-18) tmp = x; elseif (y <= 6e-122) tmp = t_1; elseif (y <= 1.02e-48) tmp = x; elseif (y <= 4800000000.0) tmp = t_1; elseif (y <= 2e+60) tmp = x; else tmp = (y * -0.3333333333333333) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.5e+115], N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -3.7e-18], x, If[LessEqual[y, 6e-122], t$95$1, If[LessEqual[y, 1.02e-48], x, If[LessEqual[y, 4800000000.0], t$95$1, If[LessEqual[y, 2e+60], x, N[(N[(y * -0.3333333333333333), $MachinePrecision] / z), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\mathbf{if}\;y \leq -9.5 \cdot 10^{+115}:\\
\;\;\;\;\frac{y}{z \cdot -3}\\
\mathbf{elif}\;y \leq -3.7 \cdot 10^{-18}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-122}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{-48}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 4800000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+60}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot -0.3333333333333333}{z}\\
\end{array}
\end{array}
if y < -9.4999999999999997e115Initial program 99.8%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in x around 0 80.2%
associate-/r*80.2%
associate-*r/80.2%
associate-*r/80.3%
div-sub80.3%
distribute-lft-out--80.3%
Simplified80.3%
Taylor expanded in t around 0 80.3%
*-commutative80.3%
Simplified80.3%
associate-/l*80.4%
div-inv80.3%
clear-num80.3%
Applied egg-rr80.3%
clear-num80.3%
un-div-inv80.4%
div-inv80.4%
metadata-eval80.4%
Applied egg-rr80.4%
if -9.4999999999999997e115 < y < -3.7000000000000003e-18 or 6.00000000000000009e-122 < y < 1.02000000000000005e-48 or 4.8e9 < y < 1.9999999999999999e60Initial program 99.9%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in x around inf 55.1%
if -3.7000000000000003e-18 < y < 6.00000000000000009e-122 or 1.02000000000000005e-48 < y < 4.8e9Initial program 93.5%
associate-/r*96.7%
Simplified96.7%
Taylor expanded in x around 0 73.4%
associate-/r*70.0%
associate-*r/70.0%
associate-*r/70.0%
div-sub70.0%
distribute-lft-out--70.0%
Simplified70.0%
Taylor expanded in t around inf 64.6%
associate-*r/64.5%
*-commutative64.5%
associate-*r/64.5%
Simplified64.5%
associate-/l*68.8%
associate-/r/71.6%
Applied egg-rr71.6%
if 1.9999999999999999e60 < y Initial program 95.6%
associate-/r*91.3%
Simplified91.3%
Taylor expanded in x around 0 71.3%
associate-/r*73.3%
associate-*r/73.3%
associate-*r/75.0%
div-sub77.2%
distribute-lft-out--77.2%
Simplified77.2%
Taylor expanded in t around 0 73.2%
*-commutative73.2%
Simplified73.2%
Final simplification69.5%
(FPCore (x y z t)
:precision binary64
(if (<= x -2.3e+140)
x
(if (or (<= x -1.6e+119) (and (not (<= x -53.0)) (<= x 1.05e-58)))
(* y (/ -0.3333333333333333 z))
x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.3e+140) {
tmp = x;
} else if ((x <= -1.6e+119) || (!(x <= -53.0) && (x <= 1.05e-58))) {
tmp = y * (-0.3333333333333333 / 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 (x <= (-2.3d+140)) then
tmp = x
else if ((x <= (-1.6d+119)) .or. (.not. (x <= (-53.0d0))) .and. (x <= 1.05d-58)) then
tmp = y * ((-0.3333333333333333d0) / 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 (x <= -2.3e+140) {
tmp = x;
} else if ((x <= -1.6e+119) || (!(x <= -53.0) && (x <= 1.05e-58))) {
tmp = y * (-0.3333333333333333 / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.3e+140: tmp = x elif (x <= -1.6e+119) or (not (x <= -53.0) and (x <= 1.05e-58)): tmp = y * (-0.3333333333333333 / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.3e+140) tmp = x; elseif ((x <= -1.6e+119) || (!(x <= -53.0) && (x <= 1.05e-58))) tmp = Float64(y * Float64(-0.3333333333333333 / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.3e+140) tmp = x; elseif ((x <= -1.6e+119) || (~((x <= -53.0)) && (x <= 1.05e-58))) tmp = y * (-0.3333333333333333 / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.3e+140], x, If[Or[LessEqual[x, -1.6e+119], And[N[Not[LessEqual[x, -53.0]], $MachinePrecision], LessEqual[x, 1.05e-58]]], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+140}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{+119} \lor \neg \left(x \leq -53\right) \land x \leq 1.05 \cdot 10^{-58}:\\
\;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.2999999999999999e140 or -1.59999999999999995e119 < x < -53 or 1.04999999999999994e-58 < x Initial program 98.3%
associate-/r*99.0%
Simplified99.0%
Taylor expanded in x around inf 53.7%
if -2.2999999999999999e140 < x < -1.59999999999999995e119 or -53 < x < 1.04999999999999994e-58Initial program 94.8%
associate-/r*95.1%
Simplified95.1%
Taylor expanded in x around 0 86.8%
associate-/r*87.0%
associate-*r/87.0%
associate-*r/87.0%
div-sub87.8%
distribute-lft-out--87.8%
Simplified87.8%
Taylor expanded in t around 0 51.4%
*-commutative51.4%
Simplified51.4%
associate-/l*51.5%
div-inv51.4%
clear-num51.4%
Applied egg-rr51.4%
Final simplification52.5%
(FPCore (x y z t)
:precision binary64
(if (<= x -2.3e+140)
x
(if (<= x -4.6e+118)
(* -0.3333333333333333 (/ y z))
(if (<= x -40.0)
x
(if (<= x 1.05e-58) (* y (/ -0.3333333333333333 z)) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.3e+140) {
tmp = x;
} else if (x <= -4.6e+118) {
tmp = -0.3333333333333333 * (y / z);
} else if (x <= -40.0) {
tmp = x;
} else if (x <= 1.05e-58) {
tmp = y * (-0.3333333333333333 / 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 (x <= (-2.3d+140)) then
tmp = x
else if (x <= (-4.6d+118)) then
tmp = (-0.3333333333333333d0) * (y / z)
else if (x <= (-40.0d0)) then
tmp = x
else if (x <= 1.05d-58) then
tmp = y * ((-0.3333333333333333d0) / 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 (x <= -2.3e+140) {
tmp = x;
} else if (x <= -4.6e+118) {
tmp = -0.3333333333333333 * (y / z);
} else if (x <= -40.0) {
tmp = x;
} else if (x <= 1.05e-58) {
tmp = y * (-0.3333333333333333 / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.3e+140: tmp = x elif x <= -4.6e+118: tmp = -0.3333333333333333 * (y / z) elif x <= -40.0: tmp = x elif x <= 1.05e-58: tmp = y * (-0.3333333333333333 / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.3e+140) tmp = x; elseif (x <= -4.6e+118) tmp = Float64(-0.3333333333333333 * Float64(y / z)); elseif (x <= -40.0) tmp = x; elseif (x <= 1.05e-58) tmp = Float64(y * Float64(-0.3333333333333333 / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.3e+140) tmp = x; elseif (x <= -4.6e+118) tmp = -0.3333333333333333 * (y / z); elseif (x <= -40.0) tmp = x; elseif (x <= 1.05e-58) tmp = y * (-0.3333333333333333 / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.3e+140], x, If[LessEqual[x, -4.6e+118], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -40.0], x, If[LessEqual[x, 1.05e-58], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+140}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -4.6 \cdot 10^{+118}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{y}{z}\\
\mathbf{elif}\;x \leq -40:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{-58}:\\
\;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.2999999999999999e140 or -4.60000000000000032e118 < x < -40 or 1.04999999999999994e-58 < x Initial program 98.3%
associate-/r*99.0%
Simplified99.0%
Taylor expanded in x around inf 53.7%
if -2.2999999999999999e140 < x < -4.60000000000000032e118Initial program 99.8%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in y around inf 61.7%
*-commutative61.7%
Simplified61.7%
if -40 < x < 1.04999999999999994e-58Initial program 94.5%
associate-/r*94.8%
Simplified94.8%
Taylor expanded in x around 0 87.1%
associate-/r*87.3%
associate-*r/87.3%
associate-*r/87.3%
div-sub88.1%
distribute-lft-out--88.1%
Simplified88.1%
Taylor expanded in t around 0 50.7%
*-commutative50.7%
Simplified50.7%
associate-/l*50.8%
div-inv50.7%
clear-num50.7%
Applied egg-rr50.7%
Final simplification52.5%
(FPCore (x y z t)
:precision binary64
(if (<= x -2.3e+140)
x
(if (<= x -7.1e+118)
(* -0.3333333333333333 (/ y z))
(if (<= x -55.0) x (if (<= x 1.05e-58) (/ y (* z -3.0)) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.3e+140) {
tmp = x;
} else if (x <= -7.1e+118) {
tmp = -0.3333333333333333 * (y / z);
} else if (x <= -55.0) {
tmp = x;
} else if (x <= 1.05e-58) {
tmp = y / (z * -3.0);
} 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 (x <= (-2.3d+140)) then
tmp = x
else if (x <= (-7.1d+118)) then
tmp = (-0.3333333333333333d0) * (y / z)
else if (x <= (-55.0d0)) then
tmp = x
else if (x <= 1.05d-58) then
tmp = y / (z * (-3.0d0))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.3e+140) {
tmp = x;
} else if (x <= -7.1e+118) {
tmp = -0.3333333333333333 * (y / z);
} else if (x <= -55.0) {
tmp = x;
} else if (x <= 1.05e-58) {
tmp = y / (z * -3.0);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.3e+140: tmp = x elif x <= -7.1e+118: tmp = -0.3333333333333333 * (y / z) elif x <= -55.0: tmp = x elif x <= 1.05e-58: tmp = y / (z * -3.0) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.3e+140) tmp = x; elseif (x <= -7.1e+118) tmp = Float64(-0.3333333333333333 * Float64(y / z)); elseif (x <= -55.0) tmp = x; elseif (x <= 1.05e-58) tmp = Float64(y / Float64(z * -3.0)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.3e+140) tmp = x; elseif (x <= -7.1e+118) tmp = -0.3333333333333333 * (y / z); elseif (x <= -55.0) tmp = x; elseif (x <= 1.05e-58) tmp = y / (z * -3.0); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.3e+140], x, If[LessEqual[x, -7.1e+118], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -55.0], x, If[LessEqual[x, 1.05e-58], N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+140}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -7.1 \cdot 10^{+118}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{y}{z}\\
\mathbf{elif}\;x \leq -55:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{-58}:\\
\;\;\;\;\frac{y}{z \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.2999999999999999e140 or -7.0999999999999997e118 < x < -55 or 1.04999999999999994e-58 < x Initial program 98.3%
associate-/r*99.0%
Simplified99.0%
Taylor expanded in x around inf 53.7%
if -2.2999999999999999e140 < x < -7.0999999999999997e118Initial program 99.8%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in y around inf 61.7%
*-commutative61.7%
Simplified61.7%
if -55 < x < 1.04999999999999994e-58Initial program 94.5%
associate-/r*94.8%
Simplified94.8%
Taylor expanded in x around 0 87.1%
associate-/r*87.3%
associate-*r/87.3%
associate-*r/87.3%
div-sub88.1%
distribute-lft-out--88.1%
Simplified88.1%
Taylor expanded in t around 0 50.7%
*-commutative50.7%
Simplified50.7%
associate-/l*50.8%
div-inv50.7%
clear-num50.7%
Applied egg-rr50.7%
clear-num50.7%
un-div-inv50.8%
div-inv50.8%
metadata-eval50.8%
Applied egg-rr50.8%
Final simplification52.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.2e+44) (not (<= y 1.7e+53))) (- x (* 0.3333333333333333 (/ y z))) (+ x (* 0.3333333333333333 (/ t (* y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.2e+44) || !(y <= 1.7e+53)) {
tmp = x - (0.3333333333333333 * (y / z));
} else {
tmp = x + (0.3333333333333333 * (t / (y * 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 ((y <= (-2.2d+44)) .or. (.not. (y <= 1.7d+53))) then
tmp = x - (0.3333333333333333d0 * (y / z))
else
tmp = x + (0.3333333333333333d0 * (t / (y * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.2e+44) || !(y <= 1.7e+53)) {
tmp = x - (0.3333333333333333 * (y / z));
} else {
tmp = x + (0.3333333333333333 * (t / (y * z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.2e+44) or not (y <= 1.7e+53): tmp = x - (0.3333333333333333 * (y / z)) else: tmp = x + (0.3333333333333333 * (t / (y * z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.2e+44) || !(y <= 1.7e+53)) tmp = Float64(x - Float64(0.3333333333333333 * Float64(y / z))); else tmp = Float64(x + Float64(0.3333333333333333 * Float64(t / Float64(y * z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.2e+44) || ~((y <= 1.7e+53))) tmp = x - (0.3333333333333333 * (y / z)); else tmp = x + (0.3333333333333333 * (t / (y * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.2e+44], N[Not[LessEqual[y, 1.7e+53]], $MachinePrecision]], N[(x - N[(0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(0.3333333333333333 * N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{+44} \lor \neg \left(y \leq 1.7 \cdot 10^{+53}\right):\\
\;\;\;\;x - 0.3333333333333333 \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{y \cdot z}\\
\end{array}
\end{array}
if y < -2.19999999999999996e44 or 1.69999999999999999e53 < y Initial program 98.0%
associate-/r*96.1%
Simplified96.1%
Taylor expanded in t around 0 95.4%
if -2.19999999999999996e44 < y < 1.69999999999999999e53Initial program 95.3%
associate-/r*97.6%
Simplified97.6%
Taylor expanded in y around 0 86.8%
Final simplification90.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6e-31) (not (<= y 6e-122))) (- x (* 0.3333333333333333 (/ y z))) (* (/ t z) (/ 0.3333333333333333 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6e-31) || !(y <= 6e-122)) {
tmp = x - (0.3333333333333333 * (y / z));
} else {
tmp = (t / z) * (0.3333333333333333 / 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 ((y <= (-6d-31)) .or. (.not. (y <= 6d-122))) then
tmp = x - (0.3333333333333333d0 * (y / z))
else
tmp = (t / z) * (0.3333333333333333d0 / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6e-31) || !(y <= 6e-122)) {
tmp = x - (0.3333333333333333 * (y / z));
} else {
tmp = (t / z) * (0.3333333333333333 / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6e-31) or not (y <= 6e-122): tmp = x - (0.3333333333333333 * (y / z)) else: tmp = (t / z) * (0.3333333333333333 / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6e-31) || !(y <= 6e-122)) tmp = Float64(x - Float64(0.3333333333333333 * Float64(y / z))); else tmp = Float64(Float64(t / z) * Float64(0.3333333333333333 / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6e-31) || ~((y <= 6e-122))) tmp = x - (0.3333333333333333 * (y / z)); else tmp = (t / z) * (0.3333333333333333 / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6e-31], N[Not[LessEqual[y, 6e-122]], $MachinePrecision]], N[(x - N[(0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{-31} \lor \neg \left(y \leq 6 \cdot 10^{-122}\right):\\
\;\;\;\;x - 0.3333333333333333 \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\end{array}
\end{array}
if y < -5.99999999999999962e-31 or 6.00000000000000009e-122 < y Initial program 98.6%
associate-/r*97.3%
Simplified97.3%
Taylor expanded in t around 0 87.3%
if -5.99999999999999962e-31 < y < 6.00000000000000009e-122Initial program 92.8%
associate-/r*96.3%
Simplified96.3%
Taylor expanded in x around 0 71.3%
associate-/r*68.5%
associate-*r/68.6%
associate-*r/68.6%
div-sub68.6%
distribute-lft-out--68.6%
Simplified68.6%
Taylor expanded in t around inf 66.5%
associate-*r/66.5%
*-commutative66.5%
associate-*r/66.5%
Simplified66.5%
associate-/l*70.3%
associate-/r/73.4%
Applied egg-rr73.4%
Final simplification82.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.08e-32) (not (<= y 6e-122))) (- x (* 0.3333333333333333 (/ y z))) (/ 0.3333333333333333 (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.08e-32) || !(y <= 6e-122)) {
tmp = x - (0.3333333333333333 * (y / z));
} else {
tmp = 0.3333333333333333 / (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 <= (-1.08d-32)) .or. (.not. (y <= 6d-122))) then
tmp = x - (0.3333333333333333d0 * (y / z))
else
tmp = 0.3333333333333333d0 / (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 <= -1.08e-32) || !(y <= 6e-122)) {
tmp = x - (0.3333333333333333 * (y / z));
} else {
tmp = 0.3333333333333333 / (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.08e-32) or not (y <= 6e-122): tmp = x - (0.3333333333333333 * (y / z)) else: tmp = 0.3333333333333333 / (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.08e-32) || !(y <= 6e-122)) tmp = Float64(x - Float64(0.3333333333333333 * Float64(y / z))); else tmp = Float64(0.3333333333333333 / Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.08e-32) || ~((y <= 6e-122))) tmp = x - (0.3333333333333333 * (y / z)); else tmp = 0.3333333333333333 / (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.08e-32], N[Not[LessEqual[y, 6e-122]], $MachinePrecision]], N[(x - N[(0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.3333333333333333 / N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.08 \cdot 10^{-32} \lor \neg \left(y \leq 6 \cdot 10^{-122}\right):\\
\;\;\;\;x - 0.3333333333333333 \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333}{y \cdot \frac{z}{t}}\\
\end{array}
\end{array}
if y < -1.08e-32 or 6.00000000000000009e-122 < y Initial program 98.6%
associate-/r*97.3%
Simplified97.3%
Taylor expanded in t around 0 87.3%
if -1.08e-32 < y < 6.00000000000000009e-122Initial program 92.8%
associate-/r*96.3%
Simplified96.3%
Taylor expanded in x around 0 71.3%
associate-/r*68.5%
associate-*r/68.6%
associate-*r/68.6%
div-sub68.6%
distribute-lft-out--68.6%
Simplified68.6%
Taylor expanded in t around inf 66.5%
associate-*r/66.5%
*-commutative66.5%
associate-*r/66.5%
Simplified66.5%
associate-/l*70.3%
associate-/r/73.4%
Applied egg-rr73.4%
clear-num73.3%
frac-times73.4%
metadata-eval73.4%
Applied egg-rr73.4%
Final simplification82.1%
(FPCore (x y z t) :precision binary64 (+ x (* (/ -0.3333333333333333 z) (- y (/ t y)))))
double code(double x, double y, double z, double t) {
return x + ((-0.3333333333333333 / z) * (y - (t / y)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + (((-0.3333333333333333d0) / z) * (y - (t / y)))
end function
public static double code(double x, double y, double z, double t) {
return x + ((-0.3333333333333333 / z) * (y - (t / y)));
}
def code(x, y, z, t): return x + ((-0.3333333333333333 / z) * (y - (t / y)))
function code(x, y, z, t) return Float64(x + Float64(Float64(-0.3333333333333333 / z) * Float64(y - Float64(t / y)))) end
function tmp = code(x, y, z, t) tmp = x + ((-0.3333333333333333 / z) * (y - (t / y))); end
code[x_, y_, z_, t_] := N[(x + N[(N[(-0.3333333333333333 / z), $MachinePrecision] * N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)
\end{array}
Initial program 96.4%
associate-+l-96.4%
sub-neg96.4%
sub-neg96.4%
distribute-neg-in96.4%
unsub-neg96.4%
neg-mul-196.4%
associate-*r/96.4%
associate-*l/96.4%
distribute-neg-frac96.4%
neg-mul-196.4%
times-frac94.6%
distribute-lft-out--95.0%
*-commutative95.0%
associate-/r*95.0%
metadata-eval95.0%
Simplified95.0%
Final simplification95.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 96.4%
associate-/r*96.9%
Simplified96.9%
Taylor expanded in x around inf 30.1%
Final simplification30.1%
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y)))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x - (y / (z * 3.0d0))) + ((t / (z * 3.0d0)) / y)
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y);
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y)
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(Float64(t / Float64(z * 3.0)) / y)) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t / N[(z * 3.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}
\end{array}
herbie shell --seed 2023173
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H"
:precision binary64
:herbie-target
(+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y))
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))