
(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 10 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) (- x t))))
double code(double x, double y, double z, double t) {
return x - ((y - z) * (x - t));
}
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) * (x - t))
end function
public static double code(double x, double y, double z, double t) {
return x - ((y - z) * (x - t));
}
def code(x, y, z, t): return x - ((y - z) * (x - t))
function code(x, y, z, t) return Float64(x - Float64(Float64(y - z) * Float64(x - t))) end
function tmp = code(x, y, z, t) tmp = x - ((y - z) * (x - t)); end
code[x_, y_, z_, t_] := N[(x - N[(N[(y - z), $MachinePrecision] * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(y - z\right) \cdot \left(x - t\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%
+-commutative83.3%
mul-1-neg83.3%
unsub-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 t around inf 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 t around 0 75.2%
associate-*r*75.2%
neg-mul-175.2%
Simplified75.2%
Final simplification81.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -1.12e+72)
(* x z)
(if (<= z -2.6e-16)
t_1
(if (<= z 7.5)
x
(if (or (<= z 2.2e+108) (and (not (<= z 1.65e+184)) (<= z 4.4e+229)))
t_1
(* x z)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -1.12e+72) {
tmp = x * z;
} else if (z <= -2.6e-16) {
tmp = t_1;
} else if (z <= 7.5) {
tmp = x;
} else if ((z <= 2.2e+108) || (!(z <= 1.65e+184) && (z <= 4.4e+229))) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = z * -t
if (z <= (-1.12d+72)) then
tmp = x * z
else if (z <= (-2.6d-16)) then
tmp = t_1
else if (z <= 7.5d0) then
tmp = x
else if ((z <= 2.2d+108) .or. (.not. (z <= 1.65d+184)) .and. (z <= 4.4d+229)) then
tmp = t_1
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -1.12e+72) {
tmp = x * z;
} else if (z <= -2.6e-16) {
tmp = t_1;
} else if (z <= 7.5) {
tmp = x;
} else if ((z <= 2.2e+108) || (!(z <= 1.65e+184) && (z <= 4.4e+229))) {
tmp = t_1;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -1.12e+72: tmp = x * z elif z <= -2.6e-16: tmp = t_1 elif z <= 7.5: tmp = x elif (z <= 2.2e+108) or (not (z <= 1.65e+184) and (z <= 4.4e+229)): tmp = t_1 else: tmp = x * z return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -1.12e+72) tmp = Float64(x * z); elseif (z <= -2.6e-16) tmp = t_1; elseif (z <= 7.5) tmp = x; elseif ((z <= 2.2e+108) || (!(z <= 1.65e+184) && (z <= 4.4e+229))) tmp = t_1; else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (z <= -1.12e+72) tmp = x * z; elseif (z <= -2.6e-16) tmp = t_1; elseif (z <= 7.5) tmp = x; elseif ((z <= 2.2e+108) || (~((z <= 1.65e+184)) && (z <= 4.4e+229))) tmp = t_1; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -1.12e+72], N[(x * z), $MachinePrecision], If[LessEqual[z, -2.6e-16], t$95$1, If[LessEqual[z, 7.5], x, If[Or[LessEqual[z, 2.2e+108], And[N[Not[LessEqual[z, 1.65e+184]], $MachinePrecision], LessEqual[z, 4.4e+229]]], t$95$1, N[(x * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -1.12 \cdot 10^{+72}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -2.6 \cdot 10^{-16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 7.5:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+108} \lor \neg \left(z \leq 1.65 \cdot 10^{+184}\right) \land z \leq 4.4 \cdot 10^{+229}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1.12000000000000001e72 or 2.2000000000000001e108 < z < 1.6499999999999999e184 or 4.40000000000000007e229 < z Initial program 100.0%
Taylor expanded in y around 0 89.0%
mul-1-neg89.0%
distribute-lft-neg-out89.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in t around 0 60.6%
Taylor expanded in z around inf 60.6%
if -1.12000000000000001e72 < z < -2.5999999999999998e-16 or 7.5 < z < 2.2000000000000001e108 or 1.6499999999999999e184 < z < 4.40000000000000007e229Initial program 100.0%
Taylor expanded in y around 0 71.2%
mul-1-neg71.2%
distribute-lft-neg-out71.2%
*-commutative71.2%
Simplified71.2%
Taylor expanded in z around 0 71.2%
+-commutative71.2%
mul-1-neg71.2%
unsub-neg71.2%
Simplified71.2%
Taylor expanded in x around 0 54.0%
mul-1-neg54.0%
distribute-rgt-neg-in54.0%
Simplified54.0%
if -2.5999999999999998e-16 < z < 7.5Initial program 100.0%
Taylor expanded in y around 0 44.4%
mul-1-neg44.4%
distribute-lft-neg-out44.4%
*-commutative44.4%
Simplified44.4%
Taylor expanded in z around 0 36.2%
Final simplification48.0%
(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%
+-commutative86.5%
mul-1-neg86.5%
unsub-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 t around 0 100.0%
associate-*r*100.0%
neg-mul-1100.0%
Simplified100.0%
Final simplification83.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.115) (not (<= z 1.45e+29))) (* z (- x t)) (- x (* y (- x t)))))
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 * (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 ((z <= (-0.115d0)) .or. (.not. (z <= 1.45d+29))) then
tmp = z * (x - t)
else
tmp = x - (y * (x - t))
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 * (x - t));
}
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 * (x - t)) 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(x - t))); 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 * (x - t)); 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[(x - t), $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(x - t\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%
+-commutative85.5%
mul-1-neg85.5%
unsub-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 (- x t)))))
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 * (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 ((z <= (-0.105d0)) .or. (.not. (z <= 1.8d+29))) then
tmp = x + (z * (x - t))
else
tmp = x - (y * (x - t))
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 * (x - t));
}
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 * (x - t)) 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(x - t))); 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 * (x - t)); 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[(x - t), $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(x - t\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%
+-commutative85.5%
mul-1-neg85.5%
unsub-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 -1.3e-12) (not (<= z 3.8e-6))) (* z (- x t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.3e-12) || !(z <= 3.8e-6)) {
tmp = z * (x - 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 ((z <= (-1.3d-12)) .or. (.not. (z <= 3.8d-6))) then
tmp = z * (x - 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 ((z <= -1.3e-12) || !(z <= 3.8e-6)) {
tmp = z * (x - t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.3e-12) or not (z <= 3.8e-6): tmp = z * (x - t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.3e-12) || !(z <= 3.8e-6)) tmp = Float64(z * Float64(x - t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.3e-12) || ~((z <= 3.8e-6))) tmp = z * (x - t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.3e-12], N[Not[LessEqual[z, 3.8e-6]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{-12} \lor \neg \left(z \leq 3.8 \cdot 10^{-6}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.29999999999999991e-12 or 3.8e-6 < z Initial program 100.0%
Taylor expanded in y around 0 80.5%
mul-1-neg80.5%
distribute-lft-neg-out80.5%
*-commutative80.5%
Simplified80.5%
Taylor expanded in z around 0 80.5%
+-commutative80.5%
mul-1-neg80.5%
unsub-neg80.5%
Simplified80.5%
Taylor expanded in z around inf 80.5%
if -1.29999999999999991e-12 < z < 3.8e-6Initial program 100.0%
Taylor expanded in y around 0 45.5%
mul-1-neg45.5%
distribute-lft-neg-out45.5%
*-commutative45.5%
Simplified45.5%
Taylor expanded in z around 0 37.0%
Final simplification61.2%
(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%
+-commutative83.3%
mul-1-neg83.3%
unsub-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 t around inf 70.0%
Final simplification77.2%
(FPCore (x y z t) :precision binary64 (if (<= z -1550000000.0) (* x z) (if (<= z 0.019) x (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1550000000.0) {
tmp = x * z;
} else if (z <= 0.019) {
tmp = x;
} 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 <= (-1550000000.0d0)) then
tmp = x * z
else if (z <= 0.019d0) then
tmp = x
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 <= -1550000000.0) {
tmp = x * z;
} else if (z <= 0.019) {
tmp = x;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1550000000.0: tmp = x * z elif z <= 0.019: tmp = x else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1550000000.0) tmp = Float64(x * z); elseif (z <= 0.019) tmp = x; else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1550000000.0) tmp = x * z; elseif (z <= 0.019) tmp = x; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1550000000.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 0.019], x, N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1550000000:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 0.019:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1.55e9 or 0.0189999999999999995 < z Initial program 100.0%
Taylor expanded in y around 0 82.4%
mul-1-neg82.4%
distribute-lft-neg-out82.4%
*-commutative82.4%
Simplified82.4%
Taylor expanded in t around 0 46.1%
Taylor expanded in z around inf 46.0%
if -1.55e9 < z < 0.0189999999999999995Initial program 100.0%
Taylor expanded in y around 0 45.4%
mul-1-neg45.4%
distribute-lft-neg-out45.4%
*-commutative45.4%
Simplified45.4%
Taylor expanded in z around 0 35.1%
Final simplification40.8%
(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))))