
(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%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* y t))) (t_2 (- x (* y x))))
(if (<= y -7.6e+117)
t_1
(if (<= y -5e+48)
t_2
(if (<= y -1.4e+33)
t_1
(if (<= y 13200000000000.0) (- x (* z t)) t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (y * t);
double t_2 = x - (y * x);
double tmp;
if (y <= -7.6e+117) {
tmp = t_1;
} else if (y <= -5e+48) {
tmp = t_2;
} else if (y <= -1.4e+33) {
tmp = t_1;
} else if (y <= 13200000000000.0) {
tmp = x - (z * t);
} else {
tmp = t_2;
}
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 - (y * x)
if (y <= (-7.6d+117)) then
tmp = t_1
else if (y <= (-5d+48)) then
tmp = t_2
else if (y <= (-1.4d+33)) then
tmp = t_1
else if (y <= 13200000000000.0d0) then
tmp = x - (z * t)
else
tmp = t_2
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 - (y * x);
double tmp;
if (y <= -7.6e+117) {
tmp = t_1;
} else if (y <= -5e+48) {
tmp = t_2;
} else if (y <= -1.4e+33) {
tmp = t_1;
} else if (y <= 13200000000000.0) {
tmp = x - (z * t);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (y * t) t_2 = x - (y * x) tmp = 0 if y <= -7.6e+117: tmp = t_1 elif y <= -5e+48: tmp = t_2 elif y <= -1.4e+33: tmp = t_1 elif y <= 13200000000000.0: tmp = x - (z * t) else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(y * t)) t_2 = Float64(x - Float64(y * x)) tmp = 0.0 if (y <= -7.6e+117) tmp = t_1; elseif (y <= -5e+48) tmp = t_2; elseif (y <= -1.4e+33) tmp = t_1; elseif (y <= 13200000000000.0) tmp = Float64(x - Float64(z * t)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (y * t); t_2 = x - (y * x); tmp = 0.0; if (y <= -7.6e+117) tmp = t_1; elseif (y <= -5e+48) tmp = t_2; elseif (y <= -1.4e+33) tmp = t_1; elseif (y <= 13200000000000.0) tmp = x - (z * t); else tmp = t_2; 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[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7.6e+117], t$95$1, If[LessEqual[y, -5e+48], t$95$2, If[LessEqual[y, -1.4e+33], t$95$1, If[LessEqual[y, 13200000000000.0], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot t\\
t_2 := x - y \cdot x\\
\mathbf{if}\;y \leq -7.6 \cdot 10^{+117}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -5 \cdot 10^{+48}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{+33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 13200000000000:\\
\;\;\;\;x - z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -7.6000000000000003e117 or -4.99999999999999973e48 < y < -1.4e33Initial program 99.9%
Taylor expanded in y around inf 84.5%
*-commutative84.5%
Simplified84.5%
Taylor expanded in t around inf 60.7%
*-commutative60.7%
Simplified60.7%
if -7.6000000000000003e117 < y < -4.99999999999999973e48 or 1.32e13 < y Initial program 100.0%
Taylor expanded in t around 0 58.7%
mul-1-neg58.7%
distribute-rgt-neg-in58.7%
neg-sub058.7%
sub-neg58.7%
+-commutative58.7%
associate--r+58.7%
neg-sub058.7%
remove-double-neg58.7%
Simplified58.7%
Taylor expanded in z around 0 47.1%
mul-1-neg47.1%
unsub-neg47.1%
Simplified47.1%
if -1.4e33 < y < 1.32e13Initial program 100.0%
Taylor expanded in t around inf 77.4%
Taylor expanded in y around 0 67.8%
mul-1-neg67.8%
unsub-neg67.8%
*-commutative67.8%
Simplified67.8%
Final simplification61.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* t (- y z)))))
(if (<= t -1.05e-112)
t_1
(if (<= t 9e-269) (+ x (* z x)) (if (<= t 3.2e-58) (- x (* y x)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x + (t * (y - z));
double tmp;
if (t <= -1.05e-112) {
tmp = t_1;
} else if (t <= 9e-269) {
tmp = x + (z * x);
} else if (t <= 3.2e-58) {
tmp = x - (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 = x + (t * (y - z))
if (t <= (-1.05d-112)) then
tmp = t_1
else if (t <= 9d-269) then
tmp = x + (z * x)
else if (t <= 3.2d-58) then
tmp = x - (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 = x + (t * (y - z));
double tmp;
if (t <= -1.05e-112) {
tmp = t_1;
} else if (t <= 9e-269) {
tmp = x + (z * x);
} else if (t <= 3.2e-58) {
tmp = x - (y * x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (t * (y - z)) tmp = 0 if t <= -1.05e-112: tmp = t_1 elif t <= 9e-269: tmp = x + (z * x) elif t <= 3.2e-58: tmp = x - (y * x) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(t * Float64(y - z))) tmp = 0.0 if (t <= -1.05e-112) tmp = t_1; elseif (t <= 9e-269) tmp = Float64(x + Float64(z * x)); elseif (t <= 3.2e-58) tmp = Float64(x - Float64(y * x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (t * (y - z)); tmp = 0.0; if (t <= -1.05e-112) tmp = t_1; elseif (t <= 9e-269) tmp = x + (z * x); elseif (t <= 3.2e-58) tmp = x - (y * x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.05e-112], t$95$1, If[LessEqual[t, 9e-269], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.2e-58], N[(x - N[(y * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + t \cdot \left(y - z\right)\\
\mathbf{if}\;t \leq -1.05 \cdot 10^{-112}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 9 \cdot 10^{-269}:\\
\;\;\;\;x + z \cdot x\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{-58}:\\
\;\;\;\;x - y \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.05e-112 or 3.2000000000000001e-58 < t Initial program 100.0%
Taylor expanded in t around inf 86.1%
if -1.05e-112 < t < 9.0000000000000003e-269Initial program 100.0%
Taylor expanded in t around 0 90.4%
mul-1-neg90.4%
distribute-rgt-neg-in90.4%
neg-sub090.4%
sub-neg90.4%
+-commutative90.4%
associate--r+90.4%
neg-sub090.4%
remove-double-neg90.4%
Simplified90.4%
Taylor expanded in y around 0 65.6%
if 9.0000000000000003e-269 < t < 3.2000000000000001e-58Initial program 100.0%
Taylor expanded in t around 0 82.1%
mul-1-neg82.1%
distribute-rgt-neg-in82.1%
neg-sub082.1%
sub-neg82.1%
+-commutative82.1%
associate--r+82.1%
neg-sub082.1%
remove-double-neg82.1%
Simplified82.1%
Taylor expanded in z around 0 61.2%
mul-1-neg61.2%
unsub-neg61.2%
Simplified61.2%
Final simplification78.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* y t))))
(if (<= t -1.95e-46)
t_1
(if (<= t 1.35e-270)
(+ x (* z x))
(if (<= t 1.02e-60) (- x (* y x)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x + (y * t);
double tmp;
if (t <= -1.95e-46) {
tmp = t_1;
} else if (t <= 1.35e-270) {
tmp = x + (z * x);
} else if (t <= 1.02e-60) {
tmp = x - (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 = x + (y * t)
if (t <= (-1.95d-46)) then
tmp = t_1
else if (t <= 1.35d-270) then
tmp = x + (z * x)
else if (t <= 1.02d-60) then
tmp = x - (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 = x + (y * t);
double tmp;
if (t <= -1.95e-46) {
tmp = t_1;
} else if (t <= 1.35e-270) {
tmp = x + (z * x);
} else if (t <= 1.02e-60) {
tmp = x - (y * x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (y * t) tmp = 0 if t <= -1.95e-46: tmp = t_1 elif t <= 1.35e-270: tmp = x + (z * x) elif t <= 1.02e-60: tmp = x - (y * x) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(y * t)) tmp = 0.0 if (t <= -1.95e-46) tmp = t_1; elseif (t <= 1.35e-270) tmp = Float64(x + Float64(z * x)); elseif (t <= 1.02e-60) tmp = Float64(x - Float64(y * x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (y * t); tmp = 0.0; if (t <= -1.95e-46) tmp = t_1; elseif (t <= 1.35e-270) tmp = x + (z * x); elseif (t <= 1.02e-60) tmp = x - (y * x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.95e-46], t$95$1, If[LessEqual[t, 1.35e-270], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.02e-60], N[(x - N[(y * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot t\\
\mathbf{if}\;t \leq -1.95 \cdot 10^{-46}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{-270}:\\
\;\;\;\;x + z \cdot x\\
\mathbf{elif}\;t \leq 1.02 \cdot 10^{-60}:\\
\;\;\;\;x - y \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.9500000000000001e-46 or 1.01999999999999994e-60 < t Initial program 100.0%
Taylor expanded in y around inf 59.1%
*-commutative59.1%
Simplified59.1%
Taylor expanded in t around inf 51.4%
*-commutative51.4%
Simplified51.4%
if -1.9500000000000001e-46 < t < 1.35000000000000004e-270Initial program 100.0%
Taylor expanded in t around 0 84.6%
mul-1-neg84.6%
distribute-rgt-neg-in84.6%
neg-sub084.6%
sub-neg84.6%
+-commutative84.6%
associate--r+84.6%
neg-sub084.6%
remove-double-neg84.6%
Simplified84.6%
Taylor expanded in y around 0 61.6%
if 1.35000000000000004e-270 < t < 1.01999999999999994e-60Initial program 100.0%
Taylor expanded in t around 0 81.7%
mul-1-neg81.7%
distribute-rgt-neg-in81.7%
neg-sub081.7%
sub-neg81.7%
+-commutative81.7%
associate--r+81.7%
neg-sub081.7%
remove-double-neg81.7%
Simplified81.7%
Taylor expanded in z around 0 62.6%
mul-1-neg62.6%
unsub-neg62.6%
Simplified62.6%
Final simplification55.7%
(FPCore (x y z t) :precision binary64 (if (<= y -1.55e+33) (* y t) (if (<= y -1.12e-109) (* z x) (if (<= y 2.6e-127) x (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.55e+33) {
tmp = y * t;
} else if (y <= -1.12e-109) {
tmp = z * x;
} else if (y <= 2.6e-127) {
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 <= (-1.55d+33)) then
tmp = y * t
else if (y <= (-1.12d-109)) then
tmp = z * x
else if (y <= 2.6d-127) 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 <= -1.55e+33) {
tmp = y * t;
} else if (y <= -1.12e-109) {
tmp = z * x;
} else if (y <= 2.6e-127) {
tmp = x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.55e+33: tmp = y * t elif y <= -1.12e-109: tmp = z * x elif y <= 2.6e-127: tmp = x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.55e+33) tmp = Float64(y * t); elseif (y <= -1.12e-109) tmp = Float64(z * x); elseif (y <= 2.6e-127) tmp = x; else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.55e+33) tmp = y * t; elseif (y <= -1.12e-109) tmp = z * x; elseif (y <= 2.6e-127) tmp = x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.55e+33], N[(y * t), $MachinePrecision], If[LessEqual[y, -1.12e-109], N[(z * x), $MachinePrecision], If[LessEqual[y, 2.6e-127], x, N[(y * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.55 \cdot 10^{+33}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq -1.12 \cdot 10^{-109}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{-127}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.55e33 or 2.59999999999999991e-127 < y Initial program 100.0%
Taylor expanded in y around inf 71.9%
*-commutative71.9%
Simplified71.9%
Taylor expanded in t around inf 42.4%
*-commutative42.4%
Simplified42.4%
Taylor expanded in x around 0 42.1%
*-commutative42.1%
Simplified42.1%
if -1.55e33 < y < -1.12e-109Initial program 100.0%
Taylor expanded in t around 0 56.0%
mul-1-neg56.0%
distribute-rgt-neg-in56.0%
neg-sub056.0%
sub-neg56.0%
+-commutative56.0%
associate--r+56.0%
neg-sub056.0%
remove-double-neg56.0%
Simplified56.0%
sub-neg56.0%
distribute-rgt-in56.0%
Applied egg-rr56.0%
associate-+r+56.0%
distribute-lft-neg-out56.0%
unsub-neg56.0%
distribute-rgt1-in56.0%
*-commutative56.0%
Applied egg-rr56.0%
Taylor expanded in z around inf 41.7%
*-commutative41.7%
Simplified41.7%
if -1.12e-109 < y < 2.59999999999999991e-127Initial program 100.0%
Taylor expanded in t around inf 82.5%
Taylor expanded in x around inf 42.9%
Final simplification42.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -9e-113) (not (<= t 5e-53))) (+ x (* t (- y z))) (- x (* x (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9e-113) || !(t <= 5e-53)) {
tmp = x + (t * (y - z));
} else {
tmp = x - (x * (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 ((t <= (-9d-113)) .or. (.not. (t <= 5d-53))) then
tmp = x + (t * (y - z))
else
tmp = x - (x * (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9e-113) || !(t <= 5e-53)) {
tmp = x + (t * (y - z));
} else {
tmp = x - (x * (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -9e-113) or not (t <= 5e-53): tmp = x + (t * (y - z)) else: tmp = x - (x * (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -9e-113) || !(t <= 5e-53)) tmp = Float64(x + Float64(t * Float64(y - z))); else tmp = Float64(x - Float64(x * Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -9e-113) || ~((t <= 5e-53))) tmp = x + (t * (y - z)); else tmp = x - (x * (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -9e-113], N[Not[LessEqual[t, 5e-53]], $MachinePrecision]], N[(x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{-113} \lor \neg \left(t \leq 5 \cdot 10^{-53}\right):\\
\;\;\;\;x + t \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot \left(y - z\right)\\
\end{array}
\end{array}
if t < -9.0000000000000002e-113 or 5e-53 < t Initial program 100.0%
Taylor expanded in t around inf 86.7%
if -9.0000000000000002e-113 < t < 5e-53Initial program 100.0%
Taylor expanded in t around 0 86.8%
mul-1-neg86.8%
distribute-rgt-neg-in86.8%
neg-sub086.8%
sub-neg86.8%
+-commutative86.8%
associate--r+86.8%
neg-sub086.8%
remove-double-neg86.8%
Simplified86.8%
Final simplification86.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.25e+33) (not (<= y 2300000000.0))) (- x (* y (- x t))) (+ x (* z (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.25e+33) || !(y <= 2300000000.0)) {
tmp = x - (y * (x - t));
} else {
tmp = x + (z * (x - t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-1.25d+33)) .or. (.not. (y <= 2300000000.0d0))) then
tmp = x - (y * (x - t))
else
tmp = x + (z * (x - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.25e+33) || !(y <= 2300000000.0)) {
tmp = x - (y * (x - t));
} else {
tmp = x + (z * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.25e+33) or not (y <= 2300000000.0): tmp = x - (y * (x - t)) else: tmp = x + (z * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.25e+33) || !(y <= 2300000000.0)) tmp = Float64(x - Float64(y * Float64(x - t))); else tmp = Float64(x + Float64(z * Float64(x - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.25e+33) || ~((y <= 2300000000.0))) tmp = x - (y * (x - t)); else tmp = x + (z * (x - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.25e+33], N[Not[LessEqual[y, 2300000000.0]], $MachinePrecision]], N[(x - N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+33} \lor \neg \left(y \leq 2300000000\right):\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\end{array}
\end{array}
if y < -1.24999999999999993e33 or 2.3e9 < y Initial program 99.9%
Taylor expanded in y around inf 84.3%
*-commutative84.3%
Simplified84.3%
if -1.24999999999999993e33 < y < 2.3e9Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 90.2%
mul-1-neg90.2%
unsub-neg90.2%
Simplified90.2%
Final simplification87.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.3e+33) (not (<= y 1.36e-55))) (* y t) (+ x (* z x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.3e+33) || !(y <= 1.36e-55)) {
tmp = y * t;
} 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 ((y <= (-1.3d+33)) .or. (.not. (y <= 1.36d-55))) then
tmp = y * t
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 ((y <= -1.3e+33) || !(y <= 1.36e-55)) {
tmp = y * t;
} else {
tmp = x + (z * x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.3e+33) or not (y <= 1.36e-55): tmp = y * t else: tmp = x + (z * x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.3e+33) || !(y <= 1.36e-55)) tmp = Float64(y * t); else tmp = Float64(x + Float64(z * x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.3e+33) || ~((y <= 1.36e-55))) tmp = y * t; else tmp = x + (z * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.3e+33], N[Not[LessEqual[y, 1.36e-55]], $MachinePrecision]], N[(y * t), $MachinePrecision], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+33} \lor \neg \left(y \leq 1.36 \cdot 10^{-55}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot x\\
\end{array}
\end{array}
if y < -1.2999999999999999e33 or 1.35999999999999993e-55 < y Initial program 100.0%
Taylor expanded in y around inf 79.4%
*-commutative79.4%
Simplified79.4%
Taylor expanded in t around inf 45.7%
*-commutative45.7%
Simplified45.7%
Taylor expanded in x around 0 45.3%
*-commutative45.3%
Simplified45.3%
if -1.2999999999999999e33 < y < 1.35999999999999993e-55Initial program 100.0%
Taylor expanded in t around 0 56.5%
mul-1-neg56.5%
distribute-rgt-neg-in56.5%
neg-sub056.5%
sub-neg56.5%
+-commutative56.5%
associate--r+56.5%
neg-sub056.5%
remove-double-neg56.5%
Simplified56.5%
Taylor expanded in y around 0 56.5%
Final simplification51.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.95e-46) (not (<= t 4.1e-53))) (+ x (* y t)) (+ x (* z x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.95e-46) || !(t <= 4.1e-53)) {
tmp = x + (y * t);
} 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.95d-46)) .or. (.not. (t <= 4.1d-53))) then
tmp = x + (y * t)
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.95e-46) || !(t <= 4.1e-53)) {
tmp = x + (y * t);
} else {
tmp = x + (z * x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.95e-46) or not (t <= 4.1e-53): tmp = x + (y * t) else: tmp = x + (z * x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.95e-46) || !(t <= 4.1e-53)) tmp = Float64(x + Float64(y * t)); 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.95e-46) || ~((t <= 4.1e-53))) tmp = x + (y * t); else tmp = x + (z * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.95e-46], N[Not[LessEqual[t, 4.1e-53]], $MachinePrecision]], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.95 \cdot 10^{-46} \lor \neg \left(t \leq 4.1 \cdot 10^{-53}\right):\\
\;\;\;\;x + y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot x\\
\end{array}
\end{array}
if t < -1.9500000000000001e-46 or 4.1000000000000001e-53 < t Initial program 100.0%
Taylor expanded in y around inf 59.8%
*-commutative59.8%
Simplified59.8%
Taylor expanded in t around inf 52.1%
*-commutative52.1%
Simplified52.1%
if -1.9500000000000001e-46 < t < 4.1000000000000001e-53Initial program 100.0%
Taylor expanded in t around 0 83.7%
mul-1-neg83.7%
distribute-rgt-neg-in83.7%
neg-sub083.7%
sub-neg83.7%
+-commutative83.7%
associate--r+83.7%
neg-sub083.7%
remove-double-neg83.7%
Simplified83.7%
Taylor expanded in y around 0 56.2%
Final simplification53.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.85e-24) (not (<= y 5.4e-127))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.85e-24) || !(y <= 5.4e-127)) {
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 <= (-2.85d-24)) .or. (.not. (y <= 5.4d-127))) 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 <= -2.85e-24) || !(y <= 5.4e-127)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.85e-24) or not (y <= 5.4e-127): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.85e-24) || !(y <= 5.4e-127)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.85e-24) || ~((y <= 5.4e-127))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.85e-24], N[Not[LessEqual[y, 5.4e-127]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.85 \cdot 10^{-24} \lor \neg \left(y \leq 5.4 \cdot 10^{-127}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.85000000000000001e-24 or 5.3999999999999999e-127 < y Initial program 100.0%
Taylor expanded in y around inf 68.4%
*-commutative68.4%
Simplified68.4%
Taylor expanded in t around inf 40.9%
*-commutative40.9%
Simplified40.9%
Taylor expanded in x around 0 40.5%
*-commutative40.5%
Simplified40.5%
if -2.85000000000000001e-24 < y < 5.3999999999999999e-127Initial program 100.0%
Taylor expanded in t around inf 79.8%
Taylor expanded in x around inf 40.3%
Final simplification40.4%
(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 67.3%
Taylor expanded in x around inf 17.9%
Final simplification17.9%
(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 2024080
(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))))