
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (- 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
(let* ((t_1 (- x (* x y))) (t_2 (* z (- x t))) (t_3 (+ x (* y t))))
(if (<= z -1.55e-9)
t_2
(if (<= z -2.45e-199)
t_3
(if (<= z -1.5e-226)
t_1
(if (<= z 2.4e-131)
t_3
(if (<= z 9.5e-24) t_1 (if (<= z 6200000000.0) t_3 t_2))))))))
double code(double x, double y, double z, double t) {
double t_1 = x - (x * y);
double t_2 = z * (x - t);
double t_3 = x + (y * t);
double tmp;
if (z <= -1.55e-9) {
tmp = t_2;
} else if (z <= -2.45e-199) {
tmp = t_3;
} else if (z <= -1.5e-226) {
tmp = t_1;
} else if (z <= 2.4e-131) {
tmp = t_3;
} else if (z <= 9.5e-24) {
tmp = t_1;
} else if (z <= 6200000000.0) {
tmp = t_3;
} 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) :: t_3
real(8) :: tmp
t_1 = x - (x * y)
t_2 = z * (x - t)
t_3 = x + (y * t)
if (z <= (-1.55d-9)) then
tmp = t_2
else if (z <= (-2.45d-199)) then
tmp = t_3
else if (z <= (-1.5d-226)) then
tmp = t_1
else if (z <= 2.4d-131) then
tmp = t_3
else if (z <= 9.5d-24) then
tmp = t_1
else if (z <= 6200000000.0d0) then
tmp = t_3
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 - (x * y);
double t_2 = z * (x - t);
double t_3 = x + (y * t);
double tmp;
if (z <= -1.55e-9) {
tmp = t_2;
} else if (z <= -2.45e-199) {
tmp = t_3;
} else if (z <= -1.5e-226) {
tmp = t_1;
} else if (z <= 2.4e-131) {
tmp = t_3;
} else if (z <= 9.5e-24) {
tmp = t_1;
} else if (z <= 6200000000.0) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (x * y) t_2 = z * (x - t) t_3 = x + (y * t) tmp = 0 if z <= -1.55e-9: tmp = t_2 elif z <= -2.45e-199: tmp = t_3 elif z <= -1.5e-226: tmp = t_1 elif z <= 2.4e-131: tmp = t_3 elif z <= 9.5e-24: tmp = t_1 elif z <= 6200000000.0: tmp = t_3 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(x * y)) t_2 = Float64(z * Float64(x - t)) t_3 = Float64(x + Float64(y * t)) tmp = 0.0 if (z <= -1.55e-9) tmp = t_2; elseif (z <= -2.45e-199) tmp = t_3; elseif (z <= -1.5e-226) tmp = t_1; elseif (z <= 2.4e-131) tmp = t_3; elseif (z <= 9.5e-24) tmp = t_1; elseif (z <= 6200000000.0) tmp = t_3; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (x * y); t_2 = z * (x - t); t_3 = x + (y * t); tmp = 0.0; if (z <= -1.55e-9) tmp = t_2; elseif (z <= -2.45e-199) tmp = t_3; elseif (z <= -1.5e-226) tmp = t_1; elseif (z <= 2.4e-131) tmp = t_3; elseif (z <= 9.5e-24) tmp = t_1; elseif (z <= 6200000000.0) tmp = t_3; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.55e-9], t$95$2, If[LessEqual[z, -2.45e-199], t$95$3, If[LessEqual[z, -1.5e-226], t$95$1, If[LessEqual[z, 2.4e-131], t$95$3, If[LessEqual[z, 9.5e-24], t$95$1, If[LessEqual[z, 6200000000.0], t$95$3, t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - x \cdot y\\
t_2 := z \cdot \left(x - t\right)\\
t_3 := x + y \cdot t\\
\mathbf{if}\;z \leq -1.55 \cdot 10^{-9}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -2.45 \cdot 10^{-199}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{-226}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{-131}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{-24}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 6200000000:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -1.55000000000000002e-9 or 6.2e9 < z Initial program 100.0%
Taylor expanded in y around 0 83.3%
mul-1-neg83.3%
distribute-lft-neg-out83.3%
*-commutative83.3%
Simplified83.3%
Taylor expanded in z around 0 83.3%
associate-*r*83.3%
sub-neg83.3%
mul-1-neg83.3%
associate-*r*83.3%
mul-1-neg83.3%
unsub-neg83.3%
mul-1-neg83.3%
sub-neg83.3%
Simplified83.3%
Taylor expanded in z around inf 83.4%
if -1.55000000000000002e-9 < z < -2.45e-199 or -1.49999999999999998e-226 < z < 2.4e-131 or 9.50000000000000029e-24 < z < 6.2e9Initial program 100.0%
sub-neg100.0%
distribute-lft-in98.9%
Applied egg-rr98.9%
Taylor expanded in z around 0 93.1%
Taylor expanded in x around 0 79.7%
if -2.45e-199 < z < -1.49999999999999998e-226 or 2.4e-131 < z < 9.50000000000000029e-24Initial program 99.9%
sub-neg99.9%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 79.0%
Taylor expanded in x around inf 75.2%
associate-*r*75.2%
mul-1-neg75.2%
Simplified75.2%
Final simplification81.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))) (t_2 (+ x (* (- y z) t))))
(if (<= z -4.4e+69)
t_1
(if (<= z -3.2e-199)
t_2
(if (<= z -8.5e-214) (- x (* x y)) (if (<= z 5e+25) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double t_2 = x + ((y - z) * t);
double tmp;
if (z <= -4.4e+69) {
tmp = t_1;
} else if (z <= -3.2e-199) {
tmp = t_2;
} else if (z <= -8.5e-214) {
tmp = x - (x * y);
} else if (z <= 5e+25) {
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 = z * (x - t)
t_2 = x + ((y - z) * t)
if (z <= (-4.4d+69)) then
tmp = t_1
else if (z <= (-3.2d-199)) then
tmp = t_2
else if (z <= (-8.5d-214)) then
tmp = x - (x * y)
else if (z <= 5d+25) 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 = z * (x - t);
double t_2 = x + ((y - z) * t);
double tmp;
if (z <= -4.4e+69) {
tmp = t_1;
} else if (z <= -3.2e-199) {
tmp = t_2;
} else if (z <= -8.5e-214) {
tmp = x - (x * y);
} else if (z <= 5e+25) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) t_2 = x + ((y - z) * t) tmp = 0 if z <= -4.4e+69: tmp = t_1 elif z <= -3.2e-199: tmp = t_2 elif z <= -8.5e-214: tmp = x - (x * y) elif z <= 5e+25: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) t_2 = Float64(x + Float64(Float64(y - z) * t)) tmp = 0.0 if (z <= -4.4e+69) tmp = t_1; elseif (z <= -3.2e-199) tmp = t_2; elseif (z <= -8.5e-214) tmp = Float64(x - Float64(x * y)); elseif (z <= 5e+25) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); t_2 = x + ((y - z) * t); tmp = 0.0; if (z <= -4.4e+69) tmp = t_1; elseif (z <= -3.2e-199) tmp = t_2; elseif (z <= -8.5e-214) tmp = x - (x * y); elseif (z <= 5e+25) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.4e+69], t$95$1, If[LessEqual[z, -3.2e-199], t$95$2, If[LessEqual[z, -8.5e-214], N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e+25], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
t_2 := x + \left(y - z\right) \cdot t\\
\mathbf{if}\;z \leq -4.4 \cdot 10^{+69}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{-199}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{-214}:\\
\;\;\;\;x - x \cdot y\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+25}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -4.4000000000000003e69 or 5.00000000000000024e25 < z Initial program 100.0%
Taylor expanded in y around 0 86.5%
mul-1-neg86.5%
distribute-lft-neg-out86.5%
*-commutative86.5%
Simplified86.5%
Taylor expanded in z around 0 86.5%
associate-*r*86.5%
sub-neg86.5%
mul-1-neg86.5%
associate-*r*86.5%
mul-1-neg86.5%
unsub-neg86.5%
mul-1-neg86.5%
sub-neg86.5%
Simplified86.5%
Taylor expanded in z around inf 86.5%
if -4.4000000000000003e69 < z < -3.1999999999999999e-199 or -8.5000000000000006e-214 < z < 5.00000000000000024e25Initial program 100.0%
Taylor expanded in t around inf 79.6%
if -3.1999999999999999e-199 < z < -8.5000000000000006e-214Initial program 100.0%
sub-neg100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 100.0%
Taylor expanded in x around inf 100.0%
associate-*r*100.0%
mul-1-neg100.0%
Simplified100.0%
Final simplification83.0%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.02e+70)
(* x z)
(if (<= z -2.5e-42)
(* z (- t))
(if (<= z 3.3e-305)
(* y t)
(if (<= z 8.5e-38) x (if (<= z 1.75e+25) (* y t) (* x z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.02e+70) {
tmp = x * z;
} else if (z <= -2.5e-42) {
tmp = z * -t;
} else if (z <= 3.3e-305) {
tmp = y * t;
} else if (z <= 8.5e-38) {
tmp = x;
} else if (z <= 1.75e+25) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.02d+70)) then
tmp = x * z
else if (z <= (-2.5d-42)) then
tmp = z * -t
else if (z <= 3.3d-305) then
tmp = y * t
else if (z <= 8.5d-38) then
tmp = x
else if (z <= 1.75d+25) then
tmp = y * t
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.02e+70) {
tmp = x * z;
} else if (z <= -2.5e-42) {
tmp = z * -t;
} else if (z <= 3.3e-305) {
tmp = y * t;
} else if (z <= 8.5e-38) {
tmp = x;
} else if (z <= 1.75e+25) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.02e+70: tmp = x * z elif z <= -2.5e-42: tmp = z * -t elif z <= 3.3e-305: tmp = y * t elif z <= 8.5e-38: tmp = x elif z <= 1.75e+25: tmp = y * t else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.02e+70) tmp = Float64(x * z); elseif (z <= -2.5e-42) tmp = Float64(z * Float64(-t)); elseif (z <= 3.3e-305) tmp = Float64(y * t); elseif (z <= 8.5e-38) tmp = x; elseif (z <= 1.75e+25) tmp = Float64(y * t); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.02e+70) tmp = x * z; elseif (z <= -2.5e-42) tmp = z * -t; elseif (z <= 3.3e-305) tmp = y * t; elseif (z <= 8.5e-38) tmp = x; elseif (z <= 1.75e+25) tmp = y * t; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.02e+70], N[(x * z), $MachinePrecision], If[LessEqual[z, -2.5e-42], N[(z * (-t)), $MachinePrecision], If[LessEqual[z, 3.3e-305], N[(y * t), $MachinePrecision], If[LessEqual[z, 8.5e-38], x, If[LessEqual[z, 1.75e+25], N[(y * t), $MachinePrecision], N[(x * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{+70}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{-42}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-305}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-38}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+25}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1.02e70 or 1.75e25 < z Initial program 100.0%
Taylor expanded in y around 0 86.5%
mul-1-neg86.5%
distribute-lft-neg-out86.5%
*-commutative86.5%
Simplified86.5%
Taylor expanded in t around 0 52.1%
Taylor expanded in z around inf 52.1%
*-commutative52.1%
Simplified52.1%
if -1.02e70 < z < -2.50000000000000001e-42Initial program 99.9%
Taylor expanded in y around 0 68.8%
mul-1-neg68.8%
distribute-lft-neg-out68.8%
*-commutative68.8%
Simplified68.8%
Taylor expanded in z around 0 68.8%
associate-*r*68.8%
sub-neg68.8%
mul-1-neg68.8%
associate-*r*68.8%
mul-1-neg68.8%
unsub-neg68.8%
mul-1-neg68.8%
sub-neg68.8%
Simplified68.8%
Taylor expanded in x around 0 50.0%
associate-*r*50.0%
mul-1-neg50.0%
Simplified50.0%
if -2.50000000000000001e-42 < z < 3.29999999999999982e-305 or 8.50000000000000046e-38 < z < 1.75e25Initial program 100.0%
sub-neg100.0%
distribute-lft-in98.6%
Applied egg-rr98.6%
Taylor expanded in z around 0 88.5%
Taylor expanded in x around 0 71.5%
Taylor expanded in x around 0 44.8%
if 3.29999999999999982e-305 < z < 8.50000000000000046e-38Initial program 99.9%
Taylor expanded in y around 0 51.0%
mul-1-neg51.0%
distribute-lft-neg-out51.0%
*-commutative51.0%
Simplified51.0%
Taylor expanded in z around 0 41.7%
Final simplification48.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))))
(if (<= z -2.5e-48)
t_1
(if (<= z 1.52e-301)
(* y t)
(if (<= z 2.7e-39) x (if (<= z 6100000000.0) (* y t) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -2.5e-48) {
tmp = t_1;
} else if (z <= 1.52e-301) {
tmp = y * t;
} else if (z <= 2.7e-39) {
tmp = x;
} else if (z <= 6100000000.0) {
tmp = y * t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z * (x - t)
if (z <= (-2.5d-48)) then
tmp = t_1
else if (z <= 1.52d-301) then
tmp = y * t
else if (z <= 2.7d-39) then
tmp = x
else if (z <= 6100000000.0d0) then
tmp = y * t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -2.5e-48) {
tmp = t_1;
} else if (z <= 1.52e-301) {
tmp = y * t;
} else if (z <= 2.7e-39) {
tmp = x;
} else if (z <= 6100000000.0) {
tmp = y * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -2.5e-48: tmp = t_1 elif z <= 1.52e-301: tmp = y * t elif z <= 2.7e-39: tmp = x elif z <= 6100000000.0: tmp = y * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -2.5e-48) tmp = t_1; elseif (z <= 1.52e-301) tmp = Float64(y * t); elseif (z <= 2.7e-39) tmp = x; elseif (z <= 6100000000.0) tmp = Float64(y * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); tmp = 0.0; if (z <= -2.5e-48) tmp = t_1; elseif (z <= 1.52e-301) tmp = y * t; elseif (z <= 2.7e-39) tmp = x; elseif (z <= 6100000000.0) tmp = y * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.5e-48], t$95$1, If[LessEqual[z, 1.52e-301], N[(y * t), $MachinePrecision], If[LessEqual[z, 2.7e-39], x, If[LessEqual[z, 6100000000.0], N[(y * t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{-48}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.52 \cdot 10^{-301}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-39}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6100000000:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -2.4999999999999999e-48 or 6.1e9 < z Initial program 100.0%
Taylor expanded in y around 0 82.6%
mul-1-neg82.6%
distribute-lft-neg-out82.6%
*-commutative82.6%
Simplified82.6%
Taylor expanded in z around 0 82.6%
associate-*r*82.6%
sub-neg82.6%
mul-1-neg82.6%
associate-*r*82.6%
mul-1-neg82.6%
unsub-neg82.6%
mul-1-neg82.6%
sub-neg82.6%
Simplified82.6%
Taylor expanded in z around inf 80.7%
if -2.4999999999999999e-48 < z < 1.52e-301 or 2.7000000000000001e-39 < z < 6.1e9Initial program 100.0%
sub-neg100.0%
distribute-lft-in98.6%
Applied egg-rr98.6%
Taylor expanded in z around 0 90.7%
Taylor expanded in x around 0 73.0%
Taylor expanded in x around 0 45.2%
if 1.52e-301 < z < 2.7000000000000001e-39Initial program 99.9%
Taylor expanded in y around 0 51.0%
mul-1-neg51.0%
distribute-lft-neg-out51.0%
*-commutative51.0%
Simplified51.0%
Taylor expanded in z around 0 41.7%
Final simplification64.5%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.22e+71)
(* x z)
(if (<= z 3.8e-302)
(* y t)
(if (<= z 8.2e-36) x (if (<= z 1.75e+25) (* y t) (* x z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.22e+71) {
tmp = x * z;
} else if (z <= 3.8e-302) {
tmp = y * t;
} else if (z <= 8.2e-36) {
tmp = x;
} else if (z <= 1.75e+25) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.22d+71)) then
tmp = x * z
else if (z <= 3.8d-302) then
tmp = y * t
else if (z <= 8.2d-36) then
tmp = x
else if (z <= 1.75d+25) then
tmp = y * t
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.22e+71) {
tmp = x * z;
} else if (z <= 3.8e-302) {
tmp = y * t;
} else if (z <= 8.2e-36) {
tmp = x;
} else if (z <= 1.75e+25) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.22e+71: tmp = x * z elif z <= 3.8e-302: tmp = y * t elif z <= 8.2e-36: tmp = x elif z <= 1.75e+25: tmp = y * t else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.22e+71) tmp = Float64(x * z); elseif (z <= 3.8e-302) tmp = Float64(y * t); elseif (z <= 8.2e-36) tmp = x; elseif (z <= 1.75e+25) tmp = Float64(y * t); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.22e+71) tmp = x * z; elseif (z <= 3.8e-302) tmp = y * t; elseif (z <= 8.2e-36) tmp = x; elseif (z <= 1.75e+25) tmp = y * t; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.22e+71], N[(x * z), $MachinePrecision], If[LessEqual[z, 3.8e-302], N[(y * t), $MachinePrecision], If[LessEqual[z, 8.2e-36], x, If[LessEqual[z, 1.75e+25], N[(y * t), $MachinePrecision], N[(x * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.22 \cdot 10^{+71}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-302}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-36}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+25}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1.22000000000000001e71 or 1.75e25 < z Initial program 100.0%
Taylor expanded in y around 0 86.5%
mul-1-neg86.5%
distribute-lft-neg-out86.5%
*-commutative86.5%
Simplified86.5%
Taylor expanded in t around 0 52.1%
Taylor expanded in z around inf 52.1%
*-commutative52.1%
Simplified52.1%
if -1.22000000000000001e71 < z < 3.8e-302 or 8.20000000000000025e-36 < z < 1.75e25Initial program 100.0%
sub-neg100.0%
distribute-lft-in99.0%
Applied egg-rr99.0%
Taylor expanded in z around 0 77.4%
Taylor expanded in x around 0 59.2%
Taylor expanded in x around 0 37.1%
if 3.8e-302 < z < 8.20000000000000025e-36Initial program 99.9%
Taylor expanded in y around 0 51.0%
mul-1-neg51.0%
distribute-lft-neg-out51.0%
*-commutative51.0%
Simplified51.0%
Taylor expanded in z around 0 41.7%
Final simplification44.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.115) (not (<= z 1.45e+29))) (* z (- x t)) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.115) || !(z <= 1.45e+29)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-0.115d0)) .or. (.not. (z <= 1.45d+29))) then
tmp = z * (x - t)
else
tmp = x + (y * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.115) || !(z <= 1.45e+29)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.115) or not (z <= 1.45e+29): tmp = z * (x - t) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.115) || !(z <= 1.45e+29)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x + Float64(y * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -0.115) || ~((z <= 1.45e+29))) tmp = z * (x - t); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.115], N[Not[LessEqual[z, 1.45e+29]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.115 \lor \neg \left(z \leq 1.45 \cdot 10^{+29}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -0.115000000000000005 or 1.45e29 < z Initial program 100.0%
Taylor expanded in y around 0 85.5%
mul-1-neg85.5%
distribute-lft-neg-out85.5%
*-commutative85.5%
Simplified85.5%
Taylor expanded in z around 0 85.5%
associate-*r*85.5%
sub-neg85.5%
mul-1-neg85.5%
associate-*r*85.5%
mul-1-neg85.5%
unsub-neg85.5%
mul-1-neg85.5%
sub-neg85.5%
Simplified85.5%
Taylor expanded in z around inf 85.5%
if -0.115000000000000005 < z < 1.45e29Initial program 100.0%
Taylor expanded in y around inf 90.1%
*-commutative90.1%
Simplified90.1%
Final simplification87.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.105) (not (<= z 1.8e+29))) (+ x (* z (- x t))) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.105) || !(z <= 1.8e+29)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-0.105d0)) .or. (.not. (z <= 1.8d+29))) then
tmp = x + (z * (x - t))
else
tmp = x + (y * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.105) || !(z <= 1.8e+29)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.105) or not (z <= 1.8e+29): tmp = x + (z * (x - t)) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.105) || !(z <= 1.8e+29)) tmp = Float64(x + Float64(z * Float64(x - t))); else tmp = Float64(x + Float64(y * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -0.105) || ~((z <= 1.8e+29))) tmp = x + (z * (x - t)); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.105], N[Not[LessEqual[z, 1.8e+29]], $MachinePrecision]], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.105 \lor \neg \left(z \leq 1.8 \cdot 10^{+29}\right):\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -0.104999999999999996 or 1.79999999999999988e29 < z Initial program 100.0%
Taylor expanded in y around 0 85.5%
mul-1-neg85.5%
distribute-lft-neg-out85.5%
*-commutative85.5%
Simplified85.5%
Taylor expanded in z around 0 85.5%
associate-*r*85.5%
sub-neg85.5%
mul-1-neg85.5%
associate-*r*85.5%
mul-1-neg85.5%
unsub-neg85.5%
mul-1-neg85.5%
sub-neg85.5%
Simplified85.5%
if -0.104999999999999996 < z < 1.79999999999999988e29Initial program 100.0%
Taylor expanded in y around inf 90.1%
*-commutative90.1%
Simplified90.1%
Final simplification87.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.5e-14) (not (<= z 2550000000000.0))) (* z (- x t)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.5e-14) || !(z <= 2550000000000.0)) {
tmp = z * (x - t);
} else {
tmp = x + (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 ((z <= (-4.5d-14)) .or. (.not. (z <= 2550000000000.0d0))) then
tmp = z * (x - t)
else
tmp = x + (y * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.5e-14) || !(z <= 2550000000000.0)) {
tmp = z * (x - t);
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.5e-14) or not (z <= 2550000000000.0): tmp = z * (x - t) else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.5e-14) || !(z <= 2550000000000.0)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x + Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.5e-14) || ~((z <= 2550000000000.0))) tmp = z * (x - t); else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.5e-14], N[Not[LessEqual[z, 2550000000000.0]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{-14} \lor \neg \left(z \leq 2550000000000\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if z < -4.4999999999999998e-14 or 2.55e12 < z Initial program 100.0%
Taylor expanded in y around 0 83.3%
mul-1-neg83.3%
distribute-lft-neg-out83.3%
*-commutative83.3%
Simplified83.3%
Taylor expanded in z around 0 83.3%
associate-*r*83.3%
sub-neg83.3%
mul-1-neg83.3%
associate-*r*83.3%
mul-1-neg83.3%
unsub-neg83.3%
mul-1-neg83.3%
sub-neg83.3%
Simplified83.3%
Taylor expanded in z around inf 83.4%
if -4.4999999999999998e-14 < z < 2.55e12Initial program 100.0%
sub-neg100.0%
distribute-lft-in99.1%
Applied egg-rr99.1%
Taylor expanded in z around 0 90.4%
Taylor expanded in x around 0 70.0%
Final simplification77.2%
(FPCore (x y z t) :precision binary64 (if (<= y -1.2e+45) (* y t) (if (<= y 1.8e-28) x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.2e+45) {
tmp = y * t;
} else if (y <= 1.8e-28) {
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.2d+45)) then
tmp = y * t
else if (y <= 1.8d-28) 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.2e+45) {
tmp = y * t;
} else if (y <= 1.8e-28) {
tmp = x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.2e+45: tmp = y * t elif y <= 1.8e-28: tmp = x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.2e+45) tmp = Float64(y * t); elseif (y <= 1.8e-28) 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.2e+45) tmp = y * t; elseif (y <= 1.8e-28) tmp = x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.2e+45], N[(y * t), $MachinePrecision], If[LessEqual[y, 1.8e-28], x, N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+45}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-28}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.19999999999999995e45 or 1.7999999999999999e-28 < y Initial program 100.0%
sub-neg100.0%
distribute-lft-in94.9%
Applied egg-rr94.9%
Taylor expanded in z around 0 73.1%
Taylor expanded in x around 0 47.2%
Taylor expanded in x around 0 46.6%
if -1.19999999999999995e45 < y < 1.7999999999999999e-28Initial program 100.0%
Taylor expanded in y around 0 89.8%
mul-1-neg89.8%
distribute-lft-neg-out89.8%
*-commutative89.8%
Simplified89.8%
Taylor expanded in z around 0 30.5%
Final simplification37.9%
(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 0 64.9%
mul-1-neg64.9%
distribute-lft-neg-out64.9%
*-commutative64.9%
Simplified64.9%
Taylor expanded in z around 0 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 2023279
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:herbie-target
(+ x (+ (* t (- y z)) (* (- x) (- y z))))
(+ x (* (- y z) (- t x))))