
(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 12 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 (* (- t x) (- y z))))
double code(double x, double y, double z, double t) {
return x + ((t - 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 - x) * (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((t - x) * (y - z));
}
def code(x, y, z, t): return x + ((t - x) * (y - z))
function code(x, y, z, t) return Float64(x + Float64(Float64(t - x) * Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x + ((t - x) * (y - z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(t - x), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t - x\right) \cdot \left(y - z\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= z -1.6e+27)
(* x z)
(if (<= z -6.8e-249)
t_1
(if (<= z 1.6e-17)
(* x (- 1.0 y))
(if (<= z 4.3e+68) t_1 (* t (- z))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (z <= -1.6e+27) {
tmp = x * z;
} else if (z <= -6.8e-249) {
tmp = t_1;
} else if (z <= 1.6e-17) {
tmp = x * (1.0 - y);
} else if (z <= 4.3e+68) {
tmp = t_1;
} else {
tmp = 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 * (t - x)
if (z <= (-1.6d+27)) then
tmp = x * z
else if (z <= (-6.8d-249)) then
tmp = t_1
else if (z <= 1.6d-17) then
tmp = x * (1.0d0 - y)
else if (z <= 4.3d+68) then
tmp = t_1
else
tmp = t * -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (z <= -1.6e+27) {
tmp = x * z;
} else if (z <= -6.8e-249) {
tmp = t_1;
} else if (z <= 1.6e-17) {
tmp = x * (1.0 - y);
} else if (z <= 4.3e+68) {
tmp = t_1;
} else {
tmp = t * -z;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if z <= -1.6e+27: tmp = x * z elif z <= -6.8e-249: tmp = t_1 elif z <= 1.6e-17: tmp = x * (1.0 - y) elif z <= 4.3e+68: tmp = t_1 else: tmp = t * -z return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (z <= -1.6e+27) tmp = Float64(x * z); elseif (z <= -6.8e-249) tmp = t_1; elseif (z <= 1.6e-17) tmp = Float64(x * Float64(1.0 - y)); elseif (z <= 4.3e+68) tmp = t_1; else tmp = Float64(t * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); tmp = 0.0; if (z <= -1.6e+27) tmp = x * z; elseif (z <= -6.8e-249) tmp = t_1; elseif (z <= 1.6e-17) tmp = x * (1.0 - y); elseif (z <= 4.3e+68) tmp = t_1; else tmp = t * -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.6e+27], N[(x * z), $MachinePrecision], If[LessEqual[z, -6.8e-249], t$95$1, If[LessEqual[z, 1.6e-17], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.3e+68], t$95$1, N[(t * (-z)), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;z \leq -1.6 \cdot 10^{+27}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -6.8 \cdot 10^{-249}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-17}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < -1.60000000000000008e27Initial program 99.9%
Taylor expanded in t around 0 59.3%
mul-1-neg59.3%
distribute-rgt-neg-in59.3%
sub-neg59.3%
+-commutative59.3%
distribute-neg-in59.3%
remove-double-neg59.3%
sub-neg59.3%
Simplified59.3%
Taylor expanded in z around inf 55.4%
Taylor expanded in z around inf 55.4%
*-commutative55.4%
Simplified55.4%
if -1.60000000000000008e27 < z < -6.7999999999999996e-249 or 1.6000000000000001e-17 < z < 4.3000000000000001e68Initial program 100.0%
sub-neg100.0%
distribute-lft-in96.8%
Applied egg-rr96.8%
distribute-rgt-neg-out96.8%
unsub-neg96.8%
Applied egg-rr96.8%
Taylor expanded in z around 0 84.1%
Taylor expanded in y around inf 70.2%
if -6.7999999999999996e-249 < z < 1.6000000000000001e-17Initial program 100.0%
Taylor expanded in t around 0 69.0%
mul-1-neg69.0%
distribute-rgt-neg-in69.0%
sub-neg69.0%
+-commutative69.0%
distribute-neg-in69.0%
remove-double-neg69.0%
sub-neg69.0%
Simplified69.0%
Taylor expanded in z around 0 69.0%
mul-1-neg69.0%
*-rgt-identity69.0%
distribute-rgt-neg-out69.0%
distribute-lft-in69.0%
unsub-neg69.0%
Simplified69.0%
if 4.3000000000000001e68 < z Initial program 100.0%
Taylor expanded in y around 0 86.3%
mul-1-neg86.3%
unsub-neg86.3%
Simplified86.3%
Taylor expanded in t around inf 59.9%
Taylor expanded in x around 0 59.7%
associate-*r*59.7%
neg-mul-159.7%
Simplified59.7%
Final simplification64.2%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.5e+24)
(* x z)
(if (<= z -1.45e-245)
(* y t)
(if (<= z 1.65e-16) x (if (<= z 1.1e+66) (* y t) (* t (- z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.5e+24) {
tmp = x * z;
} else if (z <= -1.45e-245) {
tmp = y * t;
} else if (z <= 1.65e-16) {
tmp = x;
} else if (z <= 1.1e+66) {
tmp = y * t;
} else {
tmp = 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 <= (-1.5d+24)) then
tmp = x * z
else if (z <= (-1.45d-245)) then
tmp = y * t
else if (z <= 1.65d-16) then
tmp = x
else if (z <= 1.1d+66) then
tmp = y * t
else
tmp = t * -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.5e+24) {
tmp = x * z;
} else if (z <= -1.45e-245) {
tmp = y * t;
} else if (z <= 1.65e-16) {
tmp = x;
} else if (z <= 1.1e+66) {
tmp = y * t;
} else {
tmp = t * -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.5e+24: tmp = x * z elif z <= -1.45e-245: tmp = y * t elif z <= 1.65e-16: tmp = x elif z <= 1.1e+66: tmp = y * t else: tmp = t * -z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.5e+24) tmp = Float64(x * z); elseif (z <= -1.45e-245) tmp = Float64(y * t); elseif (z <= 1.65e-16) tmp = x; elseif (z <= 1.1e+66) tmp = Float64(y * t); else tmp = Float64(t * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.5e+24) tmp = x * z; elseif (z <= -1.45e-245) tmp = y * t; elseif (z <= 1.65e-16) tmp = x; elseif (z <= 1.1e+66) tmp = y * t; else tmp = t * -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.5e+24], N[(x * z), $MachinePrecision], If[LessEqual[z, -1.45e-245], N[(y * t), $MachinePrecision], If[LessEqual[z, 1.65e-16], x, If[LessEqual[z, 1.1e+66], N[(y * t), $MachinePrecision], N[(t * (-z)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+24}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -1.45 \cdot 10^{-245}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-16}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+66}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < -1.49999999999999997e24Initial program 99.9%
Taylor expanded in t around 0 59.3%
mul-1-neg59.3%
distribute-rgt-neg-in59.3%
sub-neg59.3%
+-commutative59.3%
distribute-neg-in59.3%
remove-double-neg59.3%
sub-neg59.3%
Simplified59.3%
Taylor expanded in z around inf 55.4%
Taylor expanded in z around inf 55.4%
*-commutative55.4%
Simplified55.4%
if -1.49999999999999997e24 < z < -1.45e-245 or 1.64999999999999994e-16 < z < 1.0999999999999999e66Initial program 100.0%
sub-neg100.0%
distribute-lft-in96.8%
Applied egg-rr96.8%
distribute-rgt-neg-out96.8%
unsub-neg96.8%
Applied egg-rr96.8%
Taylor expanded in z around 0 84.1%
Taylor expanded in x around 0 51.8%
if -1.45e-245 < z < 1.64999999999999994e-16Initial program 100.0%
Taylor expanded in y around inf 96.0%
*-commutative96.0%
Simplified96.0%
Taylor expanded in y around 0 42.9%
if 1.0999999999999999e66 < z Initial program 100.0%
Taylor expanded in y around 0 86.3%
mul-1-neg86.3%
unsub-neg86.3%
Simplified86.3%
Taylor expanded in t around inf 59.9%
Taylor expanded in x around 0 59.7%
associate-*r*59.7%
neg-mul-159.7%
Simplified59.7%
Final simplification51.8%
(FPCore (x y z t)
:precision binary64
(if (<= z -3e+17)
(* x z)
(if (<= z -1.4e-248)
(* y t)
(if (<= z 8.6e-19) x (if (<= z 1.55e+125) (* y t) (* x z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3e+17) {
tmp = x * z;
} else if (z <= -1.4e-248) {
tmp = y * t;
} else if (z <= 8.6e-19) {
tmp = x;
} else if (z <= 1.55e+125) {
tmp = y * t;
} else {
tmp = x * 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 <= (-3d+17)) then
tmp = x * z
else if (z <= (-1.4d-248)) then
tmp = y * t
else if (z <= 8.6d-19) then
tmp = x
else if (z <= 1.55d+125) then
tmp = y * t
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3e+17) {
tmp = x * z;
} else if (z <= -1.4e-248) {
tmp = y * t;
} else if (z <= 8.6e-19) {
tmp = x;
} else if (z <= 1.55e+125) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3e+17: tmp = x * z elif z <= -1.4e-248: tmp = y * t elif z <= 8.6e-19: tmp = x elif z <= 1.55e+125: tmp = y * t else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3e+17) tmp = Float64(x * z); elseif (z <= -1.4e-248) tmp = Float64(y * t); elseif (z <= 8.6e-19) tmp = x; elseif (z <= 1.55e+125) tmp = Float64(y * t); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3e+17) tmp = x * z; elseif (z <= -1.4e-248) tmp = y * t; elseif (z <= 8.6e-19) tmp = x; elseif (z <= 1.55e+125) tmp = y * t; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3e+17], N[(x * z), $MachinePrecision], If[LessEqual[z, -1.4e-248], N[(y * t), $MachinePrecision], If[LessEqual[z, 8.6e-19], x, If[LessEqual[z, 1.55e+125], N[(y * t), $MachinePrecision], N[(x * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+17}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -1.4 \cdot 10^{-248}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{-19}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+125}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -3e17 or 1.55e125 < z Initial program 100.0%
Taylor expanded in t around 0 53.2%
mul-1-neg53.2%
distribute-rgt-neg-in53.2%
sub-neg53.2%
+-commutative53.2%
distribute-neg-in53.2%
remove-double-neg53.2%
sub-neg53.2%
Simplified53.2%
Taylor expanded in z around inf 49.2%
Taylor expanded in z around inf 49.2%
*-commutative49.2%
Simplified49.2%
if -3e17 < z < -1.40000000000000005e-248 or 8.6e-19 < z < 1.55e125Initial program 100.0%
sub-neg100.0%
distribute-lft-in96.2%
Applied egg-rr96.2%
distribute-rgt-neg-out96.2%
unsub-neg96.2%
Applied egg-rr96.2%
Taylor expanded in z around 0 75.3%
Taylor expanded in x around 0 48.2%
if -1.40000000000000005e-248 < z < 8.6e-19Initial program 100.0%
Taylor expanded in y around inf 96.0%
*-commutative96.0%
Simplified96.0%
Taylor expanded in y around 0 42.9%
Final simplification47.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -3.25e-34)
t_1
(if (<= y -6e-130)
(+ x (* x z))
(if (<= y 0.000165) (- x (* z t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -3.25e-34) {
tmp = t_1;
} else if (y <= -6e-130) {
tmp = x + (x * z);
} else if (y <= 0.000165) {
tmp = x - (z * t);
} 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 = y * (t - x)
if (y <= (-3.25d-34)) then
tmp = t_1
else if (y <= (-6d-130)) then
tmp = x + (x * z)
else if (y <= 0.000165d0) then
tmp = x - (z * t)
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 = y * (t - x);
double tmp;
if (y <= -3.25e-34) {
tmp = t_1;
} else if (y <= -6e-130) {
tmp = x + (x * z);
} else if (y <= 0.000165) {
tmp = x - (z * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -3.25e-34: tmp = t_1 elif y <= -6e-130: tmp = x + (x * z) elif y <= 0.000165: tmp = x - (z * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -3.25e-34) tmp = t_1; elseif (y <= -6e-130) tmp = Float64(x + Float64(x * z)); elseif (y <= 0.000165) tmp = Float64(x - Float64(z * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); tmp = 0.0; if (y <= -3.25e-34) tmp = t_1; elseif (y <= -6e-130) tmp = x + (x * z); elseif (y <= 0.000165) tmp = x - (z * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.25e-34], t$95$1, If[LessEqual[y, -6e-130], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.000165], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -3.25 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -6 \cdot 10^{-130}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{elif}\;y \leq 0.000165:\\
\;\;\;\;x - z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.24999999999999993e-34 or 1.65e-4 < y Initial program 100.0%
sub-neg100.0%
distribute-lft-in97.8%
Applied egg-rr97.8%
distribute-rgt-neg-out97.8%
unsub-neg97.8%
Applied egg-rr97.8%
Taylor expanded in z around 0 69.8%
Taylor expanded in y around inf 71.0%
if -3.24999999999999993e-34 < y < -5.99999999999999972e-130Initial program 100.0%
Taylor expanded in t around 0 86.1%
mul-1-neg86.1%
distribute-rgt-neg-in86.1%
sub-neg86.1%
+-commutative86.1%
distribute-neg-in86.1%
remove-double-neg86.1%
sub-neg86.1%
Simplified86.1%
Taylor expanded in z around inf 86.1%
if -5.99999999999999972e-130 < y < 1.65e-4Initial program 100.0%
Taylor expanded in y around 0 91.8%
mul-1-neg91.8%
unsub-neg91.8%
Simplified91.8%
Taylor expanded in t around inf 72.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -3.25e-34)
t_1
(if (<= y 4.6e-129) (+ x (* x z)) (if (<= y 4.1e-60) (* t (- z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -3.25e-34) {
tmp = t_1;
} else if (y <= 4.6e-129) {
tmp = x + (x * z);
} else if (y <= 4.1e-60) {
tmp = t * -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) :: tmp
t_1 = y * (t - x)
if (y <= (-3.25d-34)) then
tmp = t_1
else if (y <= 4.6d-129) then
tmp = x + (x * z)
else if (y <= 4.1d-60) then
tmp = t * -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 = y * (t - x);
double tmp;
if (y <= -3.25e-34) {
tmp = t_1;
} else if (y <= 4.6e-129) {
tmp = x + (x * z);
} else if (y <= 4.1e-60) {
tmp = t * -z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -3.25e-34: tmp = t_1 elif y <= 4.6e-129: tmp = x + (x * z) elif y <= 4.1e-60: tmp = t * -z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -3.25e-34) tmp = t_1; elseif (y <= 4.6e-129) tmp = Float64(x + Float64(x * z)); elseif (y <= 4.1e-60) tmp = Float64(t * Float64(-z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); tmp = 0.0; if (y <= -3.25e-34) tmp = t_1; elseif (y <= 4.6e-129) tmp = x + (x * z); elseif (y <= 4.1e-60) tmp = t * -z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.25e-34], t$95$1, If[LessEqual[y, 4.6e-129], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.1e-60], N[(t * (-z)), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -3.25 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{-129}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{-60}:\\
\;\;\;\;t \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.24999999999999993e-34 or 4.10000000000000013e-60 < y Initial program 100.0%
sub-neg100.0%
distribute-lft-in98.0%
Applied egg-rr98.0%
distribute-rgt-neg-out98.0%
unsub-neg98.0%
Applied egg-rr98.0%
Taylor expanded in z around 0 68.8%
Taylor expanded in y around inf 68.5%
if -3.24999999999999993e-34 < y < 4.5999999999999999e-129Initial program 100.0%
Taylor expanded in t around 0 72.3%
mul-1-neg72.3%
distribute-rgt-neg-in72.3%
sub-neg72.3%
+-commutative72.3%
distribute-neg-in72.3%
remove-double-neg72.3%
sub-neg72.3%
Simplified72.3%
Taylor expanded in z around inf 72.3%
if 4.5999999999999999e-129 < y < 4.10000000000000013e-60Initial program 100.0%
Taylor expanded in y around 0 87.8%
mul-1-neg87.8%
unsub-neg87.8%
Simplified87.8%
Taylor expanded in t around inf 81.5%
Taylor expanded in x around 0 63.7%
associate-*r*63.7%
neg-mul-163.7%
Simplified63.7%
Final simplification69.6%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.45e+17)
(* x z)
(if (<= z 2.06e-16)
(* x (- 1.0 y))
(if (<= z 8.6e+66) (* y t) (* t (- z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.45e+17) {
tmp = x * z;
} else if (z <= 2.06e-16) {
tmp = x * (1.0 - y);
} else if (z <= 8.6e+66) {
tmp = y * t;
} else {
tmp = 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 <= (-1.45d+17)) then
tmp = x * z
else if (z <= 2.06d-16) then
tmp = x * (1.0d0 - y)
else if (z <= 8.6d+66) then
tmp = y * t
else
tmp = t * -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.45e+17) {
tmp = x * z;
} else if (z <= 2.06e-16) {
tmp = x * (1.0 - y);
} else if (z <= 8.6e+66) {
tmp = y * t;
} else {
tmp = t * -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.45e+17: tmp = x * z elif z <= 2.06e-16: tmp = x * (1.0 - y) elif z <= 8.6e+66: tmp = y * t else: tmp = t * -z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.45e+17) tmp = Float64(x * z); elseif (z <= 2.06e-16) tmp = Float64(x * Float64(1.0 - y)); elseif (z <= 8.6e+66) tmp = Float64(y * t); else tmp = Float64(t * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.45e+17) tmp = x * z; elseif (z <= 2.06e-16) tmp = x * (1.0 - y); elseif (z <= 8.6e+66) tmp = y * t; else tmp = t * -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.45e+17], N[(x * z), $MachinePrecision], If[LessEqual[z, 2.06e-16], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.6e+66], N[(y * t), $MachinePrecision], N[(t * (-z)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+17}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 2.06 \cdot 10^{-16}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{+66}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < -1.45e17Initial program 99.9%
Taylor expanded in t around 0 59.3%
mul-1-neg59.3%
distribute-rgt-neg-in59.3%
sub-neg59.3%
+-commutative59.3%
distribute-neg-in59.3%
remove-double-neg59.3%
sub-neg59.3%
Simplified59.3%
Taylor expanded in z around inf 55.4%
Taylor expanded in z around inf 55.4%
*-commutative55.4%
Simplified55.4%
if -1.45e17 < z < 2.0599999999999999e-16Initial program 100.0%
Taylor expanded in t around 0 60.8%
mul-1-neg60.8%
distribute-rgt-neg-in60.8%
sub-neg60.8%
+-commutative60.8%
distribute-neg-in60.8%
remove-double-neg60.8%
sub-neg60.8%
Simplified60.8%
Taylor expanded in z around 0 60.8%
mul-1-neg60.8%
*-rgt-identity60.8%
distribute-rgt-neg-out60.8%
distribute-lft-in60.8%
unsub-neg60.8%
Simplified60.8%
if 2.0599999999999999e-16 < z < 8.60000000000000054e66Initial program 100.0%
sub-neg100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
distribute-rgt-neg-out100.0%
unsub-neg100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 85.0%
Taylor expanded in x around 0 77.9%
if 8.60000000000000054e66 < z Initial program 100.0%
Taylor expanded in y around 0 86.3%
mul-1-neg86.3%
unsub-neg86.3%
Simplified86.3%
Taylor expanded in t around inf 59.9%
Taylor expanded in x around 0 59.7%
associate-*r*59.7%
neg-mul-159.7%
Simplified59.7%
Final simplification60.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.25e-27) (not (<= z 4.6e+67))) (+ x (* z (- x t))) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.25e-27) || !(z <= 4.6e+67)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - 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 ((z <= (-1.25d-27)) .or. (.not. (z <= 4.6d+67))) then
tmp = x + (z * (x - t))
else
tmp = x + (y * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.25e-27) || !(z <= 4.6e+67)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.25e-27) or not (z <= 4.6e+67): tmp = x + (z * (x - t)) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.25e-27) || !(z <= 4.6e+67)) tmp = Float64(x + Float64(z * Float64(x - t))); else tmp = Float64(x + Float64(y * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.25e-27) || ~((z <= 4.6e+67))) tmp = x + (z * (x - t)); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.25e-27], N[Not[LessEqual[z, 4.6e+67]], $MachinePrecision]], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{-27} \lor \neg \left(z \leq 4.6 \cdot 10^{+67}\right):\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -1.25e-27 or 4.5999999999999997e67 < z Initial program 100.0%
Taylor expanded in y around 0 87.0%
mul-1-neg87.0%
unsub-neg87.0%
Simplified87.0%
if -1.25e-27 < z < 4.5999999999999997e67Initial program 100.0%
Taylor expanded in y around inf 94.5%
*-commutative94.5%
Simplified94.5%
Final simplification90.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.8e-53) (not (<= t 1.45e-74))) (+ x (* t (- y z))) (+ x (* x (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.8e-53) || !(t <= 1.45e-74)) {
tmp = x + (t * (y - z));
} else {
tmp = x + (x * (z - 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 ((t <= (-2.8d-53)) .or. (.not. (t <= 1.45d-74))) then
tmp = x + (t * (y - z))
else
tmp = x + (x * (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.8e-53) || !(t <= 1.45e-74)) {
tmp = x + (t * (y - z));
} else {
tmp = x + (x * (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.8e-53) or not (t <= 1.45e-74): tmp = x + (t * (y - z)) else: tmp = x + (x * (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.8e-53) || !(t <= 1.45e-74)) tmp = Float64(x + Float64(t * Float64(y - z))); else tmp = Float64(x + Float64(x * Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.8e-53) || ~((t <= 1.45e-74))) tmp = x + (t * (y - z)); else tmp = x + (x * (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.8e-53], N[Not[LessEqual[t, 1.45e-74]], $MachinePrecision]], N[(x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{-53} \lor \neg \left(t \leq 1.45 \cdot 10^{-74}\right):\\
\;\;\;\;x + t \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\end{array}
\end{array}
if t < -2.79999999999999985e-53 or 1.45e-74 < t Initial program 100.0%
Taylor expanded in t around inf 85.7%
if -2.79999999999999985e-53 < t < 1.45e-74Initial program 100.0%
Taylor expanded in t around 0 85.0%
mul-1-neg85.0%
distribute-rgt-neg-in85.0%
sub-neg85.0%
+-commutative85.0%
distribute-neg-in85.0%
remove-double-neg85.0%
sub-neg85.0%
Simplified85.0%
Final simplification85.4%
(FPCore (x y z t) :precision binary64 (if (<= z -3e+17) (+ x (* x (- z y))) (if (<= z 1.25e+70) (+ x (* y (- t x))) (- x (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3e+17) {
tmp = x + (x * (z - y));
} else if (z <= 1.25e+70) {
tmp = x + (y * (t - x));
} else {
tmp = x - (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 (z <= (-3d+17)) then
tmp = x + (x * (z - y))
else if (z <= 1.25d+70) then
tmp = x + (y * (t - x))
else
tmp = x - (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3e+17) {
tmp = x + (x * (z - y));
} else if (z <= 1.25e+70) {
tmp = x + (y * (t - x));
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3e+17: tmp = x + (x * (z - y)) elif z <= 1.25e+70: tmp = x + (y * (t - x)) else: tmp = x - (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3e+17) tmp = Float64(x + Float64(x * Float64(z - y))); elseif (z <= 1.25e+70) tmp = Float64(x + Float64(y * Float64(t - x))); else tmp = Float64(x - Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3e+17) tmp = x + (x * (z - y)); elseif (z <= 1.25e+70) tmp = x + (y * (t - x)); else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3e+17], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.25e+70], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+17}:\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+70}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if z < -3e17Initial program 99.9%
Taylor expanded in t around 0 59.3%
mul-1-neg59.3%
distribute-rgt-neg-in59.3%
sub-neg59.3%
+-commutative59.3%
distribute-neg-in59.3%
remove-double-neg59.3%
sub-neg59.3%
Simplified59.3%
if -3e17 < z < 1.2500000000000001e70Initial program 100.0%
Taylor expanded in y around inf 92.1%
*-commutative92.1%
Simplified92.1%
if 1.2500000000000001e70 < z Initial program 100.0%
Taylor expanded in y around 0 86.3%
mul-1-neg86.3%
unsub-neg86.3%
Simplified86.3%
Taylor expanded in t around inf 59.9%
Final simplification77.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.3e-35) (not (<= y 6e-91))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.3e-35) || !(y <= 6e-91)) {
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 <= (-4.3d-35)) .or. (.not. (y <= 6d-91))) 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 <= -4.3e-35) || !(y <= 6e-91)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.3e-35) or not (y <= 6e-91): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.3e-35) || !(y <= 6e-91)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.3e-35) || ~((y <= 6e-91))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.3e-35], N[Not[LessEqual[y, 6e-91]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.3 \cdot 10^{-35} \lor \neg \left(y \leq 6 \cdot 10^{-91}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.3000000000000002e-35 or 6.0000000000000004e-91 < y Initial program 100.0%
sub-neg100.0%
distribute-lft-in98.0%
Applied egg-rr98.0%
distribute-rgt-neg-out98.0%
unsub-neg98.0%
Applied egg-rr98.0%
Taylor expanded in z around 0 68.1%
Taylor expanded in x around 0 42.2%
if -4.3000000000000002e-35 < y < 6.0000000000000004e-91Initial program 100.0%
Taylor expanded in y around inf 42.1%
*-commutative42.1%
Simplified42.1%
Taylor expanded in y around 0 40.2%
Final simplification41.4%
(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 y around inf 58.9%
*-commutative58.9%
Simplified58.9%
Taylor expanded in y around 0 19.1%
(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 2024160
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:alt
(! :herbie-platform default (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
(+ x (* (- y z) (- t x))))