
(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 (fma (- y z) (- t x) x))
double code(double x, double y, double z, double t) {
return fma((y - z), (t - x), x);
}
function code(x, y, z, t) return fma(Float64(y - z), Float64(t - x), x) end
code[x_, y_, z_, t_] := N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - z, t - x, x\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))) (t_2 (* z (- t))))
(if (<= y -8e-50)
t_1
(if (<= y 2.5e-193)
t_2
(if (<= y 3.5e-83) x (if (<= y 2.05e-19) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double t_2 = z * -t;
double tmp;
if (y <= -8e-50) {
tmp = t_1;
} else if (y <= 2.5e-193) {
tmp = t_2;
} else if (y <= 3.5e-83) {
tmp = x;
} else if (y <= 2.05e-19) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = y * (t - x)
t_2 = z * -t
if (y <= (-8d-50)) then
tmp = t_1
else if (y <= 2.5d-193) then
tmp = t_2
else if (y <= 3.5d-83) then
tmp = x
else if (y <= 2.05d-19) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double t_2 = z * -t;
double tmp;
if (y <= -8e-50) {
tmp = t_1;
} else if (y <= 2.5e-193) {
tmp = t_2;
} else if (y <= 3.5e-83) {
tmp = x;
} else if (y <= 2.05e-19) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) t_2 = z * -t tmp = 0 if y <= -8e-50: tmp = t_1 elif y <= 2.5e-193: tmp = t_2 elif y <= 3.5e-83: tmp = x elif y <= 2.05e-19: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) t_2 = Float64(z * Float64(-t)) tmp = 0.0 if (y <= -8e-50) tmp = t_1; elseif (y <= 2.5e-193) tmp = t_2; elseif (y <= 3.5e-83) tmp = x; elseif (y <= 2.05e-19) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); t_2 = z * -t; tmp = 0.0; if (y <= -8e-50) tmp = t_1; elseif (y <= 2.5e-193) tmp = t_2; elseif (y <= 3.5e-83) tmp = x; elseif (y <= 2.05e-19) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[y, -8e-50], t$95$1, If[LessEqual[y, 2.5e-193], t$95$2, If[LessEqual[y, 3.5e-83], x, If[LessEqual[y, 2.05e-19], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
t_2 := z \cdot \left(-t\right)\\
\mathbf{if}\;y \leq -8 \cdot 10^{-50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-193}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{-83}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{-19}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -8.00000000000000006e-50 or 2.04999999999999993e-19 < y Initial program 99.9%
Taylor expanded in y around inf 75.3%
*-commutative75.3%
Simplified75.3%
Taylor expanded in y around inf 71.6%
if -8.00000000000000006e-50 < y < 2.5000000000000002e-193 or 3.5000000000000003e-83 < y < 2.04999999999999993e-19Initial program 100.0%
Taylor expanded in y around 0 95.9%
mul-1-neg95.9%
unsub-neg95.9%
Simplified95.9%
Taylor expanded in x around 0 42.3%
mul-1-neg42.3%
distribute-rgt-neg-in42.3%
Simplified42.3%
if 2.5000000000000002e-193 < y < 3.5000000000000003e-83Initial program 99.9%
Taylor expanded in t around inf 86.9%
Taylor expanded in x around inf 62.1%
Final simplification60.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))))
(if (<= z -2.25e+23)
t_1
(if (<= z -6.2e-65)
(* y (- t x))
(if (<= z 2.7e+21) (+ x (* 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.25e+23) {
tmp = t_1;
} else if (z <= -6.2e-65) {
tmp = y * (t - x);
} else if (z <= 2.7e+21) {
tmp = x + (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.25d+23)) then
tmp = t_1
else if (z <= (-6.2d-65)) then
tmp = y * (t - x)
else if (z <= 2.7d+21) then
tmp = x + (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.25e+23) {
tmp = t_1;
} else if (z <= -6.2e-65) {
tmp = y * (t - x);
} else if (z <= 2.7e+21) {
tmp = x + (y * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -2.25e+23: tmp = t_1 elif z <= -6.2e-65: tmp = y * (t - x) elif z <= 2.7e+21: tmp = x + (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.25e+23) tmp = t_1; elseif (z <= -6.2e-65) tmp = Float64(y * Float64(t - x)); elseif (z <= 2.7e+21) tmp = Float64(x + 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.25e+23) tmp = t_1; elseif (z <= -6.2e-65) tmp = y * (t - x); elseif (z <= 2.7e+21) tmp = x + (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.25e+23], t$95$1, If[LessEqual[z, -6.2e-65], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.7e+21], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -2.25 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -6.2 \cdot 10^{-65}:\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+21}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.2499999999999999e23 or 2.7e21 < z Initial program 100.0%
Taylor expanded in y around 0 85.6%
mul-1-neg85.6%
unsub-neg85.6%
Simplified85.6%
Taylor expanded in x around 0 82.5%
neg-mul-182.5%
*-commutative82.5%
Simplified82.5%
Taylor expanded in z around inf 85.6%
if -2.2499999999999999e23 < z < -6.20000000000000032e-65Initial program 100.0%
Taylor expanded in y around inf 87.7%
*-commutative87.7%
Simplified87.7%
Taylor expanded in y around inf 81.5%
if -6.20000000000000032e-65 < z < 2.7e21Initial program 100.0%
Taylor expanded in t around inf 78.3%
Taylor expanded in y around inf 73.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -3.35e+19)
t_1
(if (<= z -1.65e-143) (* y (- x)) (if (<= z 8.5e-20) x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -3.35e+19) {
tmp = t_1;
} else if (z <= -1.65e-143) {
tmp = y * -x;
} else if (z <= 8.5e-20) {
tmp = 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 = z * -t
if (z <= (-3.35d+19)) then
tmp = t_1
else if (z <= (-1.65d-143)) then
tmp = y * -x
else if (z <= 8.5d-20) then
tmp = 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 = z * -t;
double tmp;
if (z <= -3.35e+19) {
tmp = t_1;
} else if (z <= -1.65e-143) {
tmp = y * -x;
} else if (z <= 8.5e-20) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -3.35e+19: tmp = t_1 elif z <= -1.65e-143: tmp = y * -x elif z <= 8.5e-20: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -3.35e+19) tmp = t_1; elseif (z <= -1.65e-143) tmp = Float64(y * Float64(-x)); elseif (z <= 8.5e-20) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (z <= -3.35e+19) tmp = t_1; elseif (z <= -1.65e-143) tmp = y * -x; elseif (z <= 8.5e-20) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -3.35e+19], t$95$1, If[LessEqual[z, -1.65e-143], N[(y * (-x)), $MachinePrecision], If[LessEqual[z, 8.5e-20], x, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -3.35 \cdot 10^{+19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.65 \cdot 10^{-143}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-20}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.35e19 or 8.5000000000000005e-20 < z Initial program 100.0%
Taylor expanded in y around 0 83.0%
mul-1-neg83.0%
unsub-neg83.0%
Simplified83.0%
Taylor expanded in x around 0 43.1%
mul-1-neg43.1%
distribute-rgt-neg-in43.1%
Simplified43.1%
if -3.35e19 < z < -1.65e-143Initial program 100.0%
Taylor expanded in t around 0 62.1%
mul-1-neg62.1%
distribute-rgt-neg-in62.1%
sub-neg62.1%
+-commutative62.1%
distribute-neg-in62.1%
remove-double-neg62.1%
sub-neg62.1%
Simplified62.1%
Taylor expanded in z around 0 62.1%
mul-1-neg62.1%
unsub-neg62.1%
Simplified62.1%
Taylor expanded in y around inf 41.8%
mul-1-neg41.8%
distribute-rgt-neg-out41.8%
Simplified41.8%
if -1.65e-143 < z < 8.5000000000000005e-20Initial program 99.9%
Taylor expanded in t around inf 80.5%
Taylor expanded in x around inf 41.1%
Final simplification42.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.1e+21) (not (<= z 7e+27))) (* z (- x t)) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.1e+21) || !(z <= 7e+27)) {
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 <= (-4.1d+21)) .or. (.not. (z <= 7d+27))) 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 <= -4.1e+21) || !(z <= 7e+27)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.1e+21) or not (z <= 7e+27): tmp = z * (x - t) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.1e+21) || !(z <= 7e+27)) 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 <= -4.1e+21) || ~((z <= 7e+27))) tmp = z * (x - t); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.1e+21], N[Not[LessEqual[z, 7e+27]], $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 -4.1 \cdot 10^{+21} \lor \neg \left(z \leq 7 \cdot 10^{+27}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -4.1e21 or 7.0000000000000004e27 < z Initial program 100.0%
Taylor expanded in y around 0 85.6%
mul-1-neg85.6%
unsub-neg85.6%
Simplified85.6%
Taylor expanded in x around 0 82.5%
neg-mul-182.5%
*-commutative82.5%
Simplified82.5%
Taylor expanded in z around inf 85.6%
if -4.1e21 < z < 7.0000000000000004e27Initial program 100.0%
Taylor expanded in y around inf 92.6%
*-commutative92.6%
Simplified92.6%
Final simplification89.1%
(FPCore (x y z t) :precision binary64 (if (<= z -4.2e+18) (* z (- x t)) (if (<= z 1.4e+25) (+ x (* y (- t x))) (- (* z x) (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.2e+18) {
tmp = z * (x - t);
} else if (z <= 1.4e+25) {
tmp = x + (y * (t - x));
} else {
tmp = (z * 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 (z <= (-4.2d+18)) then
tmp = z * (x - t)
else if (z <= 1.4d+25) then
tmp = x + (y * (t - x))
else
tmp = (z * x) - (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.2e+18) {
tmp = z * (x - t);
} else if (z <= 1.4e+25) {
tmp = x + (y * (t - x));
} else {
tmp = (z * x) - (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.2e+18: tmp = z * (x - t) elif z <= 1.4e+25: tmp = x + (y * (t - x)) else: tmp = (z * x) - (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.2e+18) tmp = Float64(z * Float64(x - t)); elseif (z <= 1.4e+25) tmp = Float64(x + Float64(y * Float64(t - x))); else tmp = Float64(Float64(z * x) - Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.2e+18) tmp = z * (x - t); elseif (z <= 1.4e+25) tmp = x + (y * (t - x)); else tmp = (z * x) - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.2e+18], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e+25], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * x), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+18}:\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+25}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot x - z \cdot t\\
\end{array}
\end{array}
if z < -4.2e18Initial program 100.0%
Taylor expanded in y around 0 81.4%
mul-1-neg81.4%
unsub-neg81.4%
Simplified81.4%
Taylor expanded in x around 0 75.7%
neg-mul-175.7%
*-commutative75.7%
Simplified75.7%
Taylor expanded in z around inf 81.4%
if -4.2e18 < z < 1.4000000000000001e25Initial program 100.0%
Taylor expanded in y around inf 92.6%
*-commutative92.6%
Simplified92.6%
if 1.4000000000000001e25 < z Initial program 99.9%
Taylor expanded in y around 0 91.0%
mul-1-neg91.0%
unsub-neg91.0%
Simplified91.0%
Taylor expanded in x around 0 91.0%
neg-mul-191.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in z around inf 91.0%
*-commutative91.0%
Simplified91.0%
Final simplification89.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.2e+20) (not (<= z 6400000000000.0))) (* z (- x t)) (* y (- t x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.2e+20) || !(z <= 6400000000000.0)) {
tmp = z * (x - t);
} else {
tmp = 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 <= (-1.2d+20)) .or. (.not. (z <= 6400000000000.0d0))) then
tmp = z * (x - t)
else
tmp = 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 <= -1.2e+20) || !(z <= 6400000000000.0)) {
tmp = z * (x - t);
} else {
tmp = y * (t - x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.2e+20) or not (z <= 6400000000000.0): tmp = z * (x - t) else: tmp = y * (t - x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.2e+20) || !(z <= 6400000000000.0)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(y * Float64(t - x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.2e+20) || ~((z <= 6400000000000.0))) tmp = z * (x - t); else tmp = y * (t - x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.2e+20], N[Not[LessEqual[z, 6400000000000.0]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+20} \lor \neg \left(z \leq 6400000000000\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -1.2e20 or 6.4e12 < z Initial program 100.0%
Taylor expanded in y around 0 85.1%
mul-1-neg85.1%
unsub-neg85.1%
Simplified85.1%
Taylor expanded in x around 0 82.1%
neg-mul-182.1%
*-commutative82.1%
Simplified82.1%
Taylor expanded in z around inf 85.1%
if -1.2e20 < z < 6.4e12Initial program 100.0%
Taylor expanded in y around inf 93.2%
*-commutative93.2%
Simplified93.2%
Taylor expanded in y around inf 59.8%
Final simplification72.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.7e-30) (not (<= z 1e-16))) (* z (- t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.7e-30) || !(z <= 1e-16)) {
tmp = z * -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 <= (-2.7d-30)) .or. (.not. (z <= 1d-16))) then
tmp = z * -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 <= -2.7e-30) || !(z <= 1e-16)) {
tmp = z * -t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.7e-30) or not (z <= 1e-16): tmp = z * -t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.7e-30) || !(z <= 1e-16)) tmp = Float64(z * Float64(-t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.7e-30) || ~((z <= 1e-16))) tmp = z * -t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.7e-30], N[Not[LessEqual[z, 1e-16]], $MachinePrecision]], N[(z * (-t)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{-30} \lor \neg \left(z \leq 10^{-16}\right):\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.69999999999999987e-30 or 9.9999999999999998e-17 < z Initial program 100.0%
Taylor expanded in y around 0 78.4%
mul-1-neg78.4%
unsub-neg78.4%
Simplified78.4%
Taylor expanded in x around 0 41.5%
mul-1-neg41.5%
distribute-rgt-neg-in41.5%
Simplified41.5%
if -2.69999999999999987e-30 < z < 9.9999999999999998e-17Initial program 100.0%
Taylor expanded in t around inf 79.1%
Taylor expanded in x around inf 39.5%
Final simplification40.7%
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Initial program 100.0%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in t around inf 64.8%
Taylor expanded in x around inf 18.6%
(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 2024139
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:alt
(! :herbie-platform default (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
(+ x (* (- y z) (- t x))))