
(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 (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%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* y t))) (t_2 (* x (+ (- z y) 1.0))))
(if (<= t -2e+41)
t_1
(if (<= t 5.2e-83)
t_2
(if (<= t 0.00078)
(* y (- t x))
(if (<= t 5.5e+54) t_2 (if (<= t 3.2e+162) t_1 (- x (* z t)))))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (y * t);
double t_2 = x * ((z - y) + 1.0);
double tmp;
if (t <= -2e+41) {
tmp = t_1;
} else if (t <= 5.2e-83) {
tmp = t_2;
} else if (t <= 0.00078) {
tmp = y * (t - x);
} else if (t <= 5.5e+54) {
tmp = t_2;
} else if (t <= 3.2e+162) {
tmp = t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x + (y * t)
t_2 = x * ((z - y) + 1.0d0)
if (t <= (-2d+41)) then
tmp = t_1
else if (t <= 5.2d-83) then
tmp = t_2
else if (t <= 0.00078d0) then
tmp = y * (t - x)
else if (t <= 5.5d+54) then
tmp = t_2
else if (t <= 3.2d+162) then
tmp = t_1
else
tmp = x - (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + (y * t);
double t_2 = x * ((z - y) + 1.0);
double tmp;
if (t <= -2e+41) {
tmp = t_1;
} else if (t <= 5.2e-83) {
tmp = t_2;
} else if (t <= 0.00078) {
tmp = y * (t - x);
} else if (t <= 5.5e+54) {
tmp = t_2;
} else if (t <= 3.2e+162) {
tmp = t_1;
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (y * t) t_2 = x * ((z - y) + 1.0) tmp = 0 if t <= -2e+41: tmp = t_1 elif t <= 5.2e-83: tmp = t_2 elif t <= 0.00078: tmp = y * (t - x) elif t <= 5.5e+54: tmp = t_2 elif t <= 3.2e+162: tmp = t_1 else: tmp = x - (z * t) return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(y * t)) t_2 = Float64(x * Float64(Float64(z - y) + 1.0)) tmp = 0.0 if (t <= -2e+41) tmp = t_1; elseif (t <= 5.2e-83) tmp = t_2; elseif (t <= 0.00078) tmp = Float64(y * Float64(t - x)); elseif (t <= 5.5e+54) tmp = t_2; elseif (t <= 3.2e+162) tmp = t_1; else tmp = Float64(x - Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (y * t); t_2 = x * ((z - y) + 1.0); tmp = 0.0; if (t <= -2e+41) tmp = t_1; elseif (t <= 5.2e-83) tmp = t_2; elseif (t <= 0.00078) tmp = y * (t - x); elseif (t <= 5.5e+54) tmp = t_2; elseif (t <= 3.2e+162) tmp = t_1; else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2e+41], t$95$1, If[LessEqual[t, 5.2e-83], t$95$2, If[LessEqual[t, 0.00078], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.5e+54], t$95$2, If[LessEqual[t, 3.2e+162], t$95$1, N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot t\\
t_2 := x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{if}\;t \leq -2 \cdot 10^{+41}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{-83}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 0.00078:\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{+54}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{+162}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if t < -2.00000000000000001e41 or 5.50000000000000026e54 < t < 3.2000000000000001e162Initial program 100.0%
Taylor expanded in t around inf 93.5%
Taylor expanded in y around inf 70.8%
if -2.00000000000000001e41 < t < 5.20000000000000018e-83 or 7.79999999999999986e-4 < t < 5.50000000000000026e54Initial program 100.0%
Taylor expanded in x around inf 87.2%
mul-1-neg87.2%
unsub-neg87.2%
Simplified87.2%
if 5.20000000000000018e-83 < t < 7.79999999999999986e-4Initial program 99.9%
Taylor expanded in y around inf 67.3%
*-commutative67.3%
Simplified67.3%
Taylor expanded in y around inf 61.9%
if 3.2000000000000001e162 < t Initial program 100.0%
Taylor expanded in t around inf 94.8%
Taylor expanded in y around 0 58.3%
mul-1-neg58.3%
distribute-rgt-neg-out58.3%
Simplified58.3%
Final simplification78.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- x))) (t_2 (* x (+ z 1.0))))
(if (<= y -9.2e+188)
t_1
(if (<= y -1.15e+138)
t_2
(if (<= y -4e+25)
(* y t)
(if (<= y -3100000.0)
(* x (- 1.0 y))
(if (<= y 5.6e+109) t_2 t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = y * -x;
double t_2 = x * (z + 1.0);
double tmp;
if (y <= -9.2e+188) {
tmp = t_1;
} else if (y <= -1.15e+138) {
tmp = t_2;
} else if (y <= -4e+25) {
tmp = y * t;
} else if (y <= -3100000.0) {
tmp = x * (1.0 - y);
} else if (y <= 5.6e+109) {
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 * -x
t_2 = x * (z + 1.0d0)
if (y <= (-9.2d+188)) then
tmp = t_1
else if (y <= (-1.15d+138)) then
tmp = t_2
else if (y <= (-4d+25)) then
tmp = y * t
else if (y <= (-3100000.0d0)) then
tmp = x * (1.0d0 - y)
else if (y <= 5.6d+109) 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 * -x;
double t_2 = x * (z + 1.0);
double tmp;
if (y <= -9.2e+188) {
tmp = t_1;
} else if (y <= -1.15e+138) {
tmp = t_2;
} else if (y <= -4e+25) {
tmp = y * t;
} else if (y <= -3100000.0) {
tmp = x * (1.0 - y);
} else if (y <= 5.6e+109) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * -x t_2 = x * (z + 1.0) tmp = 0 if y <= -9.2e+188: tmp = t_1 elif y <= -1.15e+138: tmp = t_2 elif y <= -4e+25: tmp = y * t elif y <= -3100000.0: tmp = x * (1.0 - y) elif y <= 5.6e+109: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(-x)) t_2 = Float64(x * Float64(z + 1.0)) tmp = 0.0 if (y <= -9.2e+188) tmp = t_1; elseif (y <= -1.15e+138) tmp = t_2; elseif (y <= -4e+25) tmp = Float64(y * t); elseif (y <= -3100000.0) tmp = Float64(x * Float64(1.0 - y)); elseif (y <= 5.6e+109) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * -x; t_2 = x * (z + 1.0); tmp = 0.0; if (y <= -9.2e+188) tmp = t_1; elseif (y <= -1.15e+138) tmp = t_2; elseif (y <= -4e+25) tmp = y * t; elseif (y <= -3100000.0) tmp = x * (1.0 - y); elseif (y <= 5.6e+109) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-x)), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.2e+188], t$95$1, If[LessEqual[y, -1.15e+138], t$95$2, If[LessEqual[y, -4e+25], N[(y * t), $MachinePrecision], If[LessEqual[y, -3100000.0], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.6e+109], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(-x\right)\\
t_2 := x \cdot \left(z + 1\right)\\
\mathbf{if}\;y \leq -9.2 \cdot 10^{+188}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.15 \cdot 10^{+138}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -4 \cdot 10^{+25}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq -3100000:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{+109}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.20000000000000046e188 or 5.6000000000000004e109 < y Initial program 100.0%
Taylor expanded in x around inf 65.8%
mul-1-neg65.8%
unsub-neg65.8%
Simplified65.8%
Taylor expanded in y around inf 61.2%
associate-*r*61.2%
neg-mul-161.2%
*-commutative61.2%
Simplified61.2%
if -9.20000000000000046e188 < y < -1.15000000000000004e138 or -3.1e6 < y < 5.6000000000000004e109Initial program 100.0%
Taylor expanded in x around inf 66.6%
mul-1-neg66.6%
unsub-neg66.6%
Simplified66.6%
Taylor expanded in y around 0 60.4%
+-commutative60.4%
Simplified60.4%
if -1.15000000000000004e138 < y < -4.00000000000000036e25Initial program 100.0%
Taylor expanded in t around inf 79.0%
Taylor expanded in y around inf 68.1%
Taylor expanded in x around 0 67.9%
*-commutative67.9%
Simplified67.9%
if -4.00000000000000036e25 < y < -3.1e6Initial program 99.5%
Taylor expanded in x around inf 83.5%
mul-1-neg83.5%
unsub-neg83.5%
Simplified83.5%
Taylor expanded in z around 0 83.8%
(FPCore (x y z t)
:precision binary64
(if (or (<= t -4.2e+39)
(and (not (<= t 8e-57)) (or (<= t 0.026) (not (<= t 1.7e+58)))))
(+ x (* (- y z) t))
(* x (+ (- z y) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.2e+39) || (!(t <= 8e-57) && ((t <= 0.026) || !(t <= 1.7e+58)))) {
tmp = x + ((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 <= (-4.2d+39)) .or. (.not. (t <= 8d-57)) .and. (t <= 0.026d0) .or. (.not. (t <= 1.7d+58))) then
tmp = x + ((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 <= -4.2e+39) || (!(t <= 8e-57) && ((t <= 0.026) || !(t <= 1.7e+58)))) {
tmp = x + ((y - z) * t);
} else {
tmp = x * ((z - y) + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.2e+39) or (not (t <= 8e-57) and ((t <= 0.026) or not (t <= 1.7e+58))): tmp = x + ((y - z) * t) else: tmp = x * ((z - y) + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.2e+39) || (!(t <= 8e-57) && ((t <= 0.026) || !(t <= 1.7e+58)))) tmp = Float64(x + 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 <= -4.2e+39) || (~((t <= 8e-57)) && ((t <= 0.026) || ~((t <= 1.7e+58))))) tmp = x + ((y - z) * t); else tmp = x * ((z - y) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.2e+39], And[N[Not[LessEqual[t, 8e-57]], $MachinePrecision], Or[LessEqual[t, 0.026], N[Not[LessEqual[t, 1.7e+58]], $MachinePrecision]]]], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.2 \cdot 10^{+39} \lor \neg \left(t \leq 8 \cdot 10^{-57}\right) \land \left(t \leq 0.026 \lor \neg \left(t \leq 1.7 \cdot 10^{+58}\right)\right):\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\end{array}
\end{array}
if t < -4.1999999999999997e39 or 7.99999999999999964e-57 < t < 0.0259999999999999988 or 1.7e58 < t Initial program 100.0%
Taylor expanded in t around inf 89.9%
if -4.1999999999999997e39 < t < 7.99999999999999964e-57 or 0.0259999999999999988 < t < 1.7e58Initial program 100.0%
Taylor expanded in x around inf 86.8%
mul-1-neg86.8%
unsub-neg86.8%
Simplified86.8%
Final simplification88.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -2.6e-33)
t_1
(if (<= y 1.15e-201)
(* x (+ z 1.0))
(if (<= y 22500.0) (- x (* z t)) (if (<= y 9.5e+44) (* z x) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -2.6e-33) {
tmp = t_1;
} else if (y <= 1.15e-201) {
tmp = x * (z + 1.0);
} else if (y <= 22500.0) {
tmp = x - (z * t);
} else if (y <= 9.5e+44) {
tmp = z * 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 * (t - x)
if (y <= (-2.6d-33)) then
tmp = t_1
else if (y <= 1.15d-201) then
tmp = x * (z + 1.0d0)
else if (y <= 22500.0d0) then
tmp = x - (z * t)
else if (y <= 9.5d+44) then
tmp = z * 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 * (t - x);
double tmp;
if (y <= -2.6e-33) {
tmp = t_1;
} else if (y <= 1.15e-201) {
tmp = x * (z + 1.0);
} else if (y <= 22500.0) {
tmp = x - (z * t);
} else if (y <= 9.5e+44) {
tmp = z * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -2.6e-33: tmp = t_1 elif y <= 1.15e-201: tmp = x * (z + 1.0) elif y <= 22500.0: tmp = x - (z * t) elif y <= 9.5e+44: tmp = z * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -2.6e-33) tmp = t_1; elseif (y <= 1.15e-201) tmp = Float64(x * Float64(z + 1.0)); elseif (y <= 22500.0) tmp = Float64(x - Float64(z * t)); elseif (y <= 9.5e+44) tmp = Float64(z * x); 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 <= -2.6e-33) tmp = t_1; elseif (y <= 1.15e-201) tmp = x * (z + 1.0); elseif (y <= 22500.0) tmp = x - (z * t); elseif (y <= 9.5e+44) tmp = z * x; 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, -2.6e-33], t$95$1, If[LessEqual[y, 1.15e-201], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 22500.0], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.5e+44], N[(z * x), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -2.6 \cdot 10^{-33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-201}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;y \leq 22500:\\
\;\;\;\;x - z \cdot t\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{+44}:\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.59999999999999994e-33 or 9.5000000000000004e44 < y Initial program 99.9%
Taylor expanded in y around inf 81.0%
*-commutative81.0%
Simplified81.0%
Taylor expanded in y around inf 79.0%
if -2.59999999999999994e-33 < y < 1.14999999999999993e-201Initial program 100.0%
Taylor expanded in x around inf 73.1%
mul-1-neg73.1%
unsub-neg73.1%
Simplified73.1%
Taylor expanded in y around 0 73.1%
+-commutative73.1%
Simplified73.1%
if 1.14999999999999993e-201 < y < 22500Initial program 99.9%
Taylor expanded in t around inf 82.6%
Taylor expanded in y around 0 75.9%
mul-1-neg75.9%
distribute-rgt-neg-out75.9%
Simplified75.9%
if 22500 < y < 9.5000000000000004e44Initial program 100.0%
Taylor expanded in x around inf 61.4%
mul-1-neg61.4%
unsub-neg61.4%
Simplified61.4%
Taylor expanded in z around inf 51.7%
*-commutative51.7%
Simplified51.7%
Final simplification75.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- x))) (t_2 (* x (+ z 1.0))))
(if (<= y -4.3e+188)
t_1
(if (<= y -4.8e+141)
t_2
(if (<= y -1.28e-26) (* y t) (if (<= y 4.5e+109) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * -x;
double t_2 = x * (z + 1.0);
double tmp;
if (y <= -4.3e+188) {
tmp = t_1;
} else if (y <= -4.8e+141) {
tmp = t_2;
} else if (y <= -1.28e-26) {
tmp = y * t;
} else if (y <= 4.5e+109) {
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 * -x
t_2 = x * (z + 1.0d0)
if (y <= (-4.3d+188)) then
tmp = t_1
else if (y <= (-4.8d+141)) then
tmp = t_2
else if (y <= (-1.28d-26)) then
tmp = y * t
else if (y <= 4.5d+109) 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 * -x;
double t_2 = x * (z + 1.0);
double tmp;
if (y <= -4.3e+188) {
tmp = t_1;
} else if (y <= -4.8e+141) {
tmp = t_2;
} else if (y <= -1.28e-26) {
tmp = y * t;
} else if (y <= 4.5e+109) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * -x t_2 = x * (z + 1.0) tmp = 0 if y <= -4.3e+188: tmp = t_1 elif y <= -4.8e+141: tmp = t_2 elif y <= -1.28e-26: tmp = y * t elif y <= 4.5e+109: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(-x)) t_2 = Float64(x * Float64(z + 1.0)) tmp = 0.0 if (y <= -4.3e+188) tmp = t_1; elseif (y <= -4.8e+141) tmp = t_2; elseif (y <= -1.28e-26) tmp = Float64(y * t); elseif (y <= 4.5e+109) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * -x; t_2 = x * (z + 1.0); tmp = 0.0; if (y <= -4.3e+188) tmp = t_1; elseif (y <= -4.8e+141) tmp = t_2; elseif (y <= -1.28e-26) tmp = y * t; elseif (y <= 4.5e+109) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-x)), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.3e+188], t$95$1, If[LessEqual[y, -4.8e+141], t$95$2, If[LessEqual[y, -1.28e-26], N[(y * t), $MachinePrecision], If[LessEqual[y, 4.5e+109], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(-x\right)\\
t_2 := x \cdot \left(z + 1\right)\\
\mathbf{if}\;y \leq -4.3 \cdot 10^{+188}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -4.8 \cdot 10^{+141}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -1.28 \cdot 10^{-26}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+109}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.29999999999999985e188 or 4.4999999999999996e109 < y Initial program 100.0%
Taylor expanded in x around inf 65.8%
mul-1-neg65.8%
unsub-neg65.8%
Simplified65.8%
Taylor expanded in y around inf 61.2%
associate-*r*61.2%
neg-mul-161.2%
*-commutative61.2%
Simplified61.2%
if -4.29999999999999985e188 < y < -4.79999999999999995e141 or -1.27999999999999996e-26 < y < 4.4999999999999996e109Initial program 100.0%
Taylor expanded in x around inf 67.4%
mul-1-neg67.4%
unsub-neg67.4%
Simplified67.4%
Taylor expanded in y around 0 61.4%
+-commutative61.4%
Simplified61.4%
if -4.79999999999999995e141 < y < -1.27999999999999996e-26Initial program 99.9%
Taylor expanded in t around inf 69.4%
Taylor expanded in y around inf 56.6%
Taylor expanded in x around 0 54.2%
*-commutative54.2%
Simplified54.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- x))))
(if (<= y -4.1e+188)
t_1
(if (<= y -9.2e+120)
(* z x)
(if (<= y -1.6e-33) (* y t) (if (<= y 1.1e+110) (* z x) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * -x;
double tmp;
if (y <= -4.1e+188) {
tmp = t_1;
} else if (y <= -9.2e+120) {
tmp = z * x;
} else if (y <= -1.6e-33) {
tmp = y * t;
} else if (y <= 1.1e+110) {
tmp = z * 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 * -x
if (y <= (-4.1d+188)) then
tmp = t_1
else if (y <= (-9.2d+120)) then
tmp = z * x
else if (y <= (-1.6d-33)) then
tmp = y * t
else if (y <= 1.1d+110) then
tmp = z * 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 * -x;
double tmp;
if (y <= -4.1e+188) {
tmp = t_1;
} else if (y <= -9.2e+120) {
tmp = z * x;
} else if (y <= -1.6e-33) {
tmp = y * t;
} else if (y <= 1.1e+110) {
tmp = z * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * -x tmp = 0 if y <= -4.1e+188: tmp = t_1 elif y <= -9.2e+120: tmp = z * x elif y <= -1.6e-33: tmp = y * t elif y <= 1.1e+110: tmp = z * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(-x)) tmp = 0.0 if (y <= -4.1e+188) tmp = t_1; elseif (y <= -9.2e+120) tmp = Float64(z * x); elseif (y <= -1.6e-33) tmp = Float64(y * t); elseif (y <= 1.1e+110) tmp = Float64(z * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * -x; tmp = 0.0; if (y <= -4.1e+188) tmp = t_1; elseif (y <= -9.2e+120) tmp = z * x; elseif (y <= -1.6e-33) tmp = y * t; elseif (y <= 1.1e+110) tmp = z * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-x)), $MachinePrecision]}, If[LessEqual[y, -4.1e+188], t$95$1, If[LessEqual[y, -9.2e+120], N[(z * x), $MachinePrecision], If[LessEqual[y, -1.6e-33], N[(y * t), $MachinePrecision], If[LessEqual[y, 1.1e+110], N[(z * x), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(-x\right)\\
\mathbf{if}\;y \leq -4.1 \cdot 10^{+188}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -9.2 \cdot 10^{+120}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-33}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+110}:\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.1e188 or 1.09999999999999996e110 < y Initial program 100.0%
Taylor expanded in x around inf 65.8%
mul-1-neg65.8%
unsub-neg65.8%
Simplified65.8%
Taylor expanded in y around inf 61.2%
associate-*r*61.2%
neg-mul-161.2%
*-commutative61.2%
Simplified61.2%
if -4.1e188 < y < -9.1999999999999997e120 or -1.59999999999999988e-33 < y < 1.09999999999999996e110Initial program 100.0%
Taylor expanded in x around inf 67.6%
mul-1-neg67.6%
unsub-neg67.6%
Simplified67.6%
Taylor expanded in z around inf 40.3%
*-commutative40.3%
Simplified40.3%
if -9.1999999999999997e120 < y < -1.59999999999999988e-33Initial program 99.9%
Taylor expanded in t around inf 73.9%
Taylor expanded in y around inf 60.7%
Taylor expanded in x around 0 55.6%
*-commutative55.6%
Simplified55.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.6e-33) (not (<= y 1.65e+44))) (* y (- t x)) (* x (+ z 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.6e-33) || !(y <= 1.65e+44)) {
tmp = y * (t - x);
} 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 ((y <= (-2.6d-33)) .or. (.not. (y <= 1.65d+44))) then
tmp = y * (t - x)
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 ((y <= -2.6e-33) || !(y <= 1.65e+44)) {
tmp = y * (t - x);
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.6e-33) or not (y <= 1.65e+44): tmp = y * (t - x) else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.6e-33) || !(y <= 1.65e+44)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(x * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.6e-33) || ~((y <= 1.65e+44))) tmp = y * (t - x); else tmp = x * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.6e-33], N[Not[LessEqual[y, 1.65e+44]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{-33} \lor \neg \left(y \leq 1.65 \cdot 10^{+44}\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if y < -2.59999999999999994e-33 or 1.65000000000000007e44 < y Initial program 99.9%
Taylor expanded in y around inf 81.0%
*-commutative81.0%
Simplified81.0%
Taylor expanded in y around inf 79.0%
if -2.59999999999999994e-33 < y < 1.65000000000000007e44Initial program 100.0%
Taylor expanded in x around inf 68.5%
mul-1-neg68.5%
unsub-neg68.5%
Simplified68.5%
Taylor expanded in y around 0 66.7%
+-commutative66.7%
Simplified66.7%
Final simplification73.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.8e+30) (not (<= t 2.25e-57))) (* y t) (* z x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.8e+30) || !(t <= 2.25e-57)) {
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 ((t <= (-4.8d+30)) .or. (.not. (t <= 2.25d-57))) 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 ((t <= -4.8e+30) || !(t <= 2.25e-57)) {
tmp = y * t;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.8e+30) or not (t <= 2.25e-57): tmp = y * t else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.8e+30) || !(t <= 2.25e-57)) 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 ((t <= -4.8e+30) || ~((t <= 2.25e-57))) tmp = y * t; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.8e+30], N[Not[LessEqual[t, 2.25e-57]], $MachinePrecision]], N[(y * t), $MachinePrecision], N[(z * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{+30} \lor \neg \left(t \leq 2.25 \cdot 10^{-57}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if t < -4.7999999999999999e30 or 2.24999999999999986e-57 < t Initial program 100.0%
Taylor expanded in t around inf 81.5%
Taylor expanded in y around inf 52.8%
Taylor expanded in x around 0 43.5%
*-commutative43.5%
Simplified43.5%
if -4.7999999999999999e30 < t < 2.24999999999999986e-57Initial program 100.0%
Taylor expanded in x around inf 86.5%
mul-1-neg86.5%
unsub-neg86.5%
Simplified86.5%
Taylor expanded in z around inf 42.7%
*-commutative42.7%
Simplified42.7%
Final simplification43.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.05e-27) (not (<= y 17500.0))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.05e-27) || !(y <= 17500.0)) {
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 <= (-3.05d-27)) .or. (.not. (y <= 17500.0d0))) 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 <= -3.05e-27) || !(y <= 17500.0)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.05e-27) or not (y <= 17500.0): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.05e-27) || !(y <= 17500.0)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.05e-27) || ~((y <= 17500.0))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.05e-27], N[Not[LessEqual[y, 17500.0]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.05 \cdot 10^{-27} \lor \neg \left(y \leq 17500\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.05e-27 or 17500 < y Initial program 99.9%
Taylor expanded in t around inf 49.0%
Taylor expanded in y around inf 40.5%
Taylor expanded in x around 0 39.9%
*-commutative39.9%
Simplified39.9%
if -3.05e-27 < y < 17500Initial program 100.0%
Taylor expanded in t around inf 67.0%
Taylor expanded in x around inf 32.5%
Final simplification36.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%
(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 56.4%
Taylor expanded in x around inf 15.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 2024096
(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))))