
(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 13 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 (fma (- y z) (- t x) x))
double code(double x, double y, double z, double t) {
return fma((y - z), (t - x), x);
}
function code(x, y, z, t) return fma(Float64(y - z), Float64(t - x), x) end
code[x_, y_, z_, t_] := N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - z, t - x, x\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -2.9e+125)
t_1
(if (<= z -1.35e+18)
(* z x)
(if (<= z -1.3e-33)
t_1
(if (<= z -4.8e-163)
(* y (- x))
(if (<= z -3.5e-300)
(* y t)
(if (<= z 6.1e-170)
x
(if (<= z 6.5e+24)
(* y t)
(if (or (<= z 3.3e+200) (not (<= z 3.2e+245)))
t_1
(* z x)))))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -2.9e+125) {
tmp = t_1;
} else if (z <= -1.35e+18) {
tmp = z * x;
} else if (z <= -1.3e-33) {
tmp = t_1;
} else if (z <= -4.8e-163) {
tmp = y * -x;
} else if (z <= -3.5e-300) {
tmp = y * t;
} else if (z <= 6.1e-170) {
tmp = x;
} else if (z <= 6.5e+24) {
tmp = y * t;
} else if ((z <= 3.3e+200) || !(z <= 3.2e+245)) {
tmp = t_1;
} else {
tmp = z * 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 = z * -t
if (z <= (-2.9d+125)) then
tmp = t_1
else if (z <= (-1.35d+18)) then
tmp = z * x
else if (z <= (-1.3d-33)) then
tmp = t_1
else if (z <= (-4.8d-163)) then
tmp = y * -x
else if (z <= (-3.5d-300)) then
tmp = y * t
else if (z <= 6.1d-170) then
tmp = x
else if (z <= 6.5d+24) then
tmp = y * t
else if ((z <= 3.3d+200) .or. (.not. (z <= 3.2d+245))) then
tmp = t_1
else
tmp = z * x
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 <= -2.9e+125) {
tmp = t_1;
} else if (z <= -1.35e+18) {
tmp = z * x;
} else if (z <= -1.3e-33) {
tmp = t_1;
} else if (z <= -4.8e-163) {
tmp = y * -x;
} else if (z <= -3.5e-300) {
tmp = y * t;
} else if (z <= 6.1e-170) {
tmp = x;
} else if (z <= 6.5e+24) {
tmp = y * t;
} else if ((z <= 3.3e+200) || !(z <= 3.2e+245)) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -2.9e+125: tmp = t_1 elif z <= -1.35e+18: tmp = z * x elif z <= -1.3e-33: tmp = t_1 elif z <= -4.8e-163: tmp = y * -x elif z <= -3.5e-300: tmp = y * t elif z <= 6.1e-170: tmp = x elif z <= 6.5e+24: tmp = y * t elif (z <= 3.3e+200) or not (z <= 3.2e+245): tmp = t_1 else: tmp = z * x return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -2.9e+125) tmp = t_1; elseif (z <= -1.35e+18) tmp = Float64(z * x); elseif (z <= -1.3e-33) tmp = t_1; elseif (z <= -4.8e-163) tmp = Float64(y * Float64(-x)); elseif (z <= -3.5e-300) tmp = Float64(y * t); elseif (z <= 6.1e-170) tmp = x; elseif (z <= 6.5e+24) tmp = Float64(y * t); elseif ((z <= 3.3e+200) || !(z <= 3.2e+245)) tmp = t_1; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (z <= -2.9e+125) tmp = t_1; elseif (z <= -1.35e+18) tmp = z * x; elseif (z <= -1.3e-33) tmp = t_1; elseif (z <= -4.8e-163) tmp = y * -x; elseif (z <= -3.5e-300) tmp = y * t; elseif (z <= 6.1e-170) tmp = x; elseif (z <= 6.5e+24) tmp = y * t; elseif ((z <= 3.3e+200) || ~((z <= 3.2e+245))) tmp = t_1; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -2.9e+125], t$95$1, If[LessEqual[z, -1.35e+18], N[(z * x), $MachinePrecision], If[LessEqual[z, -1.3e-33], t$95$1, If[LessEqual[z, -4.8e-163], N[(y * (-x)), $MachinePrecision], If[LessEqual[z, -3.5e-300], N[(y * t), $MachinePrecision], If[LessEqual[z, 6.1e-170], x, If[LessEqual[z, 6.5e+24], N[(y * t), $MachinePrecision], If[Or[LessEqual[z, 3.3e+200], N[Not[LessEqual[z, 3.2e+245]], $MachinePrecision]], t$95$1, N[(z * x), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -2.9 \cdot 10^{+125}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.35 \cdot 10^{+18}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -1.3 \cdot 10^{-33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.8 \cdot 10^{-163}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{elif}\;z \leq -3.5 \cdot 10^{-300}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 6.1 \cdot 10^{-170}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+24}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{+200} \lor \neg \left(z \leq 3.2 \cdot 10^{+245}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -2.89999999999999993e125 or -1.35e18 < z < -1.29999999999999997e-33 or 6.4999999999999996e24 < z < 3.3e200 or 3.20000000000000024e245 < z Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in90.1%
Applied egg-rr90.1%
Taylor expanded in x around 0 58.9%
associate-+r+58.9%
mul-1-neg58.9%
*-commutative58.9%
sub-neg58.9%
associate-+l-58.9%
*-commutative58.9%
Applied egg-rr58.9%
Taylor expanded in z around inf 55.7%
associate-*r*55.7%
neg-mul-155.7%
Simplified55.7%
if -2.89999999999999993e125 < z < -1.35e18 or 3.3e200 < z < 3.20000000000000024e245Initial program 100.0%
Taylor expanded in t around 0 69.3%
mul-1-neg69.3%
distribute-rgt-neg-in69.3%
neg-sub069.3%
sub-neg69.3%
+-commutative69.3%
associate--r+69.3%
neg-sub069.3%
remove-double-neg69.3%
Simplified69.3%
Taylor expanded in y around 0 66.6%
Taylor expanded in z around inf 66.6%
*-commutative66.6%
Simplified66.6%
if -1.29999999999999997e-33 < z < -4.8000000000000001e-163Initial program 99.9%
Taylor expanded in t around 0 76.9%
mul-1-neg76.9%
distribute-rgt-neg-in76.9%
neg-sub076.9%
sub-neg76.9%
+-commutative76.9%
associate--r+76.9%
neg-sub076.9%
remove-double-neg76.9%
Simplified76.9%
Taylor expanded in y around inf 47.3%
associate-*r*47.3%
neg-mul-147.3%
*-commutative47.3%
Simplified47.3%
if -4.8000000000000001e-163 < z < -3.5000000000000002e-300 or 6.09999999999999999e-170 < z < 6.4999999999999996e24Initial program 100.0%
Taylor expanded in t around inf 80.4%
Taylor expanded in y around inf 46.1%
*-commutative46.1%
Simplified46.1%
if -3.5000000000000002e-300 < z < 6.09999999999999999e-170Initial program 100.0%
Taylor expanded in t around inf 93.4%
Taylor expanded in x around inf 64.1%
Final simplification54.1%
(FPCore (x y z t)
:precision binary64
(if (<= z -2950.0)
(* z x)
(if (<= z -1.1e-162)
(* y (- x))
(if (<= z -4.5e-299)
(* y t)
(if (<= z 1.45e-169) x (if (<= z 1.4e+21) (* y t) (* z x)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2950.0) {
tmp = z * x;
} else if (z <= -1.1e-162) {
tmp = y * -x;
} else if (z <= -4.5e-299) {
tmp = y * t;
} else if (z <= 1.45e-169) {
tmp = x;
} else if (z <= 1.4e+21) {
tmp = y * t;
} else {
tmp = z * 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 <= (-2950.0d0)) then
tmp = z * x
else if (z <= (-1.1d-162)) then
tmp = y * -x
else if (z <= (-4.5d-299)) then
tmp = y * t
else if (z <= 1.45d-169) then
tmp = x
else if (z <= 1.4d+21) then
tmp = y * t
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2950.0) {
tmp = z * x;
} else if (z <= -1.1e-162) {
tmp = y * -x;
} else if (z <= -4.5e-299) {
tmp = y * t;
} else if (z <= 1.45e-169) {
tmp = x;
} else if (z <= 1.4e+21) {
tmp = y * t;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2950.0: tmp = z * x elif z <= -1.1e-162: tmp = y * -x elif z <= -4.5e-299: tmp = y * t elif z <= 1.45e-169: tmp = x elif z <= 1.4e+21: tmp = y * t else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2950.0) tmp = Float64(z * x); elseif (z <= -1.1e-162) tmp = Float64(y * Float64(-x)); elseif (z <= -4.5e-299) tmp = Float64(y * t); elseif (z <= 1.45e-169) tmp = x; elseif (z <= 1.4e+21) tmp = Float64(y * t); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2950.0) tmp = z * x; elseif (z <= -1.1e-162) tmp = y * -x; elseif (z <= -4.5e-299) tmp = y * t; elseif (z <= 1.45e-169) tmp = x; elseif (z <= 1.4e+21) tmp = y * t; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2950.0], N[(z * x), $MachinePrecision], If[LessEqual[z, -1.1e-162], N[(y * (-x)), $MachinePrecision], If[LessEqual[z, -4.5e-299], N[(y * t), $MachinePrecision], If[LessEqual[z, 1.45e-169], x, If[LessEqual[z, 1.4e+21], N[(y * t), $MachinePrecision], N[(z * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2950:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{-162}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{-299}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-169}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+21}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -2950 or 1.4e21 < z Initial program 100.0%
Taylor expanded in t around 0 50.7%
mul-1-neg50.7%
distribute-rgt-neg-in50.7%
neg-sub050.7%
sub-neg50.7%
+-commutative50.7%
associate--r+50.7%
neg-sub050.7%
remove-double-neg50.7%
Simplified50.7%
Taylor expanded in y around 0 42.5%
Taylor expanded in z around inf 42.5%
*-commutative42.5%
Simplified42.5%
if -2950 < z < -1.1e-162Initial program 100.0%
Taylor expanded in t around 0 73.2%
mul-1-neg73.2%
distribute-rgt-neg-in73.2%
neg-sub073.2%
sub-neg73.2%
+-commutative73.2%
associate--r+73.2%
neg-sub073.2%
remove-double-neg73.2%
Simplified73.2%
Taylor expanded in y around inf 42.2%
associate-*r*42.2%
neg-mul-142.2%
*-commutative42.2%
Simplified42.2%
if -1.1e-162 < z < -4.50000000000000003e-299 or 1.4500000000000001e-169 < z < 1.4e21Initial program 100.0%
Taylor expanded in t around inf 81.4%
Taylor expanded in y around inf 46.6%
*-commutative46.6%
Simplified46.6%
if -4.50000000000000003e-299 < z < 1.4500000000000001e-169Initial program 100.0%
Taylor expanded in t around inf 93.4%
Taylor expanded in x around inf 64.1%
Final simplification45.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y z) t)))
(if (<= t -1.05e-33)
t_1
(if (<= t 1.9e-213) (* z x) (if (<= t 1.5e-10) x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double tmp;
if (t <= -1.05e-33) {
tmp = t_1;
} else if (t <= 1.9e-213) {
tmp = z * x;
} else if (t <= 1.5e-10) {
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 = (y - z) * t
if (t <= (-1.05d-33)) then
tmp = t_1
else if (t <= 1.9d-213) then
tmp = z * x
else if (t <= 1.5d-10) 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 = (y - z) * t;
double tmp;
if (t <= -1.05e-33) {
tmp = t_1;
} else if (t <= 1.9e-213) {
tmp = z * x;
} else if (t <= 1.5e-10) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * t tmp = 0 if t <= -1.05e-33: tmp = t_1 elif t <= 1.9e-213: tmp = z * x elif t <= 1.5e-10: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * t) tmp = 0.0 if (t <= -1.05e-33) tmp = t_1; elseif (t <= 1.9e-213) tmp = Float64(z * x); elseif (t <= 1.5e-10) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * t; tmp = 0.0; if (t <= -1.05e-33) tmp = t_1; elseif (t <= 1.9e-213) tmp = z * x; elseif (t <= 1.5e-10) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -1.05e-33], t$95$1, If[LessEqual[t, 1.9e-213], N[(z * x), $MachinePrecision], If[LessEqual[t, 1.5e-10], x, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -1.05 \cdot 10^{-33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.9 \cdot 10^{-213}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;t \leq 1.5 \cdot 10^{-10}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.05e-33 or 1.5e-10 < t Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in93.5%
Applied egg-rr93.5%
Taylor expanded in x around 0 79.4%
associate-+r+79.4%
mul-1-neg79.4%
*-commutative79.4%
sub-neg79.4%
associate-+l-79.4%
*-commutative79.4%
Applied egg-rr79.4%
Taylor expanded in x around 0 71.3%
distribute-lft-out--76.5%
Simplified76.5%
if -1.05e-33 < t < 1.9e-213Initial program 100.0%
Taylor expanded in t around 0 93.4%
mul-1-neg93.4%
distribute-rgt-neg-in93.4%
neg-sub093.4%
sub-neg93.4%
+-commutative93.4%
associate--r+93.4%
neg-sub093.4%
remove-double-neg93.4%
Simplified93.4%
Taylor expanded in y around 0 71.4%
Taylor expanded in z around inf 41.8%
*-commutative41.8%
Simplified41.8%
if 1.9e-213 < t < 1.5e-10Initial program 99.9%
Taylor expanded in t around inf 63.1%
Taylor expanded in x around inf 44.6%
Final simplification63.1%
(FPCore (x y z t) :precision binary64 (if (<= y -3.5e-20) (* y t) (if (<= y -5.6e-114) (* z x) (if (<= y 2.9e-8) x (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.5e-20) {
tmp = y * t;
} else if (y <= -5.6e-114) {
tmp = z * x;
} else if (y <= 2.9e-8) {
tmp = x;
} else {
tmp = 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 (y <= (-3.5d-20)) then
tmp = y * t
else if (y <= (-5.6d-114)) then
tmp = z * x
else if (y <= 2.9d-8) then
tmp = x
else
tmp = y * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.5e-20) {
tmp = y * t;
} else if (y <= -5.6e-114) {
tmp = z * x;
} else if (y <= 2.9e-8) {
tmp = x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.5e-20: tmp = y * t elif y <= -5.6e-114: tmp = z * x elif y <= 2.9e-8: tmp = x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.5e-20) tmp = Float64(y * t); elseif (y <= -5.6e-114) tmp = Float64(z * x); elseif (y <= 2.9e-8) tmp = x; else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.5e-20) tmp = y * t; elseif (y <= -5.6e-114) tmp = z * x; elseif (y <= 2.9e-8) tmp = x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.5e-20], N[(y * t), $MachinePrecision], If[LessEqual[y, -5.6e-114], N[(z * x), $MachinePrecision], If[LessEqual[y, 2.9e-8], x, N[(y * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-20}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq -5.6 \cdot 10^{-114}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{-8}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -3.50000000000000003e-20 or 2.9000000000000002e-8 < y Initial program 100.0%
Taylor expanded in t around inf 58.5%
Taylor expanded in y around inf 45.4%
*-commutative45.4%
Simplified45.4%
if -3.50000000000000003e-20 < y < -5.6000000000000003e-114Initial program 99.9%
Taylor expanded in t around 0 68.1%
mul-1-neg68.1%
distribute-rgt-neg-in68.1%
neg-sub068.1%
sub-neg68.1%
+-commutative68.1%
associate--r+68.1%
neg-sub068.1%
remove-double-neg68.1%
Simplified68.1%
Taylor expanded in y around 0 68.1%
Taylor expanded in z around inf 49.1%
*-commutative49.1%
Simplified49.1%
if -5.6000000000000003e-114 < y < 2.9000000000000002e-8Initial program 100.0%
Taylor expanded in t around inf 83.8%
Taylor expanded in x around inf 37.6%
Final simplification42.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.05e-33) (not (<= t 8e-94))) (+ x (* t (- y z))) (+ x (* z x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.05e-33) || !(t <= 8e-94)) {
tmp = x + (t * (y - z));
} else {
tmp = x + (z * x);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.05d-33)) .or. (.not. (t <= 8d-94))) then
tmp = x + (t * (y - z))
else
tmp = x + (z * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.05e-33) || !(t <= 8e-94)) {
tmp = x + (t * (y - z));
} else {
tmp = x + (z * x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.05e-33) or not (t <= 8e-94): tmp = x + (t * (y - z)) else: tmp = x + (z * x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.05e-33) || !(t <= 8e-94)) tmp = Float64(x + Float64(t * Float64(y - z))); else tmp = Float64(x + Float64(z * x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.05e-33) || ~((t <= 8e-94))) tmp = x + (t * (y - z)); else tmp = x + (z * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.05e-33], N[Not[LessEqual[t, 8e-94]], $MachinePrecision]], N[(x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.05 \cdot 10^{-33} \lor \neg \left(t \leq 8 \cdot 10^{-94}\right):\\
\;\;\;\;x + t \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot x\\
\end{array}
\end{array}
if t < -1.05e-33 or 7.9999999999999996e-94 < t Initial program 100.0%
Taylor expanded in t around inf 84.0%
if -1.05e-33 < t < 7.9999999999999996e-94Initial program 100.0%
Taylor expanded in t around 0 91.5%
mul-1-neg91.5%
distribute-rgt-neg-in91.5%
neg-sub091.5%
sub-neg91.5%
+-commutative91.5%
associate--r+91.5%
neg-sub091.5%
remove-double-neg91.5%
Simplified91.5%
Taylor expanded in y around 0 68.2%
Final simplification78.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.2e+39) (not (<= x 4.4e+105))) (+ x (* x (- z y))) (+ x (* t (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.2e+39) || !(x <= 4.4e+105)) {
tmp = x + (x * (z - y));
} else {
tmp = x + (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 ((x <= (-5.2d+39)) .or. (.not. (x <= 4.4d+105))) then
tmp = x + (x * (z - y))
else
tmp = x + (t * (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.2e+39) || !(x <= 4.4e+105)) {
tmp = x + (x * (z - y));
} else {
tmp = x + (t * (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5.2e+39) or not (x <= 4.4e+105): tmp = x + (x * (z - y)) else: tmp = x + (t * (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5.2e+39) || !(x <= 4.4e+105)) tmp = Float64(x + Float64(x * Float64(z - y))); else tmp = Float64(x + Float64(t * Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -5.2e+39) || ~((x <= 4.4e+105))) tmp = x + (x * (z - y)); else tmp = x + (t * (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.2e+39], N[Not[LessEqual[x, 4.4e+105]], $MachinePrecision]], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{+39} \lor \neg \left(x \leq 4.4 \cdot 10^{+105}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \left(y - z\right)\\
\end{array}
\end{array}
if x < -5.2e39 or 4.40000000000000014e105 < x Initial program 100.0%
Taylor expanded in t around 0 93.3%
mul-1-neg93.3%
distribute-rgt-neg-in93.3%
neg-sub093.3%
sub-neg93.3%
+-commutative93.3%
associate--r+93.3%
neg-sub093.3%
remove-double-neg93.3%
Simplified93.3%
if -5.2e39 < x < 4.40000000000000014e105Initial program 100.0%
Taylor expanded in t around inf 83.5%
Final simplification87.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.6e-34) (not (<= z 6.5e+19))) (+ x (* z (- x t))) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.6e-34) || !(z <= 6.5e+19)) {
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 <= (-6.6d-34)) .or. (.not. (z <= 6.5d+19))) 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 <= -6.6e-34) || !(z <= 6.5e+19)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.6e-34) or not (z <= 6.5e+19): tmp = x + (z * (x - t)) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.6e-34) || !(z <= 6.5e+19)) 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 <= -6.6e-34) || ~((z <= 6.5e+19))) 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, -6.6e-34], N[Not[LessEqual[z, 6.5e+19]], $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 -6.6 \cdot 10^{-34} \lor \neg \left(z \leq 6.5 \cdot 10^{+19}\right):\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -6.59999999999999965e-34 or 6.5e19 < z Initial program 100.0%
Taylor expanded in y around 0 82.5%
mul-1-neg82.5%
unsub-neg82.5%
Simplified82.5%
if -6.59999999999999965e-34 < z < 6.5e19Initial program 100.0%
Taylor expanded in y around inf 91.9%
*-commutative91.9%
Simplified91.9%
Final simplification87.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3e-6) (not (<= t 3.4e+24))) (* t (- y z)) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3e-6) || !(t <= 3.4e+24)) {
tmp = t * (y - z);
} else {
tmp = x * (1.0 - 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 <= (-3d-6)) .or. (.not. (t <= 3.4d+24))) then
tmp = t * (y - z)
else
tmp = x * (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3e-6) || !(t <= 3.4e+24)) {
tmp = t * (y - z);
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3e-6) or not (t <= 3.4e+24): tmp = t * (y - z) else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3e-6) || !(t <= 3.4e+24)) tmp = Float64(t * Float64(y - z)); else tmp = Float64(x * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3e-6) || ~((t <= 3.4e+24))) tmp = t * (y - z); else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3e-6], N[Not[LessEqual[t, 3.4e+24]], $MachinePrecision]], N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{-6} \lor \neg \left(t \leq 3.4 \cdot 10^{+24}\right):\\
\;\;\;\;t \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if t < -3.0000000000000001e-6 or 3.4000000000000001e24 < t Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in92.8%
Applied egg-rr92.8%
Taylor expanded in x around 0 80.5%
associate-+r+80.5%
mul-1-neg80.5%
*-commutative80.5%
sub-neg80.5%
associate-+l-80.5%
*-commutative80.5%
Applied egg-rr80.5%
Taylor expanded in x around 0 74.3%
distribute-lft-out--80.1%
Simplified80.1%
if -3.0000000000000001e-6 < t < 3.4000000000000001e24Initial program 100.0%
Taylor expanded in t around 0 85.4%
mul-1-neg85.4%
distribute-rgt-neg-in85.4%
neg-sub085.4%
sub-neg85.4%
+-commutative85.4%
associate--r+85.4%
neg-sub085.4%
remove-double-neg85.4%
Simplified85.4%
Taylor expanded in z around 0 56.2%
*-rgt-identity56.2%
mul-1-neg56.2%
distribute-rgt-neg-out56.2%
distribute-lft-in56.2%
unsub-neg56.2%
Simplified56.2%
Final simplification69.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.4e-8) (not (<= t 9e-10))) (* t (- y z)) (+ x (* z x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.4e-8) || !(t <= 9e-10)) {
tmp = t * (y - z);
} else {
tmp = x + (z * x);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.4d-8)) .or. (.not. (t <= 9d-10))) then
tmp = t * (y - z)
else
tmp = x + (z * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.4e-8) || !(t <= 9e-10)) {
tmp = t * (y - z);
} else {
tmp = x + (z * x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.4e-8) or not (t <= 9e-10): tmp = t * (y - z) else: tmp = x + (z * x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.4e-8) || !(t <= 9e-10)) tmp = Float64(t * Float64(y - z)); else tmp = Float64(x + Float64(z * x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.4e-8) || ~((t <= 9e-10))) tmp = t * (y - z); else tmp = x + (z * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.4e-8], N[Not[LessEqual[t, 9e-10]], $MachinePrecision]], N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{-8} \lor \neg \left(t \leq 9 \cdot 10^{-10}\right):\\
\;\;\;\;t \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot x\\
\end{array}
\end{array}
if t < -1.4e-8 or 8.9999999999999999e-10 < t Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in93.2%
Applied egg-rr93.2%
Taylor expanded in x around 0 79.1%
associate-+r+79.1%
mul-1-neg79.1%
*-commutative79.1%
sub-neg79.1%
associate-+l-79.1%
*-commutative79.1%
Applied egg-rr79.1%
Taylor expanded in x around 0 72.6%
distribute-lft-out--78.0%
Simplified78.0%
if -1.4e-8 < t < 8.9999999999999999e-10Initial program 100.0%
Taylor expanded in t around 0 87.8%
mul-1-neg87.8%
distribute-rgt-neg-in87.8%
neg-sub087.8%
sub-neg87.8%
+-commutative87.8%
associate--r+87.8%
neg-sub087.8%
remove-double-neg87.8%
Simplified87.8%
Taylor expanded in y around 0 67.8%
Final simplification73.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.85e-11) (not (<= y 1.8e-13))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.85e-11) || !(y <= 1.8e-13)) {
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.85d-11)) .or. (.not. (y <= 1.8d-13))) 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.85e-11) || !(y <= 1.8e-13)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.85e-11) or not (y <= 1.8e-13): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.85e-11) || !(y <= 1.8e-13)) 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.85e-11) || ~((y <= 1.8e-13))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.85e-11], N[Not[LessEqual[y, 1.8e-13]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.85 \cdot 10^{-11} \lor \neg \left(y \leq 1.8 \cdot 10^{-13}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.8500000000000001e-11 or 1.7999999999999999e-13 < y Initial program 100.0%
Taylor expanded in t around inf 57.9%
Taylor expanded in y around inf 46.1%
*-commutative46.1%
Simplified46.1%
if -1.8500000000000001e-11 < y < 1.7999999999999999e-13Initial program 100.0%
Taylor expanded in t around inf 78.2%
Taylor expanded in x around inf 35.1%
Final simplification40.3%
(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 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 68.5%
Taylor expanded in x around inf 19.8%
Final simplification19.8%
(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 2024041
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:herbie-target
(+ x (+ (* t (- y z)) (* (- x) (- y z))))
(+ x (* (- y z) (- t x))))