
(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 14 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 -9.8e+157)
t_1
(if (<= y -2.9e-49)
(* (- y z) t)
(if (<= y 2.8e-188)
(- x (* z t))
(if (<= y 3.8e+36) (* z (- x t)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -9.8e+157) {
tmp = t_1;
} else if (y <= -2.9e-49) {
tmp = (y - z) * t;
} else if (y <= 2.8e-188) {
tmp = x - (z * t);
} else if (y <= 3.8e+36) {
tmp = z * (x - 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 = y * (t - x)
if (y <= (-9.8d+157)) then
tmp = t_1
else if (y <= (-2.9d-49)) then
tmp = (y - z) * t
else if (y <= 2.8d-188) then
tmp = x - (z * t)
else if (y <= 3.8d+36) then
tmp = z * (x - 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 = y * (t - x);
double tmp;
if (y <= -9.8e+157) {
tmp = t_1;
} else if (y <= -2.9e-49) {
tmp = (y - z) * t;
} else if (y <= 2.8e-188) {
tmp = x - (z * t);
} else if (y <= 3.8e+36) {
tmp = z * (x - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -9.8e+157: tmp = t_1 elif y <= -2.9e-49: tmp = (y - z) * t elif y <= 2.8e-188: tmp = x - (z * t) elif y <= 3.8e+36: tmp = z * (x - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -9.8e+157) tmp = t_1; elseif (y <= -2.9e-49) tmp = Float64(Float64(y - z) * t); elseif (y <= 2.8e-188) tmp = Float64(x - Float64(z * t)); elseif (y <= 3.8e+36) tmp = Float64(z * Float64(x - t)); 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 <= -9.8e+157) tmp = t_1; elseif (y <= -2.9e-49) tmp = (y - z) * t; elseif (y <= 2.8e-188) tmp = x - (z * t); elseif (y <= 3.8e+36) tmp = z * (x - t); 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, -9.8e+157], t$95$1, If[LessEqual[y, -2.9e-49], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[y, 2.8e-188], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.8e+36], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -9.8 \cdot 10^{+157}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.9 \cdot 10^{-49}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{-188}:\\
\;\;\;\;x - z \cdot t\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+36}:\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.8000000000000003e157 or 3.80000000000000025e36 < y Initial program 100.0%
Taylor expanded in y around inf 91.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in y around inf 91.9%
if -9.8000000000000003e157 < y < -2.9e-49Initial program 100.0%
Taylor expanded in t around inf 63.5%
Taylor expanded in t around inf 68.5%
Taylor expanded in x around 0 60.0%
if -2.9e-49 < y < 2.8000000000000001e-188Initial program 100.0%
Taylor expanded in t around inf 82.1%
Taylor expanded in y around 0 77.5%
mul-1-neg77.5%
unsub-neg77.5%
*-commutative77.5%
Simplified77.5%
if 2.8000000000000001e-188 < y < 3.80000000000000025e36Initial program 100.0%
Taylor expanded in y around 0 85.1%
mul-1-neg85.1%
unsub-neg85.1%
Simplified85.1%
Taylor expanded in z around inf 67.8%
Final simplification76.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))))
(if (<= z -1.35e-16)
t_1
(if (<= z 7e-127) (+ x (* y t)) (if (<= z 7e+25) (* y (- t x)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -1.35e-16) {
tmp = t_1;
} else if (z <= 7e-127) {
tmp = x + (y * t);
} else if (z <= 7e+25) {
tmp = y * (t - 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 * (x - t)
if (z <= (-1.35d-16)) then
tmp = t_1
else if (z <= 7d-127) then
tmp = x + (y * t)
else if (z <= 7d+25) then
tmp = y * (t - 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 * (x - t);
double tmp;
if (z <= -1.35e-16) {
tmp = t_1;
} else if (z <= 7e-127) {
tmp = x + (y * t);
} else if (z <= 7e+25) {
tmp = y * (t - x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -1.35e-16: tmp = t_1 elif z <= 7e-127: tmp = x + (y * t) elif z <= 7e+25: tmp = y * (t - x) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -1.35e-16) tmp = t_1; elseif (z <= 7e-127) tmp = Float64(x + Float64(y * t)); elseif (z <= 7e+25) tmp = Float64(y * Float64(t - x)); 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 <= -1.35e-16) tmp = t_1; elseif (z <= 7e-127) tmp = x + (y * t); elseif (z <= 7e+25) tmp = y * (t - x); 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, -1.35e-16], t$95$1, If[LessEqual[z, 7e-127], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7e+25], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-127}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+25}:\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.35e-16 or 6.99999999999999999e25 < z Initial program 100.0%
Taylor expanded in y around 0 78.1%
mul-1-neg78.1%
unsub-neg78.1%
Simplified78.1%
Taylor expanded in z around inf 77.6%
if -1.35e-16 < z < 6.99999999999999979e-127Initial program 100.0%
Taylor expanded in t around inf 76.3%
Taylor expanded in y around inf 68.4%
if 6.99999999999999979e-127 < z < 6.99999999999999999e25Initial program 100.0%
Taylor expanded in y around inf 76.0%
*-commutative76.0%
Simplified76.0%
Taylor expanded in y around inf 67.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.8e+82) (not (<= x 2.05e+35))) (+ x (* x (- z y))) (* t (- (+ y (/ x t)) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.8e+82) || !(x <= 2.05e+35)) {
tmp = x + (x * (z - y));
} else {
tmp = t * ((y + (x / t)) - z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-2.8d+82)) .or. (.not. (x <= 2.05d+35))) then
tmp = x + (x * (z - y))
else
tmp = t * ((y + (x / t)) - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.8e+82) || !(x <= 2.05e+35)) {
tmp = x + (x * (z - y));
} else {
tmp = t * ((y + (x / t)) - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.8e+82) or not (x <= 2.05e+35): tmp = x + (x * (z - y)) else: tmp = t * ((y + (x / t)) - z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.8e+82) || !(x <= 2.05e+35)) tmp = Float64(x + Float64(x * Float64(z - y))); else tmp = Float64(t * Float64(Float64(y + Float64(x / t)) - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.8e+82) || ~((x <= 2.05e+35))) tmp = x + (x * (z - y)); else tmp = t * ((y + (x / t)) - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.8e+82], N[Not[LessEqual[x, 2.05e+35]], $MachinePrecision]], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y + N[(x / t), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{+82} \lor \neg \left(x \leq 2.05 \cdot 10^{+35}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(\left(y + \frac{x}{t}\right) - z\right)\\
\end{array}
\end{array}
if x < -2.8e82 or 2.0499999999999999e35 < x Initial program 100.0%
Taylor expanded in t around 0 87.3%
mul-1-neg87.3%
distribute-rgt-neg-in87.3%
sub-neg87.3%
+-commutative87.3%
distribute-neg-in87.3%
remove-double-neg87.3%
sub-neg87.3%
Simplified87.3%
if -2.8e82 < x < 2.0499999999999999e35Initial program 100.0%
Taylor expanded in t around inf 84.7%
Taylor expanded in t around inf 84.7%
Final simplification85.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (- y z) -2e-49) (not (<= (- y z) 5e-66))) (* (- y z) t) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((y - z) <= -2e-49) || !((y - z) <= 5e-66)) {
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) <= (-2d-49)) .or. (.not. ((y - z) <= 5d-66))) 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) <= -2e-49) || !((y - z) <= 5e-66)) {
tmp = (y - z) * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((y - z) <= -2e-49) or not ((y - z) <= 5e-66): tmp = (y - z) * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(y - z) <= -2e-49) || !(Float64(y - z) <= 5e-66)) 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) <= -2e-49) || ~(((y - z) <= 5e-66))) tmp = (y - z) * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(y - z), $MachinePrecision], -2e-49], N[Not[LessEqual[N[(y - z), $MachinePrecision], 5e-66]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y - z \leq -2 \cdot 10^{-49} \lor \neg \left(y - z \leq 5 \cdot 10^{-66}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (-.f64 y z) < -1.99999999999999987e-49 or 4.99999999999999962e-66 < (-.f64 y z) Initial program 100.0%
Taylor expanded in t around inf 60.6%
Taylor expanded in t around inf 64.0%
Taylor expanded in x around 0 56.8%
if -1.99999999999999987e-49 < (-.f64 y z) < 4.99999999999999962e-66Initial program 100.0%
Taylor expanded in t around inf 100.0%
Taylor expanded in x around inf 77.1%
Final simplification59.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.1e+82) (not (<= x 1.3e+36))) (+ x (* x (- z y))) (+ x (* (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.1e+82) || !(x <= 1.3e+36)) {
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 <= (-3.1d+82)) .or. (.not. (x <= 1.3d+36))) 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 <= -3.1e+82) || !(x <= 1.3e+36)) {
tmp = x + (x * (z - y));
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.1e+82) or not (x <= 1.3e+36): tmp = x + (x * (z - y)) else: tmp = x + ((y - z) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.1e+82) || !(x <= 1.3e+36)) 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 <= -3.1e+82) || ~((x <= 1.3e+36))) 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, -3.1e+82], N[Not[LessEqual[x, 1.3e+36]], $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 -3.1 \cdot 10^{+82} \lor \neg \left(x \leq 1.3 \cdot 10^{+36}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -3.10000000000000032e82 or 1.3000000000000001e36 < x Initial program 100.0%
Taylor expanded in t around 0 87.3%
mul-1-neg87.3%
distribute-rgt-neg-in87.3%
sub-neg87.3%
+-commutative87.3%
distribute-neg-in87.3%
remove-double-neg87.3%
sub-neg87.3%
Simplified87.3%
if -3.10000000000000032e82 < x < 1.3000000000000001e36Initial program 100.0%
Taylor expanded in t around inf 84.7%
Final simplification85.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.5e+37) (not (<= z 7e+22))) (* z (- x t)) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.5e+37) || !(z <= 7e+22)) {
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 <= (-1.5d+37)) .or. (.not. (z <= 7d+22))) 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 <= -1.5e+37) || !(z <= 7e+22)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.5e+37) or not (z <= 7e+22): tmp = z * (x - t) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.5e+37) || !(z <= 7e+22)) 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 <= -1.5e+37) || ~((z <= 7e+22))) tmp = z * (x - t); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.5e+37], N[Not[LessEqual[z, 7e+22]], $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 -1.5 \cdot 10^{+37} \lor \neg \left(z \leq 7 \cdot 10^{+22}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -1.50000000000000011e37 or 7e22 < z Initial program 100.0%
Taylor expanded in y around 0 80.5%
mul-1-neg80.5%
unsub-neg80.5%
Simplified80.5%
Taylor expanded in z around inf 80.5%
if -1.50000000000000011e37 < z < 7e22Initial program 100.0%
Taylor expanded in y around inf 86.6%
*-commutative86.6%
Simplified86.6%
Final simplification83.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.75e+82) (not (<= x 9.1e-39))) (+ x (* x (- z y))) (* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.75e+82) || !(x <= 9.1e-39)) {
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.75d+82)) .or. (.not. (x <= 9.1d-39))) 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.75e+82) || !(x <= 9.1e-39)) {
tmp = x + (x * (z - y));
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.75e+82) or not (x <= 9.1e-39): tmp = x + (x * (z - y)) else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.75e+82) || !(x <= 9.1e-39)) 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.75e+82) || ~((x <= 9.1e-39))) 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.75e+82], N[Not[LessEqual[x, 9.1e-39]], $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.75 \cdot 10^{+82} \lor \neg \left(x \leq 9.1 \cdot 10^{-39}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -2.74999999999999998e82 or 9.0999999999999996e-39 < x Initial program 100.0%
Taylor expanded in t around 0 84.6%
mul-1-neg84.6%
distribute-rgt-neg-in84.6%
sub-neg84.6%
+-commutative84.6%
distribute-neg-in84.6%
remove-double-neg84.6%
sub-neg84.6%
Simplified84.6%
if -2.74999999999999998e82 < x < 9.0999999999999996e-39Initial program 100.0%
Taylor expanded in t around inf 85.8%
Taylor expanded in t around inf 85.8%
Taylor expanded in x around 0 77.0%
Final simplification80.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.45e+54) (not (<= y 3.6e+34))) (* y (- t x)) (* z (- x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.45e+54) || !(y <= 3.6e+34)) {
tmp = y * (t - x);
} else {
tmp = z * (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 ((y <= (-1.45d+54)) .or. (.not. (y <= 3.6d+34))) then
tmp = y * (t - x)
else
tmp = z * (x - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.45e+54) || !(y <= 3.6e+34)) {
tmp = y * (t - x);
} else {
tmp = z * (x - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.45e+54) or not (y <= 3.6e+34): tmp = y * (t - x) else: tmp = z * (x - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.45e+54) || !(y <= 3.6e+34)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(z * Float64(x - t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.45e+54) || ~((y <= 3.6e+34))) tmp = y * (t - x); else tmp = z * (x - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.45e+54], N[Not[LessEqual[y, 3.6e+34]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{+54} \lor \neg \left(y \leq 3.6 \cdot 10^{+34}\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x - t\right)\\
\end{array}
\end{array}
if y < -1.4499999999999999e54 or 3.6e34 < y Initial program 100.0%
Taylor expanded in y around inf 82.9%
*-commutative82.9%
Simplified82.9%
Taylor expanded in y around inf 82.9%
if -1.4499999999999999e54 < y < 3.6e34Initial program 100.0%
Taylor expanded in y around 0 85.9%
mul-1-neg85.9%
unsub-neg85.9%
Simplified85.9%
Taylor expanded in z around inf 60.7%
Final simplification70.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.35e+157) (not (<= y 1.8e+19))) (* y (- t x)) (* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.35e+157) || !(y <= 1.8e+19)) {
tmp = y * (t - x);
} 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 ((y <= (-2.35d+157)) .or. (.not. (y <= 1.8d+19))) then
tmp = y * (t - x)
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 ((y <= -2.35e+157) || !(y <= 1.8e+19)) {
tmp = y * (t - x);
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.35e+157) or not (y <= 1.8e+19): tmp = y * (t - x) else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.35e+157) || !(y <= 1.8e+19)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(Float64(y - z) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.35e+157) || ~((y <= 1.8e+19))) tmp = y * (t - x); else tmp = (y - z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.35e+157], N[Not[LessEqual[y, 1.8e+19]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.35 \cdot 10^{+157} \lor \neg \left(y \leq 1.8 \cdot 10^{+19}\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if y < -2.35000000000000015e157 or 1.8e19 < y Initial program 100.0%
Taylor expanded in y around inf 90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in y around inf 90.9%
if -2.35000000000000015e157 < y < 1.8e19Initial program 100.0%
Taylor expanded in t around inf 72.2%
Taylor expanded in t around inf 69.4%
Taylor expanded in x around 0 50.5%
Final simplification64.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.3e+136) (not (<= y 4.2e+30))) (* y t) (* z (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.3e+136) || !(y <= 4.2e+30)) {
tmp = y * t;
} 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 ((y <= (-6.3d+136)) .or. (.not. (y <= 4.2d+30))) then
tmp = y * t
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 ((y <= -6.3e+136) || !(y <= 4.2e+30)) {
tmp = y * t;
} else {
tmp = z * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.3e+136) or not (y <= 4.2e+30): tmp = y * t else: tmp = z * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.3e+136) || !(y <= 4.2e+30)) tmp = Float64(y * t); else tmp = Float64(z * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6.3e+136) || ~((y <= 4.2e+30))) tmp = y * t; else tmp = z * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.3e+136], N[Not[LessEqual[y, 4.2e+30]], $MachinePrecision]], N[(y * t), $MachinePrecision], N[(z * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.3 \cdot 10^{+136} \lor \neg \left(y \leq 4.2 \cdot 10^{+30}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\end{array}
\end{array}
if y < -6.2999999999999997e136 or 4.2e30 < y Initial program 100.0%
Taylor expanded in t around inf 56.5%
Taylor expanded in t around inf 61.8%
Taylor expanded in y around inf 50.8%
if -6.2999999999999997e136 < y < 4.2e30Initial program 100.0%
Taylor expanded in t around inf 72.0%
Taylor expanded in t around inf 69.1%
Taylor expanded in z around inf 40.1%
neg-mul-140.1%
Simplified40.1%
Final simplification43.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.3e-49) (not (<= y 2.8e-67))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.3e-49) || !(y <= 2.8e-67)) {
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 <= (-1.3d-49)) .or. (.not. (y <= 2.8d-67))) 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 <= -1.3e-49) || !(y <= 2.8e-67)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.3e-49) or not (y <= 2.8e-67): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.3e-49) || !(y <= 2.8e-67)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.3e-49) || ~((y <= 2.8e-67))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.3e-49], N[Not[LessEqual[y, 2.8e-67]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{-49} \lor \neg \left(y \leq 2.8 \cdot 10^{-67}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.29999999999999997e-49 or 2.8000000000000001e-67 < y Initial program 100.0%
Taylor expanded in t around inf 59.7%
Taylor expanded in t around inf 63.7%
Taylor expanded in y around inf 37.1%
if -1.29999999999999997e-49 < y < 2.8000000000000001e-67Initial program 100.0%
Taylor expanded in t around inf 78.7%
Taylor expanded in x around inf 38.2%
Final simplification37.5%
(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 66.6%
Taylor expanded in x around inf 16.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 2024172
(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))))