
(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 12 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))))
(if (<= y -8.8e-38)
t_1
(if (<= y 8.8e-73) (- x (* z t)) (if (<= y 2.5e+73) (+ x (* z x)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -8.8e-38) {
tmp = t_1;
} else if (y <= 8.8e-73) {
tmp = x - (z * t);
} else if (y <= 2.5e+73) {
tmp = x + (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 = y * (t - x)
if (y <= (-8.8d-38)) then
tmp = t_1
else if (y <= 8.8d-73) then
tmp = x - (z * t)
else if (y <= 2.5d+73) then
tmp = x + (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 = y * (t - x);
double tmp;
if (y <= -8.8e-38) {
tmp = t_1;
} else if (y <= 8.8e-73) {
tmp = x - (z * t);
} else if (y <= 2.5e+73) {
tmp = x + (z * x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -8.8e-38: tmp = t_1 elif y <= 8.8e-73: tmp = x - (z * t) elif y <= 2.5e+73: tmp = x + (z * x) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -8.8e-38) tmp = t_1; elseif (y <= 8.8e-73) tmp = Float64(x - Float64(z * t)); elseif (y <= 2.5e+73) tmp = Float64(x + Float64(z * x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); tmp = 0.0; if (y <= -8.8e-38) tmp = t_1; elseif (y <= 8.8e-73) tmp = x - (z * t); elseif (y <= 2.5e+73) tmp = x + (z * x); 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]}, If[LessEqual[y, -8.8e-38], t$95$1, If[LessEqual[y, 8.8e-73], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.5e+73], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -8.8 \cdot 10^{-38}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{-73}:\\
\;\;\;\;x - z \cdot t\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+73}:\\
\;\;\;\;x + z \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -8.80000000000000029e-38 or 2.49999999999999988e73 < y Initial program 100.0%
Taylor expanded in y around inf 84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in x around 0 79.6%
Taylor expanded in y around inf 83.5%
neg-mul-183.5%
unsub-neg83.5%
Simplified83.5%
if -8.80000000000000029e-38 < y < 8.8000000000000001e-73Initial program 100.0%
Taylor expanded in y around 0 94.8%
mul-1-neg94.8%
unsub-neg94.8%
Simplified94.8%
Taylor expanded in t around inf 70.1%
if 8.8000000000000001e-73 < y < 2.49999999999999988e73Initial program 100.0%
Taylor expanded in t around 0 74.7%
mul-1-neg74.7%
distribute-rgt-neg-in74.7%
sub-neg74.7%
+-commutative74.7%
distribute-neg-in74.7%
remove-double-neg74.7%
sub-neg74.7%
Simplified74.7%
Taylor expanded in y around 0 69.9%
*-commutative69.9%
Simplified69.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -2.8e+16)
t_1
(if (<= y -2.1e-128)
(* (- y z) t)
(if (<= y 2.5e+73) (+ x (* z x)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -2.8e+16) {
tmp = t_1;
} else if (y <= -2.1e-128) {
tmp = (y - z) * t;
} else if (y <= 2.5e+73) {
tmp = x + (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 = y * (t - x)
if (y <= (-2.8d+16)) then
tmp = t_1
else if (y <= (-2.1d-128)) then
tmp = (y - z) * t
else if (y <= 2.5d+73) then
tmp = x + (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 = y * (t - x);
double tmp;
if (y <= -2.8e+16) {
tmp = t_1;
} else if (y <= -2.1e-128) {
tmp = (y - z) * t;
} else if (y <= 2.5e+73) {
tmp = x + (z * x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -2.8e+16: tmp = t_1 elif y <= -2.1e-128: tmp = (y - z) * t elif y <= 2.5e+73: tmp = x + (z * x) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -2.8e+16) tmp = t_1; elseif (y <= -2.1e-128) tmp = Float64(Float64(y - z) * t); elseif (y <= 2.5e+73) tmp = Float64(x + Float64(z * x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); tmp = 0.0; if (y <= -2.8e+16) tmp = t_1; elseif (y <= -2.1e-128) tmp = (y - z) * t; elseif (y <= 2.5e+73) tmp = x + (z * x); 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]}, If[LessEqual[y, -2.8e+16], t$95$1, If[LessEqual[y, -2.1e-128], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[y, 2.5e+73], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -2.8 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{-128}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+73}:\\
\;\;\;\;x + z \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.8e16 or 2.49999999999999988e73 < y Initial program 100.0%
Taylor expanded in y around inf 87.0%
*-commutative87.0%
Simplified87.0%
Taylor expanded in x around 0 81.4%
Taylor expanded in y around inf 87.0%
neg-mul-187.0%
unsub-neg87.0%
Simplified87.0%
if -2.8e16 < y < -2.1000000000000001e-128Initial program 99.9%
Taylor expanded in t around inf 81.2%
Taylor expanded in t around inf 81.3%
Taylor expanded in x around 0 62.9%
if -2.1000000000000001e-128 < y < 2.49999999999999988e73Initial program 100.0%
Taylor expanded in t around 0 69.0%
mul-1-neg69.0%
distribute-rgt-neg-in69.0%
sub-neg69.0%
+-commutative69.0%
distribute-neg-in69.0%
remove-double-neg69.0%
sub-neg69.0%
Simplified69.0%
Taylor expanded in y around 0 67.7%
*-commutative67.7%
Simplified67.7%
Final simplification76.5%
(FPCore (x y z t) :precision binary64 (if (or (<= (- y z) -5e-38) (not (<= (- y z) 1e-12))) (* (- y z) t) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((y - z) <= -5e-38) || !((y - z) <= 1e-12)) {
tmp = (y - 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 (((y - z) <= (-5d-38)) .or. (.not. ((y - z) <= 1d-12))) then
tmp = (y - 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 (((y - z) <= -5e-38) || !((y - z) <= 1e-12)) {
tmp = (y - z) * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((y - z) <= -5e-38) or not ((y - z) <= 1e-12): tmp = (y - z) * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(y - z) <= -5e-38) || !(Float64(y - z) <= 1e-12)) tmp = Float64(Float64(y - z) * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((y - z) <= -5e-38) || ~(((y - z) <= 1e-12))) tmp = (y - z) * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(y - z), $MachinePrecision], -5e-38], N[Not[LessEqual[N[(y - z), $MachinePrecision], 1e-12]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y - z \leq -5 \cdot 10^{-38} \lor \neg \left(y - z \leq 10^{-12}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (-.f64 y z) < -5.00000000000000033e-38 or 9.9999999999999998e-13 < (-.f64 y z) Initial program 100.0%
Taylor expanded in t around inf 54.8%
Taylor expanded in t around inf 57.1%
Taylor expanded in x around 0 53.3%
if -5.00000000000000033e-38 < (-.f64 y z) < 9.9999999999999998e-13Initial program 99.9%
Taylor expanded in y around inf 95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in y around 0 82.5%
Final simplification58.4%
(FPCore (x y z t) :precision binary64 (if (<= y -1.8e-41) (* y t) (if (<= y -5.6e-145) (* z (- t)) (if (<= y 4.2e-11) x (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.8e-41) {
tmp = y * t;
} else if (y <= -5.6e-145) {
tmp = z * -t;
} else if (y <= 4.2e-11) {
tmp = x;
} else {
tmp = y * t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1.8d-41)) then
tmp = y * t
else if (y <= (-5.6d-145)) then
tmp = z * -t
else if (y <= 4.2d-11) then
tmp = x
else
tmp = y * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.8e-41) {
tmp = y * t;
} else if (y <= -5.6e-145) {
tmp = z * -t;
} else if (y <= 4.2e-11) {
tmp = x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.8e-41: tmp = y * t elif y <= -5.6e-145: tmp = z * -t elif y <= 4.2e-11: tmp = x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.8e-41) tmp = Float64(y * t); elseif (y <= -5.6e-145) tmp = Float64(z * Float64(-t)); elseif (y <= 4.2e-11) tmp = x; else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.8e-41) tmp = y * t; elseif (y <= -5.6e-145) tmp = z * -t; elseif (y <= 4.2e-11) tmp = x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.8e-41], N[(y * t), $MachinePrecision], If[LessEqual[y, -5.6e-145], N[(z * (-t)), $MachinePrecision], If[LessEqual[y, 4.2e-11], x, N[(y * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{-41}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq -5.6 \cdot 10^{-145}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-11}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.8e-41 or 4.1999999999999997e-11 < y Initial program 100.0%
Taylor expanded in t around inf 55.0%
Taylor expanded in t around inf 56.9%
Taylor expanded in y around inf 44.5%
if -1.8e-41 < y < -5.6000000000000002e-145Initial program 99.9%
Taylor expanded in t around inf 75.6%
Taylor expanded in t around inf 76.2%
Taylor expanded in z around inf 49.8%
mul-1-neg49.8%
Simplified49.8%
if -5.6000000000000002e-145 < y < 4.1999999999999997e-11Initial program 100.0%
Taylor expanded in y around inf 47.2%
*-commutative47.2%
Simplified47.2%
Taylor expanded in y around 0 41.1%
Final simplification43.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3e+60) (not (<= z 3.1e+18))) (+ x (* z (- x t))) (- x (* y (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3e+60) || !(z <= 3.1e+18)) {
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 <= (-3d+60)) .or. (.not. (z <= 3.1d+18))) 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 <= -3e+60) || !(z <= 3.1e+18)) {
tmp = x + (z * (x - t));
} else {
tmp = x - (y * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3e+60) or not (z <= 3.1e+18): tmp = x + (z * (x - t)) else: tmp = x - (y * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3e+60) || !(z <= 3.1e+18)) 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 <= -3e+60) || ~((z <= 3.1e+18))) 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, -3e+60], N[Not[LessEqual[z, 3.1e+18]], $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 -3 \cdot 10^{+60} \lor \neg \left(z \leq 3.1 \cdot 10^{+18}\right):\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\end{array}
\end{array}
if z < -2.9999999999999998e60 or 3.1e18 < z Initial program 100.0%
Taylor expanded in y around 0 83.6%
mul-1-neg83.6%
unsub-neg83.6%
Simplified83.6%
if -2.9999999999999998e60 < z < 3.1e18Initial program 100.0%
Taylor expanded in y around inf 93.5%
*-commutative93.5%
Simplified93.5%
Final simplification89.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.12e+29) (not (<= x 1.1e-35))) (+ x (* x (- z y))) (+ x (* (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.12e+29) || !(x <= 1.1e-35)) {
tmp = x + (x * (z - y));
} else {
tmp = x + ((y - 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 <= (-1.12d+29)) .or. (.not. (x <= 1.1d-35))) then
tmp = x + (x * (z - y))
else
tmp = x + ((y - z) * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.12e+29) || !(x <= 1.1e-35)) {
tmp = x + (x * (z - y));
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.12e+29) or not (x <= 1.1e-35): tmp = x + (x * (z - y)) else: tmp = x + ((y - z) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.12e+29) || !(x <= 1.1e-35)) tmp = Float64(x + Float64(x * Float64(z - y))); else tmp = Float64(x + Float64(Float64(y - z) * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.12e+29) || ~((x <= 1.1e-35))) tmp = x + (x * (z - y)); else tmp = x + ((y - z) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.12e+29], N[Not[LessEqual[x, 1.1e-35]], $MachinePrecision]], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.12 \cdot 10^{+29} \lor \neg \left(x \leq 1.1 \cdot 10^{-35}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -1.1200000000000001e29 or 1.09999999999999997e-35 < x Initial program 100.0%
Taylor expanded in t around 0 87.1%
mul-1-neg87.1%
distribute-rgt-neg-in87.1%
sub-neg87.1%
+-commutative87.1%
distribute-neg-in87.1%
remove-double-neg87.1%
sub-neg87.1%
Simplified87.1%
if -1.1200000000000001e29 < x < 1.09999999999999997e-35Initial program 100.0%
Taylor expanded in t around inf 82.4%
Final simplification84.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.2e-70) (not (<= x 7e-36))) (+ x (* x (- z y))) (* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.2e-70) || !(x <= 7e-36)) {
tmp = x + (x * (z - y));
} else {
tmp = (y - 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 <= (-2.2d-70)) .or. (.not. (x <= 7d-36))) then
tmp = x + (x * (z - y))
else
tmp = (y - z) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.2e-70) || !(x <= 7e-36)) {
tmp = x + (x * (z - y));
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.2e-70) or not (x <= 7e-36): tmp = x + (x * (z - y)) else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.2e-70) || !(x <= 7e-36)) tmp = Float64(x + Float64(x * Float64(z - y))); else tmp = Float64(Float64(y - z) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.2e-70) || ~((x <= 7e-36))) tmp = x + (x * (z - y)); else tmp = (y - z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.2e-70], N[Not[LessEqual[x, 7e-36]], $MachinePrecision]], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-70} \lor \neg \left(x \leq 7 \cdot 10^{-36}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -2.1999999999999999e-70 or 6.9999999999999999e-36 < x Initial program 100.0%
Taylor expanded in t around 0 81.1%
mul-1-neg81.1%
distribute-rgt-neg-in81.1%
sub-neg81.1%
+-commutative81.1%
distribute-neg-in81.1%
remove-double-neg81.1%
sub-neg81.1%
Simplified81.1%
if -2.1999999999999999e-70 < x < 6.9999999999999999e-36Initial program 100.0%
Taylor expanded in t around inf 87.1%
Taylor expanded in t around inf 87.1%
Taylor expanded in x around 0 78.9%
Final simplification80.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.15e+38) (not (<= x 2.75e-8))) (* x (- 1.0 y)) (* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.15e+38) || !(x <= 2.75e-8)) {
tmp = x * (1.0 - y);
} else {
tmp = (y - 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 <= (-1.15d+38)) .or. (.not. (x <= 2.75d-8))) then
tmp = x * (1.0d0 - y)
else
tmp = (y - z) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.15e+38) || !(x <= 2.75e-8)) {
tmp = x * (1.0 - y);
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.15e+38) or not (x <= 2.75e-8): tmp = x * (1.0 - y) else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.15e+38) || !(x <= 2.75e-8)) tmp = Float64(x * Float64(1.0 - y)); else tmp = Float64(Float64(y - z) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.15e+38) || ~((x <= 2.75e-8))) tmp = x * (1.0 - y); else tmp = (y - z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.15e+38], N[Not[LessEqual[x, 2.75e-8]], $MachinePrecision]], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{+38} \lor \neg \left(x \leq 2.75 \cdot 10^{-8}\right):\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -1.1500000000000001e38 or 2.7500000000000001e-8 < x Initial program 100.0%
Taylor expanded in t around 0 89.8%
mul-1-neg89.8%
distribute-rgt-neg-in89.8%
sub-neg89.8%
+-commutative89.8%
distribute-neg-in89.8%
remove-double-neg89.8%
sub-neg89.8%
Simplified89.8%
Taylor expanded in z around 0 63.0%
*-rgt-identity63.0%
mul-1-neg63.0%
distribute-rgt-neg-out63.0%
distribute-lft-in63.0%
unsub-neg63.0%
Simplified63.0%
if -1.1500000000000001e38 < x < 2.7500000000000001e-8Initial program 100.0%
Taylor expanded in t around inf 79.8%
Taylor expanded in t around inf 79.8%
Taylor expanded in x around 0 70.5%
Final simplification67.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.2e-38) (not (<= y 1.4e-12))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.2e-38) || !(y <= 1.4e-12)) {
tmp = y * 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 ((y <= (-4.2d-38)) .or. (.not. (y <= 1.4d-12))) then
tmp = y * 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 ((y <= -4.2e-38) || !(y <= 1.4e-12)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.2e-38) or not (y <= 1.4e-12): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.2e-38) || !(y <= 1.4e-12)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.2e-38) || ~((y <= 1.4e-12))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.2e-38], N[Not[LessEqual[y, 1.4e-12]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{-38} \lor \neg \left(y \leq 1.4 \cdot 10^{-12}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.20000000000000026e-38 or 1.4000000000000001e-12 < y Initial program 100.0%
Taylor expanded in t around inf 55.0%
Taylor expanded in t around inf 56.9%
Taylor expanded in y around inf 44.5%
if -4.20000000000000026e-38 < y < 1.4000000000000001e-12Initial program 100.0%
Taylor expanded in y around inf 43.3%
*-commutative43.3%
Simplified43.3%
Taylor expanded in y around 0 37.5%
Final simplification41.6%
(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 64.6%
*-commutative64.6%
Simplified64.6%
Taylor expanded in y around 0 17.4%
(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 2024170
(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))))