
(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-define100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -1e+262)
t_1
(if (<= z -8e+45)
(* z x)
(if (<= z -1.35e-125)
t_1
(if (<= z 1.1e-157) x (if (<= z 1.96e+87) (* y (- x)) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -1e+262) {
tmp = t_1;
} else if (z <= -8e+45) {
tmp = z * x;
} else if (z <= -1.35e-125) {
tmp = t_1;
} else if (z <= 1.1e-157) {
tmp = x;
} else if (z <= 1.96e+87) {
tmp = y * -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 <= (-1d+262)) then
tmp = t_1
else if (z <= (-8d+45)) then
tmp = z * x
else if (z <= (-1.35d-125)) then
tmp = t_1
else if (z <= 1.1d-157) then
tmp = x
else if (z <= 1.96d+87) then
tmp = y * -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 <= -1e+262) {
tmp = t_1;
} else if (z <= -8e+45) {
tmp = z * x;
} else if (z <= -1.35e-125) {
tmp = t_1;
} else if (z <= 1.1e-157) {
tmp = x;
} else if (z <= 1.96e+87) {
tmp = y * -x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -1e+262: tmp = t_1 elif z <= -8e+45: tmp = z * x elif z <= -1.35e-125: tmp = t_1 elif z <= 1.1e-157: tmp = x elif z <= 1.96e+87: tmp = y * -x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -1e+262) tmp = t_1; elseif (z <= -8e+45) tmp = Float64(z * x); elseif (z <= -1.35e-125) tmp = t_1; elseif (z <= 1.1e-157) tmp = x; elseif (z <= 1.96e+87) tmp = Float64(y * Float64(-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 <= -1e+262) tmp = t_1; elseif (z <= -8e+45) tmp = z * x; elseif (z <= -1.35e-125) tmp = t_1; elseif (z <= 1.1e-157) tmp = x; elseif (z <= 1.96e+87) tmp = y * -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, -1e+262], t$95$1, If[LessEqual[z, -8e+45], N[(z * x), $MachinePrecision], If[LessEqual[z, -1.35e-125], t$95$1, If[LessEqual[z, 1.1e-157], x, If[LessEqual[z, 1.96e+87], N[(y * (-x)), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -1 \cdot 10^{+262}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -8 \cdot 10^{+45}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -1.35 \cdot 10^{-125}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-157}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.96 \cdot 10^{+87}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1e262 or -7.9999999999999994e45 < z < -1.3499999999999999e-125 or 1.96e87 < z Initial program 99.9%
Taylor expanded in y around 0 76.9%
mul-1-neg76.9%
unsub-neg76.9%
Simplified76.9%
Taylor expanded in x around 0 47.6%
associate-*r*47.6%
mul-1-neg47.6%
Simplified47.6%
if -1e262 < z < -7.9999999999999994e45Initial program 100.0%
Taylor expanded in x around inf 66.1%
mul-1-neg66.1%
unsub-neg66.1%
Simplified66.1%
Taylor expanded in z around inf 54.6%
if -1.3499999999999999e-125 < z < 1.10000000000000005e-157Initial program 100.0%
Taylor expanded in y around inf 96.6%
*-commutative96.6%
Simplified96.6%
Taylor expanded in y around 0 42.6%
if 1.10000000000000005e-157 < z < 1.96e87Initial program 100.0%
Taylor expanded in x around inf 76.3%
mul-1-neg76.3%
unsub-neg76.3%
Simplified76.3%
Taylor expanded in y around inf 43.3%
mul-1-neg43.3%
Simplified43.3%
Final simplification46.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y z) t)) (t_2 (* x (+ z 1.0))))
(if (<= t -1.06e-112)
t_1
(if (<= t 1.55e-213)
t_2
(if (<= t 0.00035) (* x (- 1.0 y)) (if (<= t 3.4e+52) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double t_2 = x * (z + 1.0);
double tmp;
if (t <= -1.06e-112) {
tmp = t_1;
} else if (t <= 1.55e-213) {
tmp = t_2;
} else if (t <= 0.00035) {
tmp = x * (1.0 - y);
} else if (t <= 3.4e+52) {
tmp = t_2;
} 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 = (y - z) * t
t_2 = x * (z + 1.0d0)
if (t <= (-1.06d-112)) then
tmp = t_1
else if (t <= 1.55d-213) then
tmp = t_2
else if (t <= 0.00035d0) then
tmp = x * (1.0d0 - y)
else if (t <= 3.4d+52) then
tmp = t_2
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 t_2 = x * (z + 1.0);
double tmp;
if (t <= -1.06e-112) {
tmp = t_1;
} else if (t <= 1.55e-213) {
tmp = t_2;
} else if (t <= 0.00035) {
tmp = x * (1.0 - y);
} else if (t <= 3.4e+52) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * t t_2 = x * (z + 1.0) tmp = 0 if t <= -1.06e-112: tmp = t_1 elif t <= 1.55e-213: tmp = t_2 elif t <= 0.00035: tmp = x * (1.0 - y) elif t <= 3.4e+52: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * t) t_2 = Float64(x * Float64(z + 1.0)) tmp = 0.0 if (t <= -1.06e-112) tmp = t_1; elseif (t <= 1.55e-213) tmp = t_2; elseif (t <= 0.00035) tmp = Float64(x * Float64(1.0 - y)); elseif (t <= 3.4e+52) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * t; t_2 = x * (z + 1.0); tmp = 0.0; if (t <= -1.06e-112) tmp = t_1; elseif (t <= 1.55e-213) tmp = t_2; elseif (t <= 0.00035) tmp = x * (1.0 - y); elseif (t <= 3.4e+52) tmp = t_2; 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]}, Block[{t$95$2 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.06e-112], t$95$1, If[LessEqual[t, 1.55e-213], t$95$2, If[LessEqual[t, 0.00035], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.4e+52], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
t_2 := x \cdot \left(z + 1\right)\\
\mathbf{if}\;t \leq -1.06 \cdot 10^{-112}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.55 \cdot 10^{-213}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 0.00035:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{+52}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.0600000000000001e-112 or 3.4e52 < t Initial program 100.0%
sub-neg100.0%
distribute-lft-in91.2%
Applied egg-rr91.2%
Taylor expanded in y around inf 88.4%
associate-*r*88.4%
mul-1-neg88.4%
Simplified88.4%
associate-+r+88.4%
distribute-lft-neg-out88.4%
unsub-neg88.4%
+-commutative88.4%
*-commutative88.4%
Applied egg-rr88.4%
Taylor expanded in t around inf 73.9%
if -1.0600000000000001e-112 < t < 1.5499999999999999e-213 or 3.49999999999999996e-4 < t < 3.4e52Initial program 100.0%
Taylor expanded in x around inf 88.9%
mul-1-neg88.9%
unsub-neg88.9%
Simplified88.9%
Taylor expanded in y around 0 70.8%
+-commutative70.8%
Simplified70.8%
if 1.5499999999999999e-213 < t < 3.49999999999999996e-4Initial program 100.0%
Taylor expanded in x around inf 81.1%
mul-1-neg81.1%
unsub-neg81.1%
Simplified81.1%
Taylor expanded in z around 0 66.6%
Final simplification71.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -4.7e-8)
t_1
(if (<= y 1.62e-257)
(- x (* z t))
(if (<= y 5.8e+63) (* x (+ z 1.0)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -4.7e-8) {
tmp = t_1;
} else if (y <= 1.62e-257) {
tmp = x - (z * t);
} else if (y <= 5.8e+63) {
tmp = x * (z + 1.0);
} 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 <= (-4.7d-8)) then
tmp = t_1
else if (y <= 1.62d-257) then
tmp = x - (z * t)
else if (y <= 5.8d+63) then
tmp = x * (z + 1.0d0)
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 <= -4.7e-8) {
tmp = t_1;
} else if (y <= 1.62e-257) {
tmp = x - (z * t);
} else if (y <= 5.8e+63) {
tmp = x * (z + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -4.7e-8: tmp = t_1 elif y <= 1.62e-257: tmp = x - (z * t) elif y <= 5.8e+63: tmp = x * (z + 1.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -4.7e-8) tmp = t_1; elseif (y <= 1.62e-257) tmp = Float64(x - Float64(z * t)); elseif (y <= 5.8e+63) tmp = Float64(x * Float64(z + 1.0)); 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 <= -4.7e-8) tmp = t_1; elseif (y <= 1.62e-257) tmp = x - (z * t); elseif (y <= 5.8e+63) tmp = x * (z + 1.0); 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, -4.7e-8], t$95$1, If[LessEqual[y, 1.62e-257], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.8e+63], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -4.7 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.62 \cdot 10^{-257}:\\
\;\;\;\;x - z \cdot t\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+63}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.6999999999999997e-8 or 5.7999999999999999e63 < y Initial program 99.9%
sub-neg99.9%
distribute-lft-in94.9%
Applied egg-rr94.9%
Taylor expanded in y around inf 86.5%
associate-*r*86.5%
mul-1-neg86.5%
Simplified86.5%
associate-+r+86.5%
distribute-lft-neg-out86.5%
unsub-neg86.5%
+-commutative86.5%
*-commutative86.5%
Applied egg-rr86.5%
Taylor expanded in y around inf 77.6%
if -4.6999999999999997e-8 < y < 1.6200000000000001e-257Initial program 100.0%
Taylor expanded in y around 0 96.6%
mul-1-neg96.6%
unsub-neg96.6%
Simplified96.6%
Taylor expanded in t around inf 80.2%
if 1.6200000000000001e-257 < y < 5.7999999999999999e63Initial program 100.0%
Taylor expanded in x around inf 69.4%
mul-1-neg69.4%
unsub-neg69.4%
Simplified69.4%
Taylor expanded in y around 0 63.4%
+-commutative63.4%
Simplified63.4%
Final simplification74.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (- y z) -5e-8) (not (<= (- y z) 2e-15))) (* (- y z) t) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((y - z) <= -5e-8) || !((y - z) <= 2e-15)) {
tmp = (y - z) * t;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((y - z) <= (-5d-8)) .or. (.not. ((y - z) <= 2d-15))) then
tmp = (y - z) * t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((y - z) <= -5e-8) || !((y - z) <= 2e-15)) {
tmp = (y - z) * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((y - z) <= -5e-8) or not ((y - z) <= 2e-15): tmp = (y - z) * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(y - z) <= -5e-8) || !(Float64(y - z) <= 2e-15)) tmp = Float64(Float64(y - z) * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((y - z) <= -5e-8) || ~(((y - z) <= 2e-15))) tmp = (y - z) * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(y - z), $MachinePrecision], -5e-8], N[Not[LessEqual[N[(y - z), $MachinePrecision], 2e-15]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y - z \leq -5 \cdot 10^{-8} \lor \neg \left(y - z \leq 2 \cdot 10^{-15}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (-.f64 y z) < -4.9999999999999998e-8 or 2.0000000000000002e-15 < (-.f64 y z) Initial program 100.0%
sub-neg100.0%
distribute-lft-in93.9%
Applied egg-rr93.9%
Taylor expanded in y around inf 73.5%
associate-*r*73.5%
mul-1-neg73.5%
Simplified73.5%
associate-+r+73.5%
distribute-lft-neg-out73.5%
unsub-neg73.5%
+-commutative73.5%
*-commutative73.5%
Applied egg-rr73.5%
Taylor expanded in t around inf 52.0%
if -4.9999999999999998e-8 < (-.f64 y z) < 2.0000000000000002e-15Initial program 100.0%
Taylor expanded in y around inf 84.2%
*-commutative84.2%
Simplified84.2%
Taylor expanded in y around 0 71.9%
Final simplification56.5%
(FPCore (x y z t) :precision binary64 (if (<= z -63000.0) (* z x) (if (<= z -5.2e-99) (* y (- x)) (if (<= z 1.6e-15) x (* z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -63000.0) {
tmp = z * x;
} else if (z <= -5.2e-99) {
tmp = y * -x;
} else if (z <= 1.6e-15) {
tmp = x;
} 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 <= (-63000.0d0)) then
tmp = z * x
else if (z <= (-5.2d-99)) then
tmp = y * -x
else if (z <= 1.6d-15) then
tmp = x
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 <= -63000.0) {
tmp = z * x;
} else if (z <= -5.2e-99) {
tmp = y * -x;
} else if (z <= 1.6e-15) {
tmp = x;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -63000.0: tmp = z * x elif z <= -5.2e-99: tmp = y * -x elif z <= 1.6e-15: tmp = x else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -63000.0) tmp = Float64(z * x); elseif (z <= -5.2e-99) tmp = Float64(y * Float64(-x)); elseif (z <= 1.6e-15) tmp = x; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -63000.0) tmp = z * x; elseif (z <= -5.2e-99) tmp = y * -x; elseif (z <= 1.6e-15) tmp = x; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -63000.0], N[(z * x), $MachinePrecision], If[LessEqual[z, -5.2e-99], N[(y * (-x)), $MachinePrecision], If[LessEqual[z, 1.6e-15], x, N[(z * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -63000:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -5.2 \cdot 10^{-99}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-15}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -63000 or 1.6e-15 < z Initial program 99.9%
Taylor expanded in x around inf 54.3%
mul-1-neg54.3%
unsub-neg54.3%
Simplified54.3%
Taylor expanded in z around inf 44.3%
if -63000 < z < -5.2000000000000001e-99Initial program 100.0%
Taylor expanded in x around inf 60.4%
mul-1-neg60.4%
unsub-neg60.4%
Simplified60.4%
Taylor expanded in y around inf 43.2%
mul-1-neg43.2%
Simplified43.2%
if -5.2000000000000001e-99 < z < 1.6e-15Initial program 100.0%
Taylor expanded in y around inf 93.8%
*-commutative93.8%
Simplified93.8%
Taylor expanded in y around 0 40.5%
Final simplification42.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.5e-50) (not (<= t 1.05e+62))) (* (- y z) t) (* x (+ (- z y) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.5e-50) || !(t <= 1.05e+62)) {
tmp = (y - z) * t;
} else {
tmp = x * ((z - y) + 1.0);
}
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.5d-50)) .or. (.not. (t <= 1.05d+62))) then
tmp = (y - z) * t
else
tmp = x * ((z - y) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.5e-50) || !(t <= 1.05e+62)) {
tmp = (y - z) * t;
} else {
tmp = x * ((z - y) + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.5e-50) or not (t <= 1.05e+62): tmp = (y - z) * t else: tmp = x * ((z - y) + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.5e-50) || !(t <= 1.05e+62)) tmp = Float64(Float64(y - z) * t); else tmp = Float64(x * Float64(Float64(z - y) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.5e-50) || ~((t <= 1.05e+62))) tmp = (y - z) * t; else tmp = x * ((z - y) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.5e-50], N[Not[LessEqual[t, 1.05e+62]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{-50} \lor \neg \left(t \leq 1.05 \cdot 10^{+62}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\end{array}
\end{array}
if t < -2.49999999999999984e-50 or 1.05e62 < t Initial program 100.0%
sub-neg100.0%
distribute-lft-in89.8%
Applied egg-rr89.8%
Taylor expanded in y around inf 89.8%
associate-*r*89.8%
mul-1-neg89.8%
Simplified89.8%
associate-+r+89.8%
distribute-lft-neg-out89.8%
unsub-neg89.8%
+-commutative89.8%
*-commutative89.8%
Applied egg-rr89.8%
Taylor expanded in t around inf 78.9%
if -2.49999999999999984e-50 < t < 1.05e62Initial program 100.0%
Taylor expanded in x around inf 83.1%
mul-1-neg83.1%
unsub-neg83.1%
Simplified83.1%
Final simplification81.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4e-51) (not (<= t 1.7e+54))) (- x (* t (- z y))) (* x (+ (- z y) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4e-51) || !(t <= 1.7e+54)) {
tmp = x - (t * (z - y));
} else {
tmp = x * ((z - y) + 1.0);
}
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 <= (-4d-51)) .or. (.not. (t <= 1.7d+54))) then
tmp = x - (t * (z - y))
else
tmp = x * ((z - y) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4e-51) || !(t <= 1.7e+54)) {
tmp = x - (t * (z - y));
} else {
tmp = x * ((z - y) + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4e-51) or not (t <= 1.7e+54): tmp = x - (t * (z - y)) else: tmp = x * ((z - y) + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4e-51) || !(t <= 1.7e+54)) tmp = Float64(x - Float64(t * Float64(z - y))); else tmp = Float64(x * Float64(Float64(z - y) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4e-51) || ~((t <= 1.7e+54))) tmp = x - (t * (z - y)); else tmp = x * ((z - y) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4e-51], N[Not[LessEqual[t, 1.7e+54]], $MachinePrecision]], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{-51} \lor \neg \left(t \leq 1.7 \cdot 10^{+54}\right):\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\end{array}
\end{array}
if t < -4e-51 or 1.7e54 < t Initial program 100.0%
Taylor expanded in t around inf 84.6%
if -4e-51 < t < 1.7e54Initial program 100.0%
Taylor expanded in x around inf 83.6%
mul-1-neg83.6%
unsub-neg83.6%
Simplified83.6%
Final simplification84.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.175) (not (<= z 3.9e+20))) (- x (* z (- t x))) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.175) || !(z <= 3.9e+20)) {
tmp = x - (z * (t - x));
} 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 <= (-0.175d0)) .or. (.not. (z <= 3.9d+20))) then
tmp = x - (z * (t - x))
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 <= -0.175) || !(z <= 3.9e+20)) {
tmp = x - (z * (t - x));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.175) or not (z <= 3.9e+20): tmp = x - (z * (t - x)) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.175) || !(z <= 3.9e+20)) tmp = Float64(x - Float64(z * Float64(t - x))); 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 <= -0.175) || ~((z <= 3.9e+20))) tmp = x - (z * (t - x)); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.175], N[Not[LessEqual[z, 3.9e+20]], $MachinePrecision]], N[(x - N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.175 \lor \neg \left(z \leq 3.9 \cdot 10^{+20}\right):\\
\;\;\;\;x - z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -0.17499999999999999 or 3.9e20 < z Initial program 100.0%
Taylor expanded in y around 0 83.2%
mul-1-neg83.2%
unsub-neg83.2%
Simplified83.2%
if -0.17499999999999999 < z < 3.9e20Initial program 100.0%
Taylor expanded in y around inf 91.1%
*-commutative91.1%
Simplified91.1%
Final simplification87.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.48e-111) (not (<= t 9.2e+51))) (* (- y z) t) (* x (+ z 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.48e-111) || !(t <= 9.2e+51)) {
tmp = (y - z) * t;
} else {
tmp = x * (z + 1.0);
}
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.48d-111)) .or. (.not. (t <= 9.2d+51))) then
tmp = (y - z) * t
else
tmp = x * (z + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.48e-111) || !(t <= 9.2e+51)) {
tmp = (y - z) * t;
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.48e-111) or not (t <= 9.2e+51): tmp = (y - z) * t else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.48e-111) || !(t <= 9.2e+51)) tmp = Float64(Float64(y - z) * t); else tmp = Float64(x * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.48e-111) || ~((t <= 9.2e+51))) tmp = (y - z) * t; else tmp = x * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.48e-111], N[Not[LessEqual[t, 9.2e+51]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.48 \cdot 10^{-111} \lor \neg \left(t \leq 9.2 \cdot 10^{+51}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if t < -1.4799999999999999e-111 or 9.2000000000000002e51 < t Initial program 100.0%
sub-neg100.0%
distribute-lft-in91.2%
Applied egg-rr91.2%
Taylor expanded in y around inf 88.4%
associate-*r*88.4%
mul-1-neg88.4%
Simplified88.4%
associate-+r+88.4%
distribute-lft-neg-out88.4%
unsub-neg88.4%
+-commutative88.4%
*-commutative88.4%
Applied egg-rr88.4%
Taylor expanded in t around inf 73.9%
if -1.4799999999999999e-111 < t < 9.2000000000000002e51Initial program 100.0%
Taylor expanded in x around inf 86.2%
mul-1-neg86.2%
unsub-neg86.2%
Simplified86.2%
Taylor expanded in y around 0 64.7%
+-commutative64.7%
Simplified64.7%
Final simplification69.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.6e-15))) (* z x) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.6e-15)) {
tmp = z * x;
} 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 ((z <= (-1.0d0)) .or. (.not. (z <= 1.6d-15))) then
tmp = z * x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.6e-15)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 1.6e-15): tmp = z * x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.6e-15)) tmp = Float64(z * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.6e-15))) tmp = z * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.6e-15]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1.6 \cdot 10^{-15}\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1 or 1.6e-15 < z Initial program 99.9%
Taylor expanded in x around inf 54.3%
mul-1-neg54.3%
unsub-neg54.3%
Simplified54.3%
Taylor expanded in z around inf 44.3%
if -1 < z < 1.6e-15Initial program 100.0%
Taylor expanded in y around inf 90.8%
*-commutative90.8%
Simplified90.8%
Taylor expanded in y around 0 37.0%
Final simplification40.9%
(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 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.2%
*-commutative58.2%
Simplified58.2%
Taylor expanded in y around 0 18.8%
Final simplification18.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 2024130
(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))))