
(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 13 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
(if (<= z -5.4e+20)
(* z (- x t))
(if (<= z 8.2e-166)
(+ x (* y (- t x)))
(if (<= z 1.4e+64) (+ x (* (- y z) t)) (- x (* z (- t x)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.4e+20) {
tmp = z * (x - t);
} else if (z <= 8.2e-166) {
tmp = x + (y * (t - x));
} else if (z <= 1.4e+64) {
tmp = x + ((y - z) * t);
} else {
tmp = x - (z * (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 <= (-5.4d+20)) then
tmp = z * (x - t)
else if (z <= 8.2d-166) then
tmp = x + (y * (t - x))
else if (z <= 1.4d+64) then
tmp = x + ((y - z) * t)
else
tmp = x - (z * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.4e+20) {
tmp = z * (x - t);
} else if (z <= 8.2e-166) {
tmp = x + (y * (t - x));
} else if (z <= 1.4e+64) {
tmp = x + ((y - z) * t);
} else {
tmp = x - (z * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.4e+20: tmp = z * (x - t) elif z <= 8.2e-166: tmp = x + (y * (t - x)) elif z <= 1.4e+64: tmp = x + ((y - z) * t) else: tmp = x - (z * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.4e+20) tmp = Float64(z * Float64(x - t)); elseif (z <= 8.2e-166) tmp = Float64(x + Float64(y * Float64(t - x))); elseif (z <= 1.4e+64) tmp = Float64(x + Float64(Float64(y - z) * t)); else tmp = Float64(x - Float64(z * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.4e+20) tmp = z * (x - t); elseif (z <= 8.2e-166) tmp = x + (y * (t - x)); elseif (z <= 1.4e+64) tmp = x + ((y - z) * t); else tmp = x - (z * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.4e+20], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.2e-166], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e+64], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{+20}:\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-166}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+64}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -5.4e20Initial program 100.0%
Taylor expanded in y around 0 84.9%
mul-1-neg84.9%
unsub-neg84.9%
Simplified84.9%
Taylor expanded in x around 0 83.0%
fma-neg84.9%
neg-mul-184.9%
distribute-rgt-neg-out84.9%
Simplified84.9%
Taylor expanded in z around inf 84.9%
mul-1-neg84.9%
unsub-neg84.9%
Simplified84.9%
if -5.4e20 < z < 8.1999999999999995e-166Initial program 100.0%
Taylor expanded in y around inf 91.8%
*-commutative91.8%
Simplified91.8%
if 8.1999999999999995e-166 < z < 1.40000000000000012e64Initial program 100.0%
Taylor expanded in t around inf 79.1%
if 1.40000000000000012e64 < z Initial program 99.9%
Taylor expanded in y around 0 93.3%
mul-1-neg93.3%
unsub-neg93.3%
Simplified93.3%
Final simplification88.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))))
(if (<= z -6e+18)
t_1
(if (<= z 1.06e-165)
(+ x (* y (- t x)))
(if (<= z 1.08e+64) (+ x (* (- y z) t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -6e+18) {
tmp = t_1;
} else if (z <= 1.06e-165) {
tmp = x + (y * (t - x));
} else if (z <= 1.08e+64) {
tmp = x + ((y - z) * 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 <= (-6d+18)) then
tmp = t_1
else if (z <= 1.06d-165) then
tmp = x + (y * (t - x))
else if (z <= 1.08d+64) then
tmp = x + ((y - z) * 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 <= -6e+18) {
tmp = t_1;
} else if (z <= 1.06e-165) {
tmp = x + (y * (t - x));
} else if (z <= 1.08e+64) {
tmp = x + ((y - z) * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -6e+18: tmp = t_1 elif z <= 1.06e-165: tmp = x + (y * (t - x)) elif z <= 1.08e+64: tmp = x + ((y - z) * 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 <= -6e+18) tmp = t_1; elseif (z <= 1.06e-165) tmp = Float64(x + Float64(y * Float64(t - x))); elseif (z <= 1.08e+64) tmp = Float64(x + Float64(Float64(y - z) * 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 <= -6e+18) tmp = t_1; elseif (z <= 1.06e-165) tmp = x + (y * (t - x)); elseif (z <= 1.08e+64) tmp = x + ((y - z) * 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, -6e+18], t$95$1, If[LessEqual[z, 1.06e-165], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.08e+64], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -6 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{-165}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{elif}\;z \leq 1.08 \cdot 10^{+64}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6e18 or 1.08000000000000007e64 < z Initial program 100.0%
Taylor expanded in y around 0 89.3%
mul-1-neg89.3%
unsub-neg89.3%
Simplified89.3%
Taylor expanded in x around 0 86.7%
fma-neg89.3%
neg-mul-189.3%
distribute-rgt-neg-out89.3%
Simplified89.3%
Taylor expanded in z around inf 89.3%
mul-1-neg89.3%
unsub-neg89.3%
Simplified89.3%
if -6e18 < z < 1.05999999999999999e-165Initial program 100.0%
Taylor expanded in y around inf 91.8%
*-commutative91.8%
Simplified91.8%
if 1.05999999999999999e-165 < z < 1.08000000000000007e64Initial program 100.0%
Taylor expanded in t around inf 79.1%
Final simplification88.3%
(FPCore (x y z t) :precision binary64 (if (<= x -7e+239) (* y (- x)) (if (or (<= x -6e-98) (not (<= x 1.9e-43))) (* x (+ z 1.0)) (* z (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7e+239) {
tmp = y * -x;
} else if ((x <= -6e-98) || !(x <= 1.9e-43)) {
tmp = x * (z + 1.0);
} else {
tmp = 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 (x <= (-7d+239)) then
tmp = y * -x
else if ((x <= (-6d-98)) .or. (.not. (x <= 1.9d-43))) then
tmp = x * (z + 1.0d0)
else
tmp = z * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7e+239) {
tmp = y * -x;
} else if ((x <= -6e-98) || !(x <= 1.9e-43)) {
tmp = x * (z + 1.0);
} else {
tmp = z * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7e+239: tmp = y * -x elif (x <= -6e-98) or not (x <= 1.9e-43): tmp = x * (z + 1.0) else: tmp = z * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7e+239) tmp = Float64(y * Float64(-x)); elseif ((x <= -6e-98) || !(x <= 1.9e-43)) tmp = Float64(x * Float64(z + 1.0)); else tmp = Float64(z * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7e+239) tmp = y * -x; elseif ((x <= -6e-98) || ~((x <= 1.9e-43))) tmp = x * (z + 1.0); else tmp = z * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7e+239], N[(y * (-x)), $MachinePrecision], If[Or[LessEqual[x, -6e-98], N[Not[LessEqual[x, 1.9e-43]], $MachinePrecision]], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(z * (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{+239}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{elif}\;x \leq -6 \cdot 10^{-98} \lor \neg \left(x \leq 1.9 \cdot 10^{-43}\right):\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\end{array}
\end{array}
if x < -7.0000000000000003e239Initial program 100.0%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 89.2%
mul-1-neg89.2%
Simplified89.2%
if -7.0000000000000003e239 < x < -6e-98 or 1.89999999999999985e-43 < x Initial program 100.0%
Taylor expanded in x around inf 68.4%
mul-1-neg68.4%
unsub-neg68.4%
Simplified68.4%
Taylor expanded in y around 0 45.9%
+-commutative45.9%
Simplified45.9%
if -6e-98 < x < 1.89999999999999985e-43Initial program 100.0%
Taylor expanded in y around 0 64.5%
mul-1-neg64.5%
unsub-neg64.5%
Simplified64.5%
Taylor expanded in t around inf 57.5%
Taylor expanded in x around 0 53.2%
mul-1-neg53.2%
*-commutative53.2%
distribute-rgt-neg-out53.2%
Simplified53.2%
Final simplification50.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -2e+16)
t_1
(if (<= z 1.2e+64) (* x (- 1.0 y)) (if (<= z 5e+140) (* z x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -2e+16) {
tmp = t_1;
} else if (z <= 1.2e+64) {
tmp = x * (1.0 - y);
} else if (z <= 5e+140) {
tmp = z * 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 <= (-2d+16)) then
tmp = t_1
else if (z <= 1.2d+64) then
tmp = x * (1.0d0 - y)
else if (z <= 5d+140) then
tmp = z * 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 <= -2e+16) {
tmp = t_1;
} else if (z <= 1.2e+64) {
tmp = x * (1.0 - y);
} else if (z <= 5e+140) {
tmp = z * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -2e+16: tmp = t_1 elif z <= 1.2e+64: tmp = x * (1.0 - y) elif z <= 5e+140: tmp = z * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -2e+16) tmp = t_1; elseif (z <= 1.2e+64) tmp = Float64(x * Float64(1.0 - y)); elseif (z <= 5e+140) tmp = Float64(z * 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 <= -2e+16) tmp = t_1; elseif (z <= 1.2e+64) tmp = x * (1.0 - y); elseif (z <= 5e+140) tmp = z * 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, -2e+16], t$95$1, If[LessEqual[z, 1.2e+64], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e+140], N[(z * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -2 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+64}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+140}:\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2e16 or 5.00000000000000008e140 < z Initial program 100.0%
Taylor expanded in y around 0 87.0%
mul-1-neg87.0%
unsub-neg87.0%
Simplified87.0%
Taylor expanded in t around inf 58.1%
Taylor expanded in x around 0 58.0%
mul-1-neg58.0%
*-commutative58.0%
distribute-rgt-neg-out58.0%
Simplified58.0%
if -2e16 < z < 1.2e64Initial program 100.0%
Taylor expanded in x around inf 45.9%
mul-1-neg45.9%
unsub-neg45.9%
Simplified45.9%
Taylor expanded in z around 0 44.8%
if 1.2e64 < z < 5.00000000000000008e140Initial program 100.0%
Taylor expanded in x around inf 76.3%
mul-1-neg76.3%
unsub-neg76.3%
Simplified76.3%
Taylor expanded in z around inf 76.3%
Final simplification52.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.8e+15) (not (<= z 1.08e+64))) (* z (- x t)) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.8e+15) || !(z <= 1.08e+64)) {
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 <= (-5.8d+15)) .or. (.not. (z <= 1.08d+64))) 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 <= -5.8e+15) || !(z <= 1.08e+64)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.8e+15) or not (z <= 1.08e+64): tmp = z * (x - t) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.8e+15) || !(z <= 1.08e+64)) 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 <= -5.8e+15) || ~((z <= 1.08e+64))) tmp = z * (x - t); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.8e+15], N[Not[LessEqual[z, 1.08e+64]], $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 -5.8 \cdot 10^{+15} \lor \neg \left(z \leq 1.08 \cdot 10^{+64}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -5.8e15 or 1.08000000000000007e64 < z Initial program 100.0%
Taylor expanded in y around 0 89.3%
mul-1-neg89.3%
unsub-neg89.3%
Simplified89.3%
Taylor expanded in x around 0 86.7%
fma-neg89.3%
neg-mul-189.3%
distribute-rgt-neg-out89.3%
Simplified89.3%
Taylor expanded in z around inf 89.3%
mul-1-neg89.3%
unsub-neg89.3%
Simplified89.3%
if -5.8e15 < z < 1.08000000000000007e64Initial program 100.0%
Taylor expanded in y around inf 84.4%
*-commutative84.4%
Simplified84.4%
Final simplification86.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -45.0) (not (<= z 24000000000.0))) (* z (- x t)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -45.0) || !(z <= 24000000000.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 <= (-45.0d0)) .or. (.not. (z <= 24000000000.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 <= -45.0) || !(z <= 24000000000.0)) {
tmp = z * (x - t);
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -45.0) or not (z <= 24000000000.0): tmp = z * (x - t) else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -45.0) || !(z <= 24000000000.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 <= -45.0) || ~((z <= 24000000000.0))) tmp = z * (x - t); else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -45.0], N[Not[LessEqual[z, 24000000000.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 -45 \lor \neg \left(z \leq 24000000000\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if z < -45 or 2.4e10 < z Initial program 100.0%
Taylor expanded in y around 0 85.0%
mul-1-neg85.0%
unsub-neg85.0%
Simplified85.0%
Taylor expanded in x around 0 82.6%
fma-neg85.0%
neg-mul-185.0%
distribute-rgt-neg-out85.0%
Simplified85.0%
Taylor expanded in z around inf 85.0%
mul-1-neg85.0%
unsub-neg85.0%
Simplified85.0%
if -45 < z < 2.4e10Initial program 100.0%
Taylor expanded in t around inf 76.8%
Taylor expanded in y around inf 64.6%
Final simplification74.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.4e+15) (not (<= z 0.0102))) (* z (- x t)) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.4e+15) || !(z <= 0.0102)) {
tmp = z * (x - t);
} else {
tmp = x * (1.0 - y);
}
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.4d+15)) .or. (.not. (z <= 0.0102d0))) then
tmp = z * (x - t)
else
tmp = x * (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.4e+15) || !(z <= 0.0102)) {
tmp = z * (x - t);
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.4e+15) or not (z <= 0.0102): tmp = z * (x - t) else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.4e+15) || !(z <= 0.0102)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.4e+15) || ~((z <= 0.0102))) tmp = z * (x - t); else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.4e+15], N[Not[LessEqual[z, 0.0102]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+15} \lor \neg \left(z \leq 0.0102\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if z < -1.4e15 or 0.010200000000000001 < z Initial program 100.0%
Taylor expanded in y around 0 83.3%
mul-1-neg83.3%
unsub-neg83.3%
Simplified83.3%
Taylor expanded in x around 0 81.0%
fma-neg83.3%
neg-mul-183.3%
distribute-rgt-neg-out83.3%
Simplified83.3%
Taylor expanded in z around inf 83.3%
mul-1-neg83.3%
unsub-neg83.3%
Simplified83.3%
if -1.4e15 < z < 0.010200000000000001Initial program 100.0%
Taylor expanded in x around inf 47.8%
mul-1-neg47.8%
unsub-neg47.8%
Simplified47.8%
Taylor expanded in z around 0 47.3%
Final simplification65.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -620000000.0) (not (<= x 4.8e+77))) (* y (- x)) (* z (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -620000000.0) || !(x <= 4.8e+77)) {
tmp = y * -x;
} else {
tmp = 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 ((x <= (-620000000.0d0)) .or. (.not. (x <= 4.8d+77))) then
tmp = y * -x
else
tmp = z * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -620000000.0) || !(x <= 4.8e+77)) {
tmp = y * -x;
} else {
tmp = z * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -620000000.0) or not (x <= 4.8e+77): tmp = y * -x else: tmp = z * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -620000000.0) || !(x <= 4.8e+77)) tmp = Float64(y * Float64(-x)); else tmp = Float64(z * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -620000000.0) || ~((x <= 4.8e+77))) tmp = y * -x; else tmp = z * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -620000000.0], N[Not[LessEqual[x, 4.8e+77]], $MachinePrecision]], N[(y * (-x)), $MachinePrecision], N[(z * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -620000000 \lor \neg \left(x \leq 4.8 \cdot 10^{+77}\right):\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\end{array}
\end{array}
if x < -6.2e8 or 4.7999999999999997e77 < x Initial program 100.0%
Taylor expanded in x around inf 79.2%
mul-1-neg79.2%
unsub-neg79.2%
Simplified79.2%
Taylor expanded in y around inf 40.8%
mul-1-neg40.8%
Simplified40.8%
if -6.2e8 < x < 4.7999999999999997e77Initial program 100.0%
Taylor expanded in y around 0 63.8%
mul-1-neg63.8%
unsub-neg63.8%
Simplified63.8%
Taylor expanded in t around inf 51.3%
Taylor expanded in x around 0 43.8%
mul-1-neg43.8%
*-commutative43.8%
distribute-rgt-neg-out43.8%
Simplified43.8%
Final simplification42.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.5e+20) (not (<= z 1.08e+64))) (* z x) (* y (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.5e+20) || !(z <= 1.08e+64)) {
tmp = z * x;
} else {
tmp = y * -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 <= (-7.5d+20)) .or. (.not. (z <= 1.08d+64))) then
tmp = z * x
else
tmp = y * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.5e+20) || !(z <= 1.08e+64)) {
tmp = z * x;
} else {
tmp = y * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.5e+20) or not (z <= 1.08e+64): tmp = z * x else: tmp = y * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.5e+20) || !(z <= 1.08e+64)) tmp = Float64(z * x); else tmp = Float64(y * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.5e+20) || ~((z <= 1.08e+64))) tmp = z * x; else tmp = y * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.5e+20], N[Not[LessEqual[z, 1.08e+64]], $MachinePrecision]], N[(z * x), $MachinePrecision], N[(y * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+20} \lor \neg \left(z \leq 1.08 \cdot 10^{+64}\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -7.5e20 or 1.08000000000000007e64 < z Initial program 100.0%
Taylor expanded in x around inf 48.8%
mul-1-neg48.8%
unsub-neg48.8%
Simplified48.8%
Taylor expanded in z around inf 42.7%
if -7.5e20 < z < 1.08000000000000007e64Initial program 100.0%
Taylor expanded in x around inf 45.9%
mul-1-neg45.9%
unsub-neg45.9%
Simplified45.9%
Taylor expanded in y around inf 26.2%
mul-1-neg26.2%
Simplified26.2%
Final simplification33.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.4e+15) (not (<= z 230000.0))) (* z x) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.4e+15) || !(z <= 230000.0)) {
tmp = z * x;
} 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.4d+15)) .or. (.not. (z <= 230000.0d0))) then
tmp = z * x
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.4e+15) || !(z <= 230000.0)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.4e+15) or not (z <= 230000.0): tmp = z * x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.4e+15) || !(z <= 230000.0)) tmp = Float64(z * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.4e+15) || ~((z <= 230000.0))) tmp = z * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.4e+15], N[Not[LessEqual[z, 230000.0]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+15} \lor \neg \left(z \leq 230000\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.4e15 or 2.3e5 < z Initial program 100.0%
Taylor expanded in x around inf 47.6%
mul-1-neg47.6%
unsub-neg47.6%
Simplified47.6%
Taylor expanded in z around inf 39.2%
if -1.4e15 < z < 2.3e5Initial program 100.0%
Taylor expanded in y around inf 87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in y around 0 23.1%
Final simplification31.1%
(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 y around inf 58.1%
*-commutative58.1%
Simplified58.1%
Taylor expanded in y around 0 13.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 2024135
(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))))