
(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 (* (- 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
(let* ((t_1 (+ x (* (- y z) t))))
(if (<= t -7.5e-129)
t_1
(if (<= t 1.2e-219)
(- x (* x y))
(if (<= t 8.1e-84) (+ x (* x z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x + ((y - z) * t);
double tmp;
if (t <= -7.5e-129) {
tmp = t_1;
} else if (t <= 1.2e-219) {
tmp = x - (x * y);
} else if (t <= 8.1e-84) {
tmp = x + (x * z);
} 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 - z) * t)
if (t <= (-7.5d-129)) then
tmp = t_1
else if (t <= 1.2d-219) then
tmp = x - (x * y)
else if (t <= 8.1d-84) then
tmp = x + (x * z)
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 - z) * t);
double tmp;
if (t <= -7.5e-129) {
tmp = t_1;
} else if (t <= 1.2e-219) {
tmp = x - (x * y);
} else if (t <= 8.1e-84) {
tmp = x + (x * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((y - z) * t) tmp = 0 if t <= -7.5e-129: tmp = t_1 elif t <= 1.2e-219: tmp = x - (x * y) elif t <= 8.1e-84: tmp = x + (x * z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(y - z) * t)) tmp = 0.0 if (t <= -7.5e-129) tmp = t_1; elseif (t <= 1.2e-219) tmp = Float64(x - Float64(x * y)); elseif (t <= 8.1e-84) tmp = Float64(x + Float64(x * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + ((y - z) * t); tmp = 0.0; if (t <= -7.5e-129) tmp = t_1; elseif (t <= 1.2e-219) tmp = x - (x * y); elseif (t <= 8.1e-84) tmp = x + (x * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -7.5e-129], t$95$1, If[LessEqual[t, 1.2e-219], N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.1e-84], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -7.5 \cdot 10^{-129}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{-219}:\\
\;\;\;\;x - x \cdot y\\
\mathbf{elif}\;t \leq 8.1 \cdot 10^{-84}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -7.49999999999999944e-129 or 8.0999999999999997e-84 < t Initial program 100.0%
Taylor expanded in t around inf 80.1%
if -7.49999999999999944e-129 < t < 1.20000000000000007e-219Initial program 100.0%
Taylor expanded in y around inf 84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in x around inf 79.0%
distribute-lft-in79.0%
*-rgt-identity79.0%
mul-1-neg79.0%
distribute-rgt-neg-in79.0%
unsub-neg79.0%
Simplified79.0%
if 1.20000000000000007e-219 < t < 8.0999999999999997e-84Initial program 100.0%
Taylor expanded in y around 0 78.5%
mul-1-neg78.5%
distribute-lft-neg-out78.5%
*-commutative78.5%
Simplified78.5%
Taylor expanded in t around 0 78.0%
Final simplification79.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* y t))))
(if (<= t -9e-15)
t_1
(if (<= t 4.7e-220)
(- x (* x y))
(if (<= t 2.7e+59) (+ x (* x z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x + (y * t);
double tmp;
if (t <= -9e-15) {
tmp = t_1;
} else if (t <= 4.7e-220) {
tmp = x - (x * y);
} else if (t <= 2.7e+59) {
tmp = x + (x * z);
} 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 <= (-9d-15)) then
tmp = t_1
else if (t <= 4.7d-220) then
tmp = x - (x * y)
else if (t <= 2.7d+59) then
tmp = x + (x * z)
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 <= -9e-15) {
tmp = t_1;
} else if (t <= 4.7e-220) {
tmp = x - (x * y);
} else if (t <= 2.7e+59) {
tmp = x + (x * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (y * t) tmp = 0 if t <= -9e-15: tmp = t_1 elif t <= 4.7e-220: tmp = x - (x * y) elif t <= 2.7e+59: tmp = x + (x * z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(y * t)) tmp = 0.0 if (t <= -9e-15) tmp = t_1; elseif (t <= 4.7e-220) tmp = Float64(x - Float64(x * y)); elseif (t <= 2.7e+59) tmp = Float64(x + Float64(x * z)); 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 <= -9e-15) tmp = t_1; elseif (t <= 4.7e-220) tmp = x - (x * y); elseif (t <= 2.7e+59) tmp = x + (x * z); 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, -9e-15], t$95$1, If[LessEqual[t, 4.7e-220], N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.7e+59], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot t\\
\mathbf{if}\;t \leq -9 \cdot 10^{-15}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 4.7 \cdot 10^{-220}:\\
\;\;\;\;x - x \cdot y\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{+59}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -8.9999999999999995e-15 or 2.7000000000000001e59 < t Initial program 100.0%
Taylor expanded in y around inf 57.1%
*-commutative57.1%
Simplified57.1%
Taylor expanded in t around inf 49.7%
*-commutative49.7%
Simplified49.7%
if -8.9999999999999995e-15 < t < 4.7000000000000003e-220Initial program 100.0%
Taylor expanded in y around inf 77.0%
*-commutative77.0%
Simplified77.0%
Taylor expanded in x around inf 67.8%
distribute-lft-in67.8%
*-rgt-identity67.8%
mul-1-neg67.8%
distribute-rgt-neg-in67.8%
unsub-neg67.8%
Simplified67.8%
if 4.7000000000000003e-220 < t < 2.7000000000000001e59Initial program 100.0%
Taylor expanded in y around 0 71.0%
mul-1-neg71.0%
distribute-lft-neg-out71.0%
*-commutative71.0%
Simplified71.0%
Taylor expanded in t around 0 55.2%
Final simplification56.4%
(FPCore (x y z t)
:precision binary64
(if (<= t -1.36e-14)
(+ x (* y t))
(if (<= t 2.8e-221)
(- x (* x y))
(if (<= t 1e-60) (+ x (* x z)) (- x (* z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.36e-14) {
tmp = x + (y * t);
} else if (t <= 2.8e-221) {
tmp = x - (x * y);
} else if (t <= 1e-60) {
tmp = x + (x * z);
} 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) :: tmp
if (t <= (-1.36d-14)) then
tmp = x + (y * t)
else if (t <= 2.8d-221) then
tmp = x - (x * y)
else if (t <= 1d-60) then
tmp = x + (x * z)
else
tmp = x - (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.36e-14) {
tmp = x + (y * t);
} else if (t <= 2.8e-221) {
tmp = x - (x * y);
} else if (t <= 1e-60) {
tmp = x + (x * z);
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.36e-14: tmp = x + (y * t) elif t <= 2.8e-221: tmp = x - (x * y) elif t <= 1e-60: tmp = x + (x * z) else: tmp = x - (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.36e-14) tmp = Float64(x + Float64(y * t)); elseif (t <= 2.8e-221) tmp = Float64(x - Float64(x * y)); elseif (t <= 1e-60) tmp = Float64(x + Float64(x * z)); else tmp = Float64(x - Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.36e-14) tmp = x + (y * t); elseif (t <= 2.8e-221) tmp = x - (x * y); elseif (t <= 1e-60) tmp = x + (x * z); else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.36e-14], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.8e-221], N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e-60], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.36 \cdot 10^{-14}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{-221}:\\
\;\;\;\;x - x \cdot y\\
\mathbf{elif}\;t \leq 10^{-60}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if t < -1.36e-14Initial program 100.0%
Taylor expanded in y around inf 65.3%
*-commutative65.3%
Simplified65.3%
Taylor expanded in t around inf 57.2%
*-commutative57.2%
Simplified57.2%
if -1.36e-14 < t < 2.80000000000000019e-221Initial program 100.0%
Taylor expanded in y around inf 77.0%
*-commutative77.0%
Simplified77.0%
Taylor expanded in x around inf 67.8%
distribute-lft-in67.8%
*-rgt-identity67.8%
mul-1-neg67.8%
distribute-rgt-neg-in67.8%
unsub-neg67.8%
Simplified67.8%
if 2.80000000000000019e-221 < t < 9.9999999999999997e-61Initial program 100.0%
Taylor expanded in y around 0 70.7%
mul-1-neg70.7%
distribute-lft-neg-out70.7%
*-commutative70.7%
Simplified70.7%
Taylor expanded in t around 0 67.0%
if 9.9999999999999997e-61 < t Initial program 100.0%
Taylor expanded in t around inf 84.6%
Taylor expanded in y around 0 59.8%
mul-1-neg59.8%
unsub-neg59.8%
*-commutative59.8%
Simplified59.8%
Final simplification62.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.9e-16) (not (<= x 2.4e-78))) (- x (* x (- y z))) (+ x (* t (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.9e-16) || !(x <= 2.4e-78)) {
tmp = x - (x * (y - z));
} else {
tmp = x + (t * (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 ((x <= (-3.9d-16)) .or. (.not. (x <= 2.4d-78))) then
tmp = x - (x * (y - z))
else
tmp = x + (t * (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.9e-16) || !(x <= 2.4e-78)) {
tmp = x - (x * (y - z));
} else {
tmp = x + (t * (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.9e-16) or not (x <= 2.4e-78): tmp = x - (x * (y - z)) else: tmp = x + (t * (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.9e-16) || !(x <= 2.4e-78)) tmp = Float64(x - Float64(x * Float64(y - z))); else tmp = Float64(x + Float64(t * Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.9e-16) || ~((x <= 2.4e-78))) tmp = x - (x * (y - z)); else tmp = x + (t * (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.9e-16], N[Not[LessEqual[x, 2.4e-78]], $MachinePrecision]], N[(x - N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{-16} \lor \neg \left(x \leq 2.4 \cdot 10^{-78}\right):\\
\;\;\;\;x - x \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \left(y - z\right)\\
\end{array}
\end{array}
if x < -3.89999999999999977e-16 or 2.4e-78 < x Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in95.2%
Applied egg-rr95.2%
Taylor expanded in t around 0 74.5%
mul-1-neg74.5%
distribute-rgt-neg-in74.5%
mul-1-neg74.5%
distribute-lft-in77.9%
+-commutative77.9%
mul-1-neg77.9%
sub-neg77.9%
Simplified77.9%
if -3.89999999999999977e-16 < x < 2.4e-78Initial program 100.0%
Taylor expanded in t around inf 92.5%
Final simplification84.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5e+40) (not (<= z 53.0))) (+ x (* z (- x t))) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5e+40) || !(z <= 53.0)) {
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 <= (-5d+40)) .or. (.not. (z <= 53.0d0))) 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 <= -5e+40) || !(z <= 53.0)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5e+40) or not (z <= 53.0): tmp = x + (z * (x - t)) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5e+40) || !(z <= 53.0)) 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 <= -5e+40) || ~((z <= 53.0))) 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, -5e+40], N[Not[LessEqual[z, 53.0]], $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 -5 \cdot 10^{+40} \lor \neg \left(z \leq 53\right):\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -5.00000000000000003e40 or 53 < z Initial program 100.0%
Taylor expanded in y around 0 81.4%
mul-1-neg81.4%
distribute-lft-neg-out81.4%
*-commutative81.4%
Simplified81.4%
if -5.00000000000000003e40 < z < 53Initial program 100.0%
Taylor expanded in y around inf 91.4%
*-commutative91.4%
Simplified91.4%
Final simplification86.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.75e+88) (not (<= x 2.4e-78))) (+ x (* x z)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.75e+88) || !(x <= 2.4e-78)) {
tmp = x + (x * z);
} 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 ((x <= (-1.75d+88)) .or. (.not. (x <= 2.4d-78))) then
tmp = x + (x * z)
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 ((x <= -1.75e+88) || !(x <= 2.4e-78)) {
tmp = x + (x * z);
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.75e+88) or not (x <= 2.4e-78): tmp = x + (x * z) else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.75e+88) || !(x <= 2.4e-78)) tmp = Float64(x + Float64(x * z)); else tmp = Float64(x + Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.75e+88) || ~((x <= 2.4e-78))) tmp = x + (x * z); else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.75e+88], N[Not[LessEqual[x, 2.4e-78]], $MachinePrecision]], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+88} \lor \neg \left(x \leq 2.4 \cdot 10^{-78}\right):\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if x < -1.7499999999999999e88 or 2.4e-78 < x Initial program 100.0%
Taylor expanded in y around 0 60.0%
mul-1-neg60.0%
distribute-lft-neg-out60.0%
*-commutative60.0%
Simplified60.0%
Taylor expanded in t around 0 50.3%
if -1.7499999999999999e88 < x < 2.4e-78Initial program 100.0%
Taylor expanded in y around inf 58.2%
*-commutative58.2%
Simplified58.2%
Taylor expanded in t around inf 49.5%
*-commutative49.5%
Simplified49.5%
Final simplification49.9%
(FPCore (x y z t) :precision binary64 (if (<= z -1250000000.0) (* x z) (if (<= z 1.0) x (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1250000000.0) {
tmp = x * z;
} else if (z <= 1.0) {
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 <= (-1250000000.0d0)) then
tmp = x * z
else if (z <= 1.0d0) 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 <= -1250000000.0) {
tmp = x * z;
} else if (z <= 1.0) {
tmp = x;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1250000000.0: tmp = x * z elif z <= 1.0: tmp = x else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1250000000.0) tmp = Float64(x * z); elseif (z <= 1.0) tmp = x; else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1250000000.0) tmp = x * z; elseif (z <= 1.0) tmp = x; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1250000000.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 1.0], x, N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1250000000:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1.25e9 or 1 < z Initial program 100.0%
Taylor expanded in y around 0 79.4%
mul-1-neg79.4%
distribute-lft-neg-out79.4%
*-commutative79.4%
Simplified79.4%
Taylor expanded in t around 0 35.6%
Taylor expanded in z around inf 35.6%
*-commutative35.6%
Simplified35.6%
if -1.25e9 < z < 1Initial program 100.0%
Taylor expanded in t around inf 72.9%
Taylor expanded in x around inf 25.5%
Final simplification30.5%
(FPCore (x y z t) :precision binary64 (+ x (* x z)))
double code(double x, double y, double z, double t) {
return x + (x * 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 + (x * z)
end function
public static double code(double x, double y, double z, double t) {
return x + (x * z);
}
def code(x, y, z, t): return x + (x * z)
function code(x, y, z, t) return Float64(x + Float64(x * z)) end
function tmp = code(x, y, z, t) tmp = x + (x * z); end
code[x_, y_, z_, t_] := N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + x \cdot z
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 55.9%
mul-1-neg55.9%
distribute-lft-neg-out55.9%
*-commutative55.9%
Simplified55.9%
Taylor expanded in t around 0 30.7%
Final simplification30.7%
(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 66.0%
Taylor expanded in x around inf 14.0%
Final simplification14.0%
(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 2023290
(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))))