
(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 11 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 (* x (+ (- z y) 1.0))))
(if (<= x -4.3e+196)
t_1
(if (<= x -2.8e-6)
(+ x (* y (- t x)))
(if (<= x 1.02e+99) (+ x (* (- y z) t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((z - y) + 1.0);
double tmp;
if (x <= -4.3e+196) {
tmp = t_1;
} else if (x <= -2.8e-6) {
tmp = x + (y * (t - x));
} else if (x <= 1.02e+99) {
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 = x * ((z - y) + 1.0d0)
if (x <= (-4.3d+196)) then
tmp = t_1
else if (x <= (-2.8d-6)) then
tmp = x + (y * (t - x))
else if (x <= 1.02d+99) 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 = x * ((z - y) + 1.0);
double tmp;
if (x <= -4.3e+196) {
tmp = t_1;
} else if (x <= -2.8e-6) {
tmp = x + (y * (t - x));
} else if (x <= 1.02e+99) {
tmp = x + ((y - z) * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((z - y) + 1.0) tmp = 0 if x <= -4.3e+196: tmp = t_1 elif x <= -2.8e-6: tmp = x + (y * (t - x)) elif x <= 1.02e+99: tmp = x + ((y - z) * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(z - y) + 1.0)) tmp = 0.0 if (x <= -4.3e+196) tmp = t_1; elseif (x <= -2.8e-6) tmp = Float64(x + Float64(y * Float64(t - x))); elseif (x <= 1.02e+99) 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 = x * ((z - y) + 1.0); tmp = 0.0; if (x <= -4.3e+196) tmp = t_1; elseif (x <= -2.8e-6) tmp = x + (y * (t - x)); elseif (x <= 1.02e+99) tmp = x + ((y - z) * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.3e+196], t$95$1, If[LessEqual[x, -2.8e-6], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.02e+99], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{if}\;x \leq -4.3 \cdot 10^{+196}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.8 \cdot 10^{-6}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{elif}\;x \leq 1.02 \cdot 10^{+99}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.30000000000000012e196 or 1.01999999999999998e99 < x Initial program 99.9%
+-commutative99.9%
fma-define100.0%
Simplified100.0%
Taylor expanded in t around 0 95.5%
*-rgt-identity95.5%
mul-1-neg95.5%
distribute-rgt-neg-in95.5%
mul-1-neg95.5%
distribute-lft-in95.6%
mul-1-neg95.6%
unsub-neg95.6%
Simplified95.6%
if -4.30000000000000012e196 < x < -2.79999999999999987e-6Initial program 100.0%
Taylor expanded in y around inf 84.4%
*-commutative84.4%
Simplified84.4%
if -2.79999999999999987e-6 < x < 1.01999999999999998e99Initial program 100.0%
Taylor expanded in t around inf 83.0%
Final simplification86.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ (- z y) 1.0))))
(if (<= z -4.5e+96)
t_1
(if (<= z 190000000000.0)
(+ x (* y (- t x)))
(if (<= z 1.12e+98) t_1 (- x (* z t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((z - y) + 1.0);
double tmp;
if (z <= -4.5e+96) {
tmp = t_1;
} else if (z <= 190000000000.0) {
tmp = x + (y * (t - x));
} else if (z <= 1.12e+98) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x * ((z - y) + 1.0d0)
if (z <= (-4.5d+96)) then
tmp = t_1
else if (z <= 190000000000.0d0) then
tmp = x + (y * (t - x))
else if (z <= 1.12d+98) then
tmp = t_1
else
tmp = x - (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * ((z - y) + 1.0);
double tmp;
if (z <= -4.5e+96) {
tmp = t_1;
} else if (z <= 190000000000.0) {
tmp = x + (y * (t - x));
} else if (z <= 1.12e+98) {
tmp = t_1;
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((z - y) + 1.0) tmp = 0 if z <= -4.5e+96: tmp = t_1 elif z <= 190000000000.0: tmp = x + (y * (t - x)) elif z <= 1.12e+98: tmp = t_1 else: tmp = x - (z * t) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(z - y) + 1.0)) tmp = 0.0 if (z <= -4.5e+96) tmp = t_1; elseif (z <= 190000000000.0) tmp = Float64(x + Float64(y * Float64(t - x))); elseif (z <= 1.12e+98) tmp = t_1; else tmp = Float64(x - Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((z - y) + 1.0); tmp = 0.0; if (z <= -4.5e+96) tmp = t_1; elseif (z <= 190000000000.0) tmp = x + (y * (t - x)); elseif (z <= 1.12e+98) tmp = t_1; else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.5e+96], t$95$1, If[LessEqual[z, 190000000000.0], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.12e+98], t$95$1, N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{if}\;z \leq -4.5 \cdot 10^{+96}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 190000000000:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+98}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if z < -4.49999999999999957e96 or 1.9e11 < z < 1.12e98Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in t around 0 56.1%
*-rgt-identity56.1%
mul-1-neg56.1%
distribute-rgt-neg-in56.1%
mul-1-neg56.1%
distribute-lft-in56.1%
mul-1-neg56.1%
unsub-neg56.1%
Simplified56.1%
if -4.49999999999999957e96 < z < 1.9e11Initial program 99.9%
Taylor expanded in y around inf 90.4%
*-commutative90.4%
Simplified90.4%
if 1.12e98 < z Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in t around inf 62.5%
Taylor expanded in z around inf 56.9%
mul-1-neg56.9%
*-commutative56.9%
distribute-rgt-neg-in56.9%
Simplified56.9%
Taylor expanded in x around 0 56.9%
mul-1-neg56.9%
sub-neg56.9%
Simplified56.9%
Final simplification76.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ (- z y) 1.0))))
(if (<= x -8e-121)
t_1
(if (<= x -1.85e-205)
(- x (* z t))
(if (<= x 7.5e+97) (+ x (* y t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((z - y) + 1.0);
double tmp;
if (x <= -8e-121) {
tmp = t_1;
} else if (x <= -1.85e-205) {
tmp = x - (z * t);
} else if (x <= 7.5e+97) {
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 = x * ((z - y) + 1.0d0)
if (x <= (-8d-121)) then
tmp = t_1
else if (x <= (-1.85d-205)) then
tmp = x - (z * t)
else if (x <= 7.5d+97) 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 = x * ((z - y) + 1.0);
double tmp;
if (x <= -8e-121) {
tmp = t_1;
} else if (x <= -1.85e-205) {
tmp = x - (z * t);
} else if (x <= 7.5e+97) {
tmp = x + (y * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((z - y) + 1.0) tmp = 0 if x <= -8e-121: tmp = t_1 elif x <= -1.85e-205: tmp = x - (z * t) elif x <= 7.5e+97: tmp = x + (y * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(z - y) + 1.0)) tmp = 0.0 if (x <= -8e-121) tmp = t_1; elseif (x <= -1.85e-205) tmp = Float64(x - Float64(z * t)); elseif (x <= 7.5e+97) tmp = Float64(x + Float64(y * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((z - y) + 1.0); tmp = 0.0; if (x <= -8e-121) tmp = t_1; elseif (x <= -1.85e-205) tmp = x - (z * t); elseif (x <= 7.5e+97) tmp = x + (y * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8e-121], t$95$1, If[LessEqual[x, -1.85e-205], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.5e+97], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{if}\;x \leq -8 \cdot 10^{-121}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{-205}:\\
\;\;\;\;x - z \cdot t\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+97}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -7.9999999999999998e-121 or 7.5000000000000004e97 < x Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in t around 0 79.4%
*-rgt-identity79.4%
mul-1-neg79.4%
distribute-rgt-neg-in79.4%
mul-1-neg79.4%
distribute-lft-in79.5%
mul-1-neg79.5%
unsub-neg79.5%
Simplified79.5%
if -7.9999999999999998e-121 < x < -1.85e-205Initial program 100.0%
Taylor expanded in z around inf 94.3%
Taylor expanded in t around inf 83.2%
Taylor expanded in z around inf 65.7%
mul-1-neg65.7%
*-commutative65.7%
distribute-rgt-neg-in65.7%
Simplified65.7%
Taylor expanded in x around 0 65.7%
mul-1-neg65.7%
sub-neg65.7%
Simplified65.7%
if -1.85e-205 < x < 7.5000000000000004e97Initial program 100.0%
sub-neg100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 64.9%
Taylor expanded in x around 0 60.4%
*-commutative60.4%
Simplified60.4%
Final simplification70.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.1e+96) (not (<= z 300000.0))) (+ x (* z (- x t))) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.1e+96) || !(z <= 300000.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 <= (-4.1d+96)) .or. (.not. (z <= 300000.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 <= -4.1e+96) || !(z <= 300000.0)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.1e+96) or not (z <= 300000.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 <= -4.1e+96) || !(z <= 300000.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 <= -4.1e+96) || ~((z <= 300000.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, -4.1e+96], N[Not[LessEqual[z, 300000.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 -4.1 \cdot 10^{+96} \lor \neg \left(z \leq 300000\right):\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -4.09999999999999998e96 or 3e5 < z Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 84.7%
mul-1-neg84.7%
unsub-neg84.7%
Simplified84.7%
if -4.09999999999999998e96 < z < 3e5Initial program 99.9%
Taylor expanded in y around inf 91.0%
*-commutative91.0%
Simplified91.0%
Final simplification88.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.62e+94) (not (<= z 6.2))) (* z (- t)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.62e+94) || !(z <= 6.2)) {
tmp = z * -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 <= (-1.62d+94)) .or. (.not. (z <= 6.2d0))) then
tmp = z * -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 <= -1.62e+94) || !(z <= 6.2)) {
tmp = z * -t;
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.62e+94) or not (z <= 6.2): tmp = z * -t else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.62e+94) || !(z <= 6.2)) tmp = Float64(z * Float64(-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 <= -1.62e+94) || ~((z <= 6.2))) tmp = z * -t; else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.62e+94], N[Not[LessEqual[z, 6.2]], $MachinePrecision]], N[(z * (-t)), $MachinePrecision], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.62 \cdot 10^{+94} \lor \neg \left(z \leq 6.2\right):\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if z < -1.61999999999999997e94 or 6.20000000000000018 < z Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in t around inf 54.1%
Taylor expanded in z around inf 46.2%
mul-1-neg46.2%
*-commutative46.2%
distribute-rgt-neg-in46.2%
Simplified46.2%
Taylor expanded in x around 0 45.7%
mul-1-neg45.7%
distribute-rgt-neg-in45.7%
Simplified45.7%
if -1.61999999999999997e94 < z < 6.20000000000000018Initial program 99.9%
sub-neg99.9%
distribute-lft-in97.2%
Applied egg-rr97.2%
Taylor expanded in z around 0 88.7%
Taylor expanded in x around 0 69.9%
*-commutative69.9%
Simplified69.9%
Final simplification59.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.1e+96) (not (<= z 5.3e+91))) (* z (- t)) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.1e+96) || !(z <= 5.3e+91)) {
tmp = z * -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 <= (-4.1d+96)) .or. (.not. (z <= 5.3d+91))) then
tmp = z * -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 <= -4.1e+96) || !(z <= 5.3e+91)) {
tmp = z * -t;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.1e+96) or not (z <= 5.3e+91): tmp = z * -t else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.1e+96) || !(z <= 5.3e+91)) tmp = Float64(z * Float64(-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 <= -4.1e+96) || ~((z <= 5.3e+91))) tmp = z * -t; else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.1e+96], N[Not[LessEqual[z, 5.3e+91]], $MachinePrecision]], N[(z * (-t)), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{+96} \lor \neg \left(z \leq 5.3 \cdot 10^{+91}\right):\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if z < -4.09999999999999998e96 or 5.29999999999999997e91 < z Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in t around inf 58.2%
Taylor expanded in z around inf 50.3%
mul-1-neg50.3%
*-commutative50.3%
distribute-rgt-neg-in50.3%
Simplified50.3%
Taylor expanded in x around 0 50.3%
mul-1-neg50.3%
distribute-rgt-neg-in50.3%
Simplified50.3%
if -4.09999999999999998e96 < z < 5.29999999999999997e91Initial program 99.9%
sub-neg99.9%
distribute-lft-in97.6%
Applied egg-rr97.6%
Taylor expanded in z around 0 82.0%
Taylor expanded in x around inf 77.5%
+-commutative77.5%
mul-1-neg77.5%
unsub-neg77.5%
associate-/l*76.4%
Simplified76.4%
Taylor expanded in x around inf 50.3%
Final simplification50.3%
(FPCore (x y z t) :precision binary64 (if (<= z -1.12e+94) (* z (- t)) (if (<= z 650.0) (+ x (* y t)) (- x (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.12e+94) {
tmp = z * -t;
} else if (z <= 650.0) {
tmp = x + (y * t);
} 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 (z <= (-1.12d+94)) then
tmp = z * -t
else if (z <= 650.0d0) then
tmp = x + (y * t)
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 (z <= -1.12e+94) {
tmp = z * -t;
} else if (z <= 650.0) {
tmp = x + (y * t);
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.12e+94: tmp = z * -t elif z <= 650.0: tmp = x + (y * t) else: tmp = x - (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.12e+94) tmp = Float64(z * Float64(-t)); elseif (z <= 650.0) tmp = Float64(x + Float64(y * t)); else tmp = Float64(x - Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.12e+94) tmp = z * -t; elseif (z <= 650.0) tmp = x + (y * t); else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.12e+94], N[(z * (-t)), $MachinePrecision], If[LessEqual[z, 650.0], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.12 \cdot 10^{+94}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{elif}\;z \leq 650:\\
\;\;\;\;x + y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if z < -1.11999999999999996e94Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in t around inf 53.9%
Taylor expanded in z around inf 44.5%
mul-1-neg44.5%
*-commutative44.5%
distribute-rgt-neg-in44.5%
Simplified44.5%
Taylor expanded in x around 0 45.0%
mul-1-neg45.0%
distribute-rgt-neg-in45.0%
Simplified45.0%
if -1.11999999999999996e94 < z < 650Initial program 99.9%
sub-neg99.9%
distribute-lft-in97.2%
Applied egg-rr97.2%
Taylor expanded in z around 0 88.7%
Taylor expanded in x around 0 69.9%
*-commutative69.9%
Simplified69.9%
if 650 < z Initial program 100.0%
Taylor expanded in z around inf 99.9%
Taylor expanded in t around inf 54.3%
Taylor expanded in z around inf 47.6%
mul-1-neg47.6%
*-commutative47.6%
distribute-rgt-neg-in47.6%
Simplified47.6%
Taylor expanded in x around 0 47.6%
mul-1-neg47.6%
sub-neg47.6%
Simplified47.6%
Final simplification60.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.36e-75) (not (<= z 4.9e-64))) (* z (- t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.36e-75) || !(z <= 4.9e-64)) {
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 <= (-1.36d-75)) .or. (.not. (z <= 4.9d-64))) 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 <= -1.36e-75) || !(z <= 4.9e-64)) {
tmp = z * -t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.36e-75) or not (z <= 4.9e-64): tmp = z * -t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.36e-75) || !(z <= 4.9e-64)) 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 <= -1.36e-75) || ~((z <= 4.9e-64))) tmp = z * -t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.36e-75], N[Not[LessEqual[z, 4.9e-64]], $MachinePrecision]], N[(z * (-t)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.36 \cdot 10^{-75} \lor \neg \left(z \leq 4.9 \cdot 10^{-64}\right):\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.36e-75 or 4.9000000000000002e-64 < z Initial program 100.0%
Taylor expanded in z around inf 99.9%
Taylor expanded in t around inf 59.8%
Taylor expanded in z around inf 41.1%
mul-1-neg41.1%
*-commutative41.1%
distribute-rgt-neg-in41.1%
Simplified41.1%
Taylor expanded in x around 0 38.2%
mul-1-neg38.2%
distribute-rgt-neg-in38.2%
Simplified38.2%
if -1.36e-75 < z < 4.9000000000000002e-64Initial program 100.0%
sub-neg100.0%
distribute-lft-in97.1%
Applied egg-rr97.1%
Taylor expanded in z around 0 95.5%
Taylor expanded in x around inf 93.5%
+-commutative93.5%
mul-1-neg93.5%
unsub-neg93.5%
associate-/l*91.6%
Simplified91.6%
Taylor expanded in y around 0 38.4%
Final simplification38.3%
(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%
sub-neg100.0%
distribute-lft-in97.6%
Applied egg-rr97.6%
Taylor expanded in z around 0 60.1%
Taylor expanded in x around inf 57.9%
+-commutative57.9%
mul-1-neg57.9%
unsub-neg57.9%
associate-/l*56.8%
Simplified56.8%
Taylor expanded in y around 0 18.8%
(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 2024111
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:alt
(+ x (+ (* t (- y z)) (* (- x) (- y z))))
(+ x (* (- y z) (- t x))))