
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - 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 - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - 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 - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - 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 - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))) (t_2 (+ x (* y t))))
(if (<= z -7e-10)
t_1
(if (<= z 3.6e-27)
t_2
(if (<= z 6e+35)
t_1
(if (<= z 4.2e+79)
t_2
(if (or (<= z 1.1e+101) (not (<= z 4.3e+291)))
(+ x (* x z))
t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double t_2 = x + (y * t);
double tmp;
if (z <= -7e-10) {
tmp = t_1;
} else if (z <= 3.6e-27) {
tmp = t_2;
} else if (z <= 6e+35) {
tmp = t_1;
} else if (z <= 4.2e+79) {
tmp = t_2;
} else if ((z <= 1.1e+101) || !(z <= 4.3e+291)) {
tmp = x + (x * z);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = z * -t
t_2 = x + (y * t)
if (z <= (-7d-10)) then
tmp = t_1
else if (z <= 3.6d-27) then
tmp = t_2
else if (z <= 6d+35) then
tmp = t_1
else if (z <= 4.2d+79) then
tmp = t_2
else if ((z <= 1.1d+101) .or. (.not. (z <= 4.3d+291))) then
tmp = x + (x * z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double t_2 = x + (y * t);
double tmp;
if (z <= -7e-10) {
tmp = t_1;
} else if (z <= 3.6e-27) {
tmp = t_2;
} else if (z <= 6e+35) {
tmp = t_1;
} else if (z <= 4.2e+79) {
tmp = t_2;
} else if ((z <= 1.1e+101) || !(z <= 4.3e+291)) {
tmp = x + (x * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t t_2 = x + (y * t) tmp = 0 if z <= -7e-10: tmp = t_1 elif z <= 3.6e-27: tmp = t_2 elif z <= 6e+35: tmp = t_1 elif z <= 4.2e+79: tmp = t_2 elif (z <= 1.1e+101) or not (z <= 4.3e+291): tmp = x + (x * z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) t_2 = Float64(x + Float64(y * t)) tmp = 0.0 if (z <= -7e-10) tmp = t_1; elseif (z <= 3.6e-27) tmp = t_2; elseif (z <= 6e+35) tmp = t_1; elseif (z <= 4.2e+79) tmp = t_2; elseif ((z <= 1.1e+101) || !(z <= 4.3e+291)) tmp = Float64(x + Float64(x * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; t_2 = x + (y * t); tmp = 0.0; if (z <= -7e-10) tmp = t_1; elseif (z <= 3.6e-27) tmp = t_2; elseif (z <= 6e+35) tmp = t_1; elseif (z <= 4.2e+79) tmp = t_2; elseif ((z <= 1.1e+101) || ~((z <= 4.3e+291))) tmp = x + (x * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7e-10], t$95$1, If[LessEqual[z, 3.6e-27], t$95$2, If[LessEqual[z, 6e+35], t$95$1, If[LessEqual[z, 4.2e+79], t$95$2, If[Or[LessEqual[z, 1.1e+101], N[Not[LessEqual[z, 4.3e+291]], $MachinePrecision]], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
t_2 := x + y \cdot t\\
\mathbf{if}\;z \leq -7 \cdot 10^{-10}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-27}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+79}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+101} \lor \neg \left(z \leq 4.3 \cdot 10^{+291}\right):\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.99999999999999961e-10 or 3.5999999999999999e-27 < z < 5.99999999999999981e35 or 1.1e101 < z < 4.2999999999999999e291Initial program 100.0%
Taylor expanded in t around inf 61.7%
Taylor expanded in z around inf 54.0%
associate-*r*54.0%
*-commutative54.0%
neg-mul-154.0%
Simplified54.0%
if -6.99999999999999961e-10 < z < 3.5999999999999999e-27 or 5.99999999999999981e35 < z < 4.20000000000000016e79Initial program 100.0%
Taylor expanded in t around inf 78.5%
Taylor expanded in z around 0 70.9%
if 4.20000000000000016e79 < z < 1.1e101 or 4.2999999999999999e291 < z Initial program 100.0%
Taylor expanded in t around 0 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 90.9%
*-commutative90.9%
Simplified90.9%
Final simplification63.9%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.8e+270)
(* y t)
(if (<= y -3.6e+242)
(* x (- y))
(if (or (<= y -1.8e-16) (not (<= y 1.8e-26))) (* y t) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.8e+270) {
tmp = y * t;
} else if (y <= -3.6e+242) {
tmp = x * -y;
} else if ((y <= -1.8e-16) || !(y <= 1.8e-26)) {
tmp = y * 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 <= (-1.8d+270)) then
tmp = y * t
else if (y <= (-3.6d+242)) then
tmp = x * -y
else if ((y <= (-1.8d-16)) .or. (.not. (y <= 1.8d-26))) then
tmp = y * 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 <= -1.8e+270) {
tmp = y * t;
} else if (y <= -3.6e+242) {
tmp = x * -y;
} else if ((y <= -1.8e-16) || !(y <= 1.8e-26)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.8e+270: tmp = y * t elif y <= -3.6e+242: tmp = x * -y elif (y <= -1.8e-16) or not (y <= 1.8e-26): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.8e+270) tmp = Float64(y * t); elseif (y <= -3.6e+242) tmp = Float64(x * Float64(-y)); elseif ((y <= -1.8e-16) || !(y <= 1.8e-26)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.8e+270) tmp = y * t; elseif (y <= -3.6e+242) tmp = x * -y; elseif ((y <= -1.8e-16) || ~((y <= 1.8e-26))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.8e+270], N[(y * t), $MachinePrecision], If[LessEqual[y, -3.6e+242], N[(x * (-y)), $MachinePrecision], If[Or[LessEqual[y, -1.8e-16], N[Not[LessEqual[y, 1.8e-26]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{+270}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{+242}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{elif}\;y \leq -1.8 \cdot 10^{-16} \lor \neg \left(y \leq 1.8 \cdot 10^{-26}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.8000000000000001e270 or -3.59999999999999995e242 < y < -1.79999999999999991e-16 or 1.8000000000000001e-26 < y Initial program 100.0%
Taylor expanded in t around inf 60.1%
Taylor expanded in y around inf 48.0%
if -1.8000000000000001e270 < y < -3.59999999999999995e242Initial program 100.0%
Taylor expanded in t around 0 87.9%
mul-1-neg87.9%
distribute-rgt-neg-in87.9%
sub-neg87.9%
+-commutative87.9%
distribute-neg-in87.9%
remove-double-neg87.9%
sub-neg87.9%
Simplified87.9%
Taylor expanded in z around 0 87.9%
mul-1-neg87.9%
unsub-neg87.9%
Simplified87.9%
Taylor expanded in y around inf 87.9%
associate-*r*87.9%
neg-mul-187.9%
*-commutative87.9%
Simplified87.9%
if -1.79999999999999991e-16 < y < 1.8000000000000001e-26Initial program 100.0%
Taylor expanded in t around inf 77.4%
Taylor expanded in x around inf 34.8%
Final simplification42.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -8.5e-10)
t_1
(if (<= z -4.5e-275) (* y t) (if (<= z 7.5e-29) x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -8.5e-10) {
tmp = t_1;
} else if (z <= -4.5e-275) {
tmp = y * t;
} else if (z <= 7.5e-29) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z * -t
if (z <= (-8.5d-10)) then
tmp = t_1
else if (z <= (-4.5d-275)) then
tmp = y * t
else if (z <= 7.5d-29) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -8.5e-10) {
tmp = t_1;
} else if (z <= -4.5e-275) {
tmp = y * t;
} else if (z <= 7.5e-29) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -8.5e-10: tmp = t_1 elif z <= -4.5e-275: tmp = y * t elif z <= 7.5e-29: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -8.5e-10) tmp = t_1; elseif (z <= -4.5e-275) tmp = Float64(y * t); elseif (z <= 7.5e-29) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (z <= -8.5e-10) tmp = t_1; elseif (z <= -4.5e-275) tmp = y * t; elseif (z <= 7.5e-29) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -8.5e-10], t$95$1, If[LessEqual[z, -4.5e-275], N[(y * t), $MachinePrecision], If[LessEqual[z, 7.5e-29], x, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{-10}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{-275}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-29}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.4999999999999996e-10 or 7.50000000000000006e-29 < z Initial program 100.0%
Taylor expanded in t around inf 57.2%
Taylor expanded in z around inf 47.1%
associate-*r*47.1%
*-commutative47.1%
neg-mul-147.1%
Simplified47.1%
if -8.4999999999999996e-10 < z < -4.49999999999999978e-275Initial program 100.0%
Taylor expanded in t around inf 78.1%
Taylor expanded in y around inf 43.4%
if -4.49999999999999978e-275 < z < 7.50000000000000006e-29Initial program 100.0%
Taylor expanded in t around inf 82.7%
Taylor expanded in x around inf 49.2%
Final simplification46.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.2e+172) (not (<= x 1.1e+105))) (+ x (* x z)) (+ x (* (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.2e+172) || !(x <= 1.1e+105)) {
tmp = x + (x * z);
} 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 <= (-7.2d+172)) .or. (.not. (x <= 1.1d+105))) then
tmp = x + (x * z)
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 <= -7.2e+172) || !(x <= 1.1e+105)) {
tmp = x + (x * z);
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.2e+172) or not (x <= 1.1e+105): tmp = x + (x * z) else: tmp = x + ((y - z) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7.2e+172) || !(x <= 1.1e+105)) tmp = Float64(x + Float64(x * z)); else tmp = Float64(x + Float64(Float64(y - z) * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -7.2e+172) || ~((x <= 1.1e+105))) tmp = x + (x * z); else tmp = x + ((y - z) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.2e+172], N[Not[LessEqual[x, 1.1e+105]], $MachinePrecision]], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+172} \lor \neg \left(x \leq 1.1 \cdot 10^{+105}\right):\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -7.1999999999999995e172 or 1.10000000000000003e105 < x Initial program 100.0%
Taylor expanded in t around 0 93.8%
mul-1-neg93.8%
distribute-rgt-neg-in93.8%
sub-neg93.8%
+-commutative93.8%
distribute-neg-in93.8%
remove-double-neg93.8%
sub-neg93.8%
Simplified93.8%
Taylor expanded in y around 0 73.6%
*-commutative73.6%
Simplified73.6%
if -7.1999999999999995e172 < x < 1.10000000000000003e105Initial program 100.0%
Taylor expanded in t around inf 76.3%
Final simplification75.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.7e+25) (not (<= x 4.5e+95))) (+ x (* x (- z y))) (+ x (* (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.7e+25) || !(x <= 4.5e+95)) {
tmp = x + (x * (z - y));
} 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 <= (-4.7d+25)) .or. (.not. (x <= 4.5d+95))) then
tmp = x + (x * (z - y))
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 <= -4.7e+25) || !(x <= 4.5e+95)) {
tmp = x + (x * (z - y));
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.7e+25) or not (x <= 4.5e+95): tmp = x + (x * (z - y)) else: tmp = x + ((y - z) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.7e+25) || !(x <= 4.5e+95)) tmp = Float64(x + Float64(x * Float64(z - y))); else tmp = Float64(x + Float64(Float64(y - z) * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.7e+25) || ~((x <= 4.5e+95))) tmp = x + (x * (z - y)); else tmp = x + ((y - z) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.7e+25], N[Not[LessEqual[x, 4.5e+95]], $MachinePrecision]], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.7 \cdot 10^{+25} \lor \neg \left(x \leq 4.5 \cdot 10^{+95}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -4.6999999999999998e25 or 4.50000000000000017e95 < x Initial program 100.0%
Taylor expanded in t around 0 85.6%
mul-1-neg85.6%
distribute-rgt-neg-in85.6%
sub-neg85.6%
+-commutative85.6%
distribute-neg-in85.6%
remove-double-neg85.6%
sub-neg85.6%
Simplified85.6%
if -4.6999999999999998e25 < x < 4.50000000000000017e95Initial program 100.0%
Taylor expanded in t around inf 82.1%
Final simplification83.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.5e+16) (not (<= y 8.5e-26))) (+ x (* y (- t x))) (+ x (* z (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.5e+16) || !(y <= 8.5e-26)) {
tmp = x + (y * (t - x));
} else {
tmp = x + (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 ((y <= (-6.5d+16)) .or. (.not. (y <= 8.5d-26))) then
tmp = x + (y * (t - x))
else
tmp = x + (z * (x - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.5e+16) || !(y <= 8.5e-26)) {
tmp = x + (y * (t - x));
} else {
tmp = x + (z * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.5e+16) or not (y <= 8.5e-26): tmp = x + (y * (t - x)) else: tmp = x + (z * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.5e+16) || !(y <= 8.5e-26)) tmp = Float64(x + Float64(y * Float64(t - x))); else tmp = Float64(x + Float64(z * Float64(x - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6.5e+16) || ~((y <= 8.5e-26))) tmp = x + (y * (t - x)); else tmp = x + (z * (x - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.5e+16], N[Not[LessEqual[y, 8.5e-26]], $MachinePrecision]], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{+16} \lor \neg \left(y \leq 8.5 \cdot 10^{-26}\right):\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\end{array}
\end{array}
if y < -6.5e16 or 8.50000000000000004e-26 < y Initial program 100.0%
Taylor expanded in y around inf 80.2%
*-commutative80.2%
Simplified80.2%
if -6.5e16 < y < 8.50000000000000004e-26Initial program 100.0%
Taylor expanded in y around 0 96.4%
mul-1-neg96.4%
distribute-rgt-neg-in96.4%
sub-neg96.4%
+-commutative96.4%
distribute-neg-in96.4%
remove-double-neg96.4%
sub-neg96.4%
Simplified96.4%
Final simplification88.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.55e-9) (not (<= z 3.6e-27))) (* z (- t)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.55e-9) || !(z <= 3.6e-27)) {
tmp = z * -t;
} 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 ((z <= (-3.55d-9)) .or. (.not. (z <= 3.6d-27))) then
tmp = z * -t
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 ((z <= -3.55e-9) || !(z <= 3.6e-27)) {
tmp = z * -t;
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.55e-9) or not (z <= 3.6e-27): tmp = z * -t else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.55e-9) || !(z <= 3.6e-27)) tmp = Float64(z * Float64(-t)); else tmp = Float64(x + Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.55e-9) || ~((z <= 3.6e-27))) tmp = z * -t; else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.55e-9], N[Not[LessEqual[z, 3.6e-27]], $MachinePrecision]], N[(z * (-t)), $MachinePrecision], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.55 \cdot 10^{-9} \lor \neg \left(z \leq 3.6 \cdot 10^{-27}\right):\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if z < -3.54999999999999994e-9 or 3.5999999999999999e-27 < z Initial program 100.0%
Taylor expanded in t around inf 56.9%
Taylor expanded in z around inf 47.4%
associate-*r*47.4%
*-commutative47.4%
neg-mul-147.4%
Simplified47.4%
if -3.54999999999999994e-9 < z < 3.5999999999999999e-27Initial program 100.0%
Taylor expanded in t around inf 80.5%
Taylor expanded in z around 0 73.0%
Final simplification58.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2e-16) (not (<= y 2.3e-26))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2e-16) || !(y <= 2.3e-26)) {
tmp = y * 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 <= (-2d-16)) .or. (.not. (y <= 2.3d-26))) then
tmp = y * 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 <= -2e-16) || !(y <= 2.3e-26)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2e-16) or not (y <= 2.3e-26): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2e-16) || !(y <= 2.3e-26)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2e-16) || ~((y <= 2.3e-26))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2e-16], N[Not[LessEqual[y, 2.3e-26]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-16} \lor \neg \left(y \leq 2.3 \cdot 10^{-26}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2e-16 or 2.30000000000000009e-26 < y Initial program 100.0%
Taylor expanded in t around inf 58.1%
Taylor expanded in y around inf 46.8%
if -2e-16 < y < 2.30000000000000009e-26Initial program 100.0%
Taylor expanded in t around inf 77.4%
Taylor expanded in x around inf 34.8%
Final simplification40.9%
(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 100.0%
Taylor expanded in t around inf 67.5%
Taylor expanded in x around inf 18.4%
Final simplification18.4%
(FPCore (x y z t) :precision binary64 (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (y - z)));
}
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 + ((t * (y - z)) + (-x * (y - z)))
end function
public static double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (y - z)));
}
def code(x, y, z, t): return x + ((t * (y - z)) + (-x * (y - z)))
function code(x, y, z, t) return Float64(x + Float64(Float64(t * Float64(y - z)) + Float64(Float64(-x) * Float64(y - z)))) end
function tmp = code(x, y, z, t) tmp = x + ((t * (y - z)) + (-x * (y - z))); end
code[x_, y_, z_, t_] := N[(x + N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] + N[((-x) * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t \cdot \left(y - z\right) + \left(-x\right) \cdot \left(y - z\right)\right)
\end{array}
herbie shell --seed 2024078
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:alt
(+ x (+ (* t (- y z)) (* (- x) (- y z))))
(+ x (* (- y z) (- t x))))