
(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 (- x (* (- x t) (- y z))))
double code(double x, double y, double z, double t) {
return x - ((x - t) * (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 - ((x - t) * (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x - ((x - t) * (y - z));
}
def code(x, y, z, t): return x - ((x - t) * (y - z))
function code(x, y, z, t) return Float64(x - Float64(Float64(x - t) * Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x - ((x - t) * (y - z)); end
code[x_, y_, z_, t_] := N[(x - N[(N[(x - t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(x - t\right) \cdot \left(y - z\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -9.2e-35)
t_1
(if (<= y 3.2e-186) (* x z) (if (<= y 3.2e-23) x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -9.2e-35) {
tmp = t_1;
} else if (y <= 3.2e-186) {
tmp = x * z;
} else if (y <= 3.2e-23) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * (t - x)
if (y <= (-9.2d-35)) then
tmp = t_1
else if (y <= 3.2d-186) then
tmp = x * z
else if (y <= 3.2d-23) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -9.2e-35) {
tmp = t_1;
} else if (y <= 3.2e-186) {
tmp = x * z;
} else if (y <= 3.2e-23) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -9.2e-35: tmp = t_1 elif y <= 3.2e-186: tmp = x * z elif y <= 3.2e-23: tmp = 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 <= -9.2e-35) tmp = t_1; elseif (y <= 3.2e-186) tmp = Float64(x * z); elseif (y <= 3.2e-23) tmp = 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 <= -9.2e-35) tmp = t_1; elseif (y <= 3.2e-186) tmp = x * z; elseif (y <= 3.2e-23) tmp = 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, -9.2e-35], t$95$1, If[LessEqual[y, 3.2e-186], N[(x * z), $MachinePrecision], If[LessEqual[y, 3.2e-23], x, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -9.2 \cdot 10^{-35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{-186}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{-23}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.1999999999999996e-35 or 3.19999999999999976e-23 < y Initial program 100.0%
Taylor expanded in y around inf 79.3%
*-commutative79.3%
Simplified79.3%
Taylor expanded in x around 0 76.4%
Taylor expanded in y around inf 78.6%
mul-1-neg78.6%
unsub-neg78.6%
Simplified78.6%
if -9.1999999999999996e-35 < y < 3.2e-186Initial program 100.0%
Taylor expanded in t around 0 59.1%
mul-1-neg59.1%
distribute-rgt-neg-in59.1%
sub-neg59.1%
+-commutative59.1%
distribute-neg-in59.1%
remove-double-neg59.1%
sub-neg59.1%
Simplified59.1%
Taylor expanded in z around inf 59.1%
Taylor expanded in z around inf 35.0%
*-commutative35.0%
Simplified35.0%
if 3.2e-186 < y < 3.19999999999999976e-23Initial program 100.0%
Taylor expanded in y around inf 60.3%
*-commutative60.3%
Simplified60.3%
Taylor expanded in y around 0 47.7%
Final simplification60.4%
(FPCore (x y z t) :precision binary64 (if (<= z -3e+52) (* x z) (if (<= z 1.4e-249) (* y t) (if (<= z 6.8e+33) (* x (- y)) (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3e+52) {
tmp = x * z;
} else if (z <= 1.4e-249) {
tmp = y * t;
} else if (z <= 6.8e+33) {
tmp = x * -y;
} else {
tmp = x * 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 (z <= (-3d+52)) then
tmp = x * z
else if (z <= 1.4d-249) then
tmp = y * t
else if (z <= 6.8d+33) then
tmp = x * -y
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3e+52) {
tmp = x * z;
} else if (z <= 1.4e-249) {
tmp = y * t;
} else if (z <= 6.8e+33) {
tmp = x * -y;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3e+52: tmp = x * z elif z <= 1.4e-249: tmp = y * t elif z <= 6.8e+33: tmp = x * -y else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3e+52) tmp = Float64(x * z); elseif (z <= 1.4e-249) tmp = Float64(y * t); elseif (z <= 6.8e+33) tmp = Float64(x * Float64(-y)); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3e+52) tmp = x * z; elseif (z <= 1.4e-249) tmp = y * t; elseif (z <= 6.8e+33) tmp = x * -y; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3e+52], N[(x * z), $MachinePrecision], If[LessEqual[z, 1.4e-249], N[(y * t), $MachinePrecision], If[LessEqual[z, 6.8e+33], N[(x * (-y)), $MachinePrecision], N[(x * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+52}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-249}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+33}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -3e52 or 6.7999999999999999e33 < z Initial program 100.0%
Taylor expanded in t around 0 58.7%
mul-1-neg58.7%
distribute-rgt-neg-in58.7%
sub-neg58.7%
+-commutative58.7%
distribute-neg-in58.7%
remove-double-neg58.7%
sub-neg58.7%
Simplified58.7%
Taylor expanded in z around inf 48.4%
Taylor expanded in z around inf 48.4%
*-commutative48.4%
Simplified48.4%
if -3e52 < z < 1.4e-249Initial program 100.0%
Taylor expanded in y around inf 91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in x around 0 88.8%
Taylor expanded in y around inf 65.0%
mul-1-neg65.0%
unsub-neg65.0%
Simplified65.0%
Taylor expanded in t around inf 46.1%
if 1.4e-249 < z < 6.7999999999999999e33Initial program 100.0%
Taylor expanded in y around inf 78.6%
*-commutative78.6%
Simplified78.6%
Taylor expanded in x around 0 75.2%
Taylor expanded in y around inf 57.5%
mul-1-neg57.5%
unsub-neg57.5%
Simplified57.5%
Taylor expanded in t around 0 40.4%
neg-mul-140.4%
Simplified40.4%
Final simplification45.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.22e-34) (not (<= y 0.0136))) (- x (* y (- x t))) (+ x (* z (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.22e-34) || !(y <= 0.0136)) {
tmp = x - (y * (x - t));
} else {
tmp = x + (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.22d-34)) .or. (.not. (y <= 0.0136d0))) then
tmp = x - (y * (x - t))
else
tmp = x + (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.22e-34) || !(y <= 0.0136)) {
tmp = x - (y * (x - t));
} else {
tmp = x + (z * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.22e-34) or not (y <= 0.0136): tmp = x - (y * (x - t)) else: tmp = x + (z * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.22e-34) || !(y <= 0.0136)) tmp = Float64(x - Float64(y * Float64(x - t))); else tmp = Float64(x + Float64(z * Float64(x - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.22e-34) || ~((y <= 0.0136))) tmp = x - (y * (x - t)); else tmp = x + (z * (x - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.22e-34], N[Not[LessEqual[y, 0.0136]], $MachinePrecision]], N[(x - N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.22 \cdot 10^{-34} \lor \neg \left(y \leq 0.0136\right):\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\end{array}
\end{array}
if y < -1.22e-34 or 0.0135999999999999992 < y Initial program 100.0%
Taylor expanded in y around inf 82.5%
*-commutative82.5%
Simplified82.5%
if -1.22e-34 < y < 0.0135999999999999992Initial program 100.0%
Taylor expanded in y around 0 91.5%
mul-1-neg91.5%
unsub-neg91.5%
Simplified91.5%
Final simplification86.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.02e-80) (not (<= x 1.25e+31))) (- x (* x (- y z))) (+ x (* t (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.02e-80) || !(x <= 1.25e+31)) {
tmp = x - (x * (y - z));
} else {
tmp = x + (t * (y - 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 <= (-1.02d-80)) .or. (.not. (x <= 1.25d+31))) then
tmp = x - (x * (y - z))
else
tmp = x + (t * (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.02e-80) || !(x <= 1.25e+31)) {
tmp = x - (x * (y - z));
} else {
tmp = x + (t * (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.02e-80) or not (x <= 1.25e+31): tmp = x - (x * (y - z)) else: tmp = x + (t * (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.02e-80) || !(x <= 1.25e+31)) tmp = Float64(x - Float64(x * Float64(y - z))); else tmp = Float64(x + Float64(t * Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.02e-80) || ~((x <= 1.25e+31))) tmp = x - (x * (y - z)); else tmp = x + (t * (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.02e-80], N[Not[LessEqual[x, 1.25e+31]], $MachinePrecision]], N[(x - N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.02 \cdot 10^{-80} \lor \neg \left(x \leq 1.25 \cdot 10^{+31}\right):\\
\;\;\;\;x - x \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \left(y - z\right)\\
\end{array}
\end{array}
if x < -1.02000000000000005e-80 or 1.25000000000000007e31 < 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 -1.02000000000000005e-80 < x < 1.25000000000000007e31Initial program 100.0%
Taylor expanded in t around inf 84.4%
Final simplification85.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -25000000000.0) (not (<= z 1.55e+83))) (- x (* x (- y z))) (- x (* y (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -25000000000.0) || !(z <= 1.55e+83)) {
tmp = x - (x * (y - z));
} 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 <= (-25000000000.0d0)) .or. (.not. (z <= 1.55d+83))) then
tmp = x - (x * (y - z))
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 <= -25000000000.0) || !(z <= 1.55e+83)) {
tmp = x - (x * (y - z));
} else {
tmp = x - (y * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -25000000000.0) or not (z <= 1.55e+83): tmp = x - (x * (y - z)) else: tmp = x - (y * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -25000000000.0) || !(z <= 1.55e+83)) tmp = Float64(x - Float64(x * Float64(y - z))); 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 <= -25000000000.0) || ~((z <= 1.55e+83))) tmp = x - (x * (y - z)); else tmp = x - (y * (x - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -25000000000.0], N[Not[LessEqual[z, 1.55e+83]], $MachinePrecision]], N[(x - N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -25000000000 \lor \neg \left(z \leq 1.55 \cdot 10^{+83}\right):\\
\;\;\;\;x - x \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\end{array}
\end{array}
if z < -2.5e10 or 1.54999999999999996e83 < z Initial program 100.0%
Taylor expanded in t around 0 63.7%
mul-1-neg63.7%
distribute-rgt-neg-in63.7%
sub-neg63.7%
+-commutative63.7%
distribute-neg-in63.7%
remove-double-neg63.7%
sub-neg63.7%
Simplified63.7%
if -2.5e10 < z < 1.54999999999999996e83Initial program 100.0%
Taylor expanded in y around inf 82.8%
*-commutative82.8%
Simplified82.8%
Final simplification75.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9.6e-41) (not (<= y 2.1))) (* y (- t x)) (- x (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.6e-41) || !(y <= 2.1)) {
tmp = y * (t - x);
} 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 ((y <= (-9.6d-41)) .or. (.not. (y <= 2.1d0))) then
tmp = y * (t - x)
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 ((y <= -9.6e-41) || !(y <= 2.1)) {
tmp = y * (t - x);
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -9.6e-41) or not (y <= 2.1): tmp = y * (t - x) else: tmp = x - (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -9.6e-41) || !(y <= 2.1)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(x - Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -9.6e-41) || ~((y <= 2.1))) tmp = y * (t - x); else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -9.6e-41], N[Not[LessEqual[y, 2.1]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.6 \cdot 10^{-41} \lor \neg \left(y \leq 2.1\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if y < -9.60000000000000087e-41 or 2.10000000000000009 < y Initial program 100.0%
Taylor expanded in y around inf 80.9%
*-commutative80.9%
Simplified80.9%
Taylor expanded in x around 0 78.0%
Taylor expanded in y around inf 80.3%
mul-1-neg80.3%
unsub-neg80.3%
Simplified80.3%
if -9.60000000000000087e-41 < y < 2.10000000000000009Initial program 100.0%
Taylor expanded in y around 0 92.0%
mul-1-neg92.0%
unsub-neg92.0%
Simplified92.0%
Taylor expanded in t around inf 66.5%
Final simplification73.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.22e-34) (not (<= y 0.049))) (* y (- t x)) (+ x (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.22e-34) || !(y <= 0.049)) {
tmp = y * (t - x);
} else {
tmp = x + (x * 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 ((y <= (-1.22d-34)) .or. (.not. (y <= 0.049d0))) then
tmp = y * (t - x)
else
tmp = x + (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.22e-34) || !(y <= 0.049)) {
tmp = y * (t - x);
} else {
tmp = x + (x * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.22e-34) or not (y <= 0.049): tmp = y * (t - x) else: tmp = x + (x * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.22e-34) || !(y <= 0.049)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(x + Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.22e-34) || ~((y <= 0.049))) tmp = y * (t - x); else tmp = x + (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.22e-34], N[Not[LessEqual[y, 0.049]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.22 \cdot 10^{-34} \lor \neg \left(y \leq 0.049\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot z\\
\end{array}
\end{array}
if y < -1.22e-34 or 0.049000000000000002 < y Initial program 100.0%
Taylor expanded in y around inf 82.5%
*-commutative82.5%
Simplified82.5%
Taylor expanded in x around 0 79.5%
Taylor expanded in y around inf 81.9%
mul-1-neg81.9%
unsub-neg81.9%
Simplified81.9%
if -1.22e-34 < y < 0.049000000000000002Initial program 100.0%
Taylor expanded in t around 0 59.4%
mul-1-neg59.4%
distribute-rgt-neg-in59.4%
sub-neg59.4%
+-commutative59.4%
distribute-neg-in59.4%
remove-double-neg59.4%
sub-neg59.4%
Simplified59.4%
Taylor expanded in z around inf 59.4%
Final simplification71.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.5e+74) (not (<= z 3.8e+33))) (* x z) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.5e+74) || !(z <= 3.8e+33)) {
tmp = x * z;
} 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 <= (-7.5d+74)) .or. (.not. (z <= 3.8d+33))) then
tmp = x * z
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 <= -7.5e+74) || !(z <= 3.8e+33)) {
tmp = x * z;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.5e+74) or not (z <= 3.8e+33): tmp = x * z else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.5e+74) || !(z <= 3.8e+33)) tmp = Float64(x * z); 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 <= -7.5e+74) || ~((z <= 3.8e+33))) tmp = x * z; else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.5e+74], N[Not[LessEqual[z, 3.8e+33]], $MachinePrecision]], N[(x * z), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+74} \lor \neg \left(z \leq 3.8 \cdot 10^{+33}\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if z < -7.5e74 or 3.80000000000000002e33 < z Initial program 100.0%
Taylor expanded in t around 0 57.8%
mul-1-neg57.8%
distribute-rgt-neg-in57.8%
sub-neg57.8%
+-commutative57.8%
distribute-neg-in57.8%
remove-double-neg57.8%
sub-neg57.8%
Simplified57.8%
Taylor expanded in z around inf 50.5%
Taylor expanded in z around inf 50.5%
*-commutative50.5%
Simplified50.5%
if -7.5e74 < z < 3.80000000000000002e33Initial program 100.0%
Taylor expanded in t around 0 57.7%
mul-1-neg57.7%
distribute-rgt-neg-in57.7%
sub-neg57.7%
+-commutative57.7%
distribute-neg-in57.7%
remove-double-neg57.7%
sub-neg57.7%
Simplified57.7%
Taylor expanded in z around 0 54.0%
mul-1-neg54.0%
*-rgt-identity54.0%
distribute-rgt-neg-out54.0%
distribute-lft-in54.0%
unsub-neg54.0%
Simplified54.0%
Final simplification52.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.05e+52) (not (<= z 8.2e+81))) (* x z) (* y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.05e+52) || !(z <= 8.2e+81)) {
tmp = x * z;
} 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 ((z <= (-3.05d+52)) .or. (.not. (z <= 8.2d+81))) then
tmp = x * z
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 ((z <= -3.05e+52) || !(z <= 8.2e+81)) {
tmp = x * z;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.05e+52) or not (z <= 8.2e+81): tmp = x * z else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.05e+52) || !(z <= 8.2e+81)) tmp = Float64(x * z); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.05e+52) || ~((z <= 8.2e+81))) tmp = x * z; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.05e+52], N[Not[LessEqual[z, 8.2e+81]], $MachinePrecision]], N[(x * z), $MachinePrecision], N[(y * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.05 \cdot 10^{+52} \lor \neg \left(z \leq 8.2 \cdot 10^{+81}\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if z < -3.04999999999999998e52 or 8.20000000000000024e81 < z Initial program 100.0%
Taylor expanded in t around 0 63.1%
mul-1-neg63.1%
distribute-rgt-neg-in63.1%
sub-neg63.1%
+-commutative63.1%
distribute-neg-in63.1%
remove-double-neg63.1%
sub-neg63.1%
Simplified63.1%
Taylor expanded in z around inf 52.5%
Taylor expanded in z around inf 52.5%
*-commutative52.5%
Simplified52.5%
if -3.04999999999999998e52 < z < 8.20000000000000024e81Initial program 100.0%
Taylor expanded in y around inf 81.9%
*-commutative81.9%
Simplified81.9%
Taylor expanded in x around 0 79.5%
Taylor expanded in y around inf 59.7%
mul-1-neg59.7%
unsub-neg59.7%
Simplified59.7%
Taylor expanded in t around inf 37.8%
Final simplification43.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.2e-43) (not (<= y 9.6e-24))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.2e-43) || !(y <= 9.6e-24)) {
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.2d-43)) .or. (.not. (y <= 9.6d-24))) 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.2e-43) || !(y <= 9.6e-24)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.2e-43) or not (y <= 9.6e-24): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.2e-43) || !(y <= 9.6e-24)) 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.2e-43) || ~((y <= 9.6e-24))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.2e-43], N[Not[LessEqual[y, 9.6e-24]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{-43} \lor \neg \left(y \leq 9.6 \cdot 10^{-24}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.2000000000000001e-43 or 9.5999999999999993e-24 < y Initial program 100.0%
Taylor expanded in y around inf 77.9%
*-commutative77.9%
Simplified77.9%
Taylor expanded in x around 0 75.1%
Taylor expanded in y around inf 77.2%
mul-1-neg77.2%
unsub-neg77.2%
Simplified77.2%
Taylor expanded in t around inf 44.8%
if -1.2000000000000001e-43 < y < 9.5999999999999993e-24Initial program 100.0%
Taylor expanded in y around inf 41.2%
*-commutative41.2%
Simplified41.2%
Taylor expanded in y around 0 34.3%
Final simplification40.2%
(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 61.8%
*-commutative61.8%
Simplified61.8%
Taylor expanded in y around 0 16.7%
(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 2024138
(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))))