
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (fma (- y z) (- t x) x))
double code(double x, double y, double z, double t) {
return fma((y - z), (t - x), x);
}
function code(x, y, z, t) return fma(Float64(y - z), Float64(t - x), x) end
code[x_, y_, z_, t_] := N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - z, t - x, x\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -2e+230)
(* z x)
(if (<= z -2.2e+70)
t_1
(if (<= z -8e-272)
(* y t)
(if (<= z 1.65e-271)
x
(if (<= z 8.8e-189)
(* y t)
(if (<= z 1.2e-163) x (if (<= z 7.2e-64) (* y t) t_1)))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -2e+230) {
tmp = z * x;
} else if (z <= -2.2e+70) {
tmp = t_1;
} else if (z <= -8e-272) {
tmp = y * t;
} else if (z <= 1.65e-271) {
tmp = x;
} else if (z <= 8.8e-189) {
tmp = y * t;
} else if (z <= 1.2e-163) {
tmp = x;
} else if (z <= 7.2e-64) {
tmp = 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 = z * -t
if (z <= (-2d+230)) then
tmp = z * x
else if (z <= (-2.2d+70)) then
tmp = t_1
else if (z <= (-8d-272)) then
tmp = y * t
else if (z <= 1.65d-271) then
tmp = x
else if (z <= 8.8d-189) then
tmp = y * t
else if (z <= 1.2d-163) then
tmp = x
else if (z <= 7.2d-64) then
tmp = 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 = z * -t;
double tmp;
if (z <= -2e+230) {
tmp = z * x;
} else if (z <= -2.2e+70) {
tmp = t_1;
} else if (z <= -8e-272) {
tmp = y * t;
} else if (z <= 1.65e-271) {
tmp = x;
} else if (z <= 8.8e-189) {
tmp = y * t;
} else if (z <= 1.2e-163) {
tmp = x;
} else if (z <= 7.2e-64) {
tmp = y * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -2e+230: tmp = z * x elif z <= -2.2e+70: tmp = t_1 elif z <= -8e-272: tmp = y * t elif z <= 1.65e-271: tmp = x elif z <= 8.8e-189: tmp = y * t elif z <= 1.2e-163: tmp = x elif z <= 7.2e-64: tmp = y * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -2e+230) tmp = Float64(z * x); elseif (z <= -2.2e+70) tmp = t_1; elseif (z <= -8e-272) tmp = Float64(y * t); elseif (z <= 1.65e-271) tmp = x; elseif (z <= 8.8e-189) tmp = Float64(y * t); elseif (z <= 1.2e-163) tmp = x; elseif (z <= 7.2e-64) tmp = Float64(y * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (z <= -2e+230) tmp = z * x; elseif (z <= -2.2e+70) tmp = t_1; elseif (z <= -8e-272) tmp = y * t; elseif (z <= 1.65e-271) tmp = x; elseif (z <= 8.8e-189) tmp = y * t; elseif (z <= 1.2e-163) tmp = x; elseif (z <= 7.2e-64) tmp = y * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -2e+230], N[(z * x), $MachinePrecision], If[LessEqual[z, -2.2e+70], t$95$1, If[LessEqual[z, -8e-272], N[(y * t), $MachinePrecision], If[LessEqual[z, 1.65e-271], x, If[LessEqual[z, 8.8e-189], N[(y * t), $MachinePrecision], If[LessEqual[z, 1.2e-163], x, If[LessEqual[z, 7.2e-64], N[(y * t), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -2 \cdot 10^{+230}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -2.2 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -8 \cdot 10^{-272}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-271}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{-189}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-163}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-64}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.0000000000000002e230Initial program 99.9%
Taylor expanded in t around 0 77.4%
mul-1-neg77.4%
distribute-rgt-neg-in77.4%
neg-sub077.4%
sub-neg77.4%
+-commutative77.4%
associate--r+77.4%
neg-sub077.4%
remove-double-neg77.4%
Simplified77.4%
Taylor expanded in z around inf 71.1%
Taylor expanded in z around inf 71.1%
if -2.0000000000000002e230 < z < -2.20000000000000001e70 or 7.1999999999999996e-64 < z Initial program 99.9%
Taylor expanded in t around inf 59.5%
Taylor expanded in t around inf 63.7%
Taylor expanded in z around inf 45.7%
associate-*r*45.7%
*-commutative45.7%
mul-1-neg45.7%
Simplified45.7%
if -2.20000000000000001e70 < z < -7.99999999999999944e-272 or 1.6500000000000001e-271 < z < 8.80000000000000076e-189 or 1.2e-163 < z < 7.1999999999999996e-64Initial program 100.0%
Taylor expanded in t around inf 68.8%
Taylor expanded in z around 0 61.7%
Taylor expanded in x around 0 44.6%
*-commutative44.6%
Simplified44.6%
if -7.99999999999999944e-272 < z < 1.6500000000000001e-271 or 8.80000000000000076e-189 < z < 1.2e-163Initial program 100.0%
Taylor expanded in t around inf 78.7%
Taylor expanded in x around inf 59.9%
Final simplification48.0%
(FPCore (x y z t)
:precision binary64
(if (or (<= t -2.6e+14)
(and (not (<= t -7.2e-15)) (or (<= t -5.5e-131) (not (<= t 8e+75)))))
(- x (* t (- z y)))
(+ x (* x (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.6e+14) || (!(t <= -7.2e-15) && ((t <= -5.5e-131) || !(t <= 8e+75)))) {
tmp = x - (t * (z - y));
} else {
tmp = x + (x * (z - 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 ((t <= (-2.6d+14)) .or. (.not. (t <= (-7.2d-15))) .and. (t <= (-5.5d-131)) .or. (.not. (t <= 8d+75))) then
tmp = x - (t * (z - y))
else
tmp = x + (x * (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.6e+14) || (!(t <= -7.2e-15) && ((t <= -5.5e-131) || !(t <= 8e+75)))) {
tmp = x - (t * (z - y));
} else {
tmp = x + (x * (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.6e+14) or (not (t <= -7.2e-15) and ((t <= -5.5e-131) or not (t <= 8e+75))): tmp = x - (t * (z - y)) else: tmp = x + (x * (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.6e+14) || (!(t <= -7.2e-15) && ((t <= -5.5e-131) || !(t <= 8e+75)))) tmp = Float64(x - Float64(t * Float64(z - y))); else tmp = Float64(x + Float64(x * Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.6e+14) || (~((t <= -7.2e-15)) && ((t <= -5.5e-131) || ~((t <= 8e+75))))) tmp = x - (t * (z - y)); else tmp = x + (x * (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.6e+14], And[N[Not[LessEqual[t, -7.2e-15]], $MachinePrecision], Or[LessEqual[t, -5.5e-131], N[Not[LessEqual[t, 8e+75]], $MachinePrecision]]]], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.6 \cdot 10^{+14} \lor \neg \left(t \leq -7.2 \cdot 10^{-15}\right) \land \left(t \leq -5.5 \cdot 10^{-131} \lor \neg \left(t \leq 8 \cdot 10^{+75}\right)\right):\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\end{array}
\end{array}
if t < -2.6e14 or -7.2000000000000002e-15 < t < -5.4999999999999997e-131 or 7.99999999999999941e75 < t Initial program 99.9%
Taylor expanded in t around inf 86.0%
if -2.6e14 < t < -7.2000000000000002e-15 or -5.4999999999999997e-131 < t < 7.99999999999999941e75Initial program 100.0%
Taylor expanded in t around 0 83.2%
mul-1-neg83.2%
distribute-rgt-neg-in83.2%
neg-sub083.2%
sub-neg83.2%
+-commutative83.2%
associate--r+83.2%
neg-sub083.2%
remove-double-neg83.2%
Simplified83.2%
Final simplification84.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (* t (- z y)))))
(if (<= t -4.7e+58)
t_1
(if (<= t -1.25e-15)
(+ x (* y (- t x)))
(if (or (<= t -5.5e-131) (not (<= t 2.3e+74)))
t_1
(+ x (* x (- z y))))))))
double code(double x, double y, double z, double t) {
double t_1 = x - (t * (z - y));
double tmp;
if (t <= -4.7e+58) {
tmp = t_1;
} else if (t <= -1.25e-15) {
tmp = x + (y * (t - x));
} else if ((t <= -5.5e-131) || !(t <= 2.3e+74)) {
tmp = t_1;
} else {
tmp = x + (x * (z - 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) :: t_1
real(8) :: tmp
t_1 = x - (t * (z - y))
if (t <= (-4.7d+58)) then
tmp = t_1
else if (t <= (-1.25d-15)) then
tmp = x + (y * (t - x))
else if ((t <= (-5.5d-131)) .or. (.not. (t <= 2.3d+74))) then
tmp = t_1
else
tmp = x + (x * (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x - (t * (z - y));
double tmp;
if (t <= -4.7e+58) {
tmp = t_1;
} else if (t <= -1.25e-15) {
tmp = x + (y * (t - x));
} else if ((t <= -5.5e-131) || !(t <= 2.3e+74)) {
tmp = t_1;
} else {
tmp = x + (x * (z - y));
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (t * (z - y)) tmp = 0 if t <= -4.7e+58: tmp = t_1 elif t <= -1.25e-15: tmp = x + (y * (t - x)) elif (t <= -5.5e-131) or not (t <= 2.3e+74): tmp = t_1 else: tmp = x + (x * (z - y)) return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(t * Float64(z - y))) tmp = 0.0 if (t <= -4.7e+58) tmp = t_1; elseif (t <= -1.25e-15) tmp = Float64(x + Float64(y * Float64(t - x))); elseif ((t <= -5.5e-131) || !(t <= 2.3e+74)) tmp = t_1; else tmp = Float64(x + Float64(x * Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (t * (z - y)); tmp = 0.0; if (t <= -4.7e+58) tmp = t_1; elseif (t <= -1.25e-15) tmp = x + (y * (t - x)); elseif ((t <= -5.5e-131) || ~((t <= 2.3e+74))) tmp = t_1; else tmp = x + (x * (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4.7e+58], t$95$1, If[LessEqual[t, -1.25e-15], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, -5.5e-131], N[Not[LessEqual[t, 2.3e+74]], $MachinePrecision]], t$95$1, N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - t \cdot \left(z - y\right)\\
\mathbf{if}\;t \leq -4.7 \cdot 10^{+58}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.25 \cdot 10^{-15}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{elif}\;t \leq -5.5 \cdot 10^{-131} \lor \neg \left(t \leq 2.3 \cdot 10^{+74}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\end{array}
\end{array}
if t < -4.69999999999999972e58 or -1.25e-15 < t < -5.4999999999999997e-131 or 2.2999999999999999e74 < t Initial program 99.9%
Taylor expanded in t around inf 87.3%
if -4.69999999999999972e58 < t < -1.25e-15Initial program 100.0%
Taylor expanded in y around inf 86.5%
*-commutative86.5%
Simplified86.5%
if -5.4999999999999997e-131 < t < 2.2999999999999999e74Initial program 100.0%
Taylor expanded in t around 0 82.2%
mul-1-neg82.2%
distribute-rgt-neg-in82.2%
neg-sub082.2%
sub-neg82.2%
+-commutative82.2%
associate--r+82.2%
neg-sub082.2%
remove-double-neg82.2%
Simplified82.2%
Final simplification85.2%
(FPCore (x y z t)
:precision binary64
(if (or (<= t -3.5e+32)
(and (not (<= t -9e-13)) (or (<= t -3.8e-103) (not (<= t 2.9e-11)))))
(* t (- y z))
(* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.5e+32) || (!(t <= -9e-13) && ((t <= -3.8e-103) || !(t <= 2.9e-11)))) {
tmp = t * (y - 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 ((t <= (-3.5d+32)) .or. (.not. (t <= (-9d-13))) .and. (t <= (-3.8d-103)) .or. (.not. (t <= 2.9d-11))) then
tmp = t * (y - 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 ((t <= -3.5e+32) || (!(t <= -9e-13) && ((t <= -3.8e-103) || !(t <= 2.9e-11)))) {
tmp = t * (y - z);
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.5e+32) or (not (t <= -9e-13) and ((t <= -3.8e-103) or not (t <= 2.9e-11))): tmp = t * (y - z) else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.5e+32) || (!(t <= -9e-13) && ((t <= -3.8e-103) || !(t <= 2.9e-11)))) tmp = Float64(t * Float64(y - 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 ((t <= -3.5e+32) || (~((t <= -9e-13)) && ((t <= -3.8e-103) || ~((t <= 2.9e-11))))) tmp = t * (y - z); else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.5e+32], And[N[Not[LessEqual[t, -9e-13]], $MachinePrecision], Or[LessEqual[t, -3.8e-103], N[Not[LessEqual[t, 2.9e-11]], $MachinePrecision]]]], N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.5 \cdot 10^{+32} \lor \neg \left(t \leq -9 \cdot 10^{-13}\right) \land \left(t \leq -3.8 \cdot 10^{-103} \lor \neg \left(t \leq 2.9 \cdot 10^{-11}\right)\right):\\
\;\;\;\;t \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if t < -3.5000000000000001e32 or -9e-13 < t < -3.8000000000000001e-103 or 2.9e-11 < t Initial program 100.0%
Taylor expanded in t around inf 83.4%
Taylor expanded in t around inf 85.2%
Taylor expanded in t around inf 73.2%
if -3.5000000000000001e32 < t < -9e-13 or -3.8000000000000001e-103 < t < 2.9e-11Initial program 99.9%
Taylor expanded in y around inf 67.3%
*-commutative67.3%
Simplified67.3%
Taylor expanded in x around inf 58.1%
mul-1-neg58.1%
unsub-neg58.1%
Simplified58.1%
Final simplification67.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* y (- t x)))))
(if (<= y -4.8e+161)
t_1
(if (<= y -2e-78)
(- x (* t (- z y)))
(if (<= y 1.8e-12) (+ x (* z (- x t))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x + (y * (t - x));
double tmp;
if (y <= -4.8e+161) {
tmp = t_1;
} else if (y <= -2e-78) {
tmp = x - (t * (z - y));
} else if (y <= 1.8e-12) {
tmp = x + (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 = x + (y * (t - x))
if (y <= (-4.8d+161)) then
tmp = t_1
else if (y <= (-2d-78)) then
tmp = x - (t * (z - y))
else if (y <= 1.8d-12) then
tmp = x + (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 = x + (y * (t - x));
double tmp;
if (y <= -4.8e+161) {
tmp = t_1;
} else if (y <= -2e-78) {
tmp = x - (t * (z - y));
} else if (y <= 1.8e-12) {
tmp = x + (z * (x - t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (y * (t - x)) tmp = 0 if y <= -4.8e+161: tmp = t_1 elif y <= -2e-78: tmp = x - (t * (z - y)) elif y <= 1.8e-12: tmp = x + (z * (x - t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(y * Float64(t - x))) tmp = 0.0 if (y <= -4.8e+161) tmp = t_1; elseif (y <= -2e-78) tmp = Float64(x - Float64(t * Float64(z - y))); elseif (y <= 1.8e-12) tmp = Float64(x + Float64(z * Float64(x - t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (y * (t - x)); tmp = 0.0; if (y <= -4.8e+161) tmp = t_1; elseif (y <= -2e-78) tmp = x - (t * (z - y)); elseif (y <= 1.8e-12) tmp = x + (z * (x - t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.8e+161], t$95$1, If[LessEqual[y, -2e-78], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e-12], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{+161}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2 \cdot 10^{-78}:\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-12}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.7999999999999998e161 or 1.8e-12 < y Initial program 100.0%
Taylor expanded in y around inf 85.0%
*-commutative85.0%
Simplified85.0%
if -4.7999999999999998e161 < y < -2e-78Initial program 100.0%
Taylor expanded in t around inf 76.8%
if -2e-78 < y < 1.8e-12Initial program 99.9%
Taylor expanded in y around 0 93.2%
mul-1-neg93.2%
unsub-neg93.2%
Simplified93.2%
Final simplification86.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* z x))))
(if (<= x -2.4e+17)
t_1
(if (<= x 4.3e+42)
(* t (- y z))
(if (<= x 1.5e+145) t_1 (* x (- 1.0 y)))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (z * x);
double tmp;
if (x <= -2.4e+17) {
tmp = t_1;
} else if (x <= 4.3e+42) {
tmp = t * (y - z);
} else if (x <= 1.5e+145) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x + (z * x)
if (x <= (-2.4d+17)) then
tmp = t_1
else if (x <= 4.3d+42) then
tmp = t * (y - z)
else if (x <= 1.5d+145) then
tmp = t_1
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 t_1 = x + (z * x);
double tmp;
if (x <= -2.4e+17) {
tmp = t_1;
} else if (x <= 4.3e+42) {
tmp = t * (y - z);
} else if (x <= 1.5e+145) {
tmp = t_1;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (z * x) tmp = 0 if x <= -2.4e+17: tmp = t_1 elif x <= 4.3e+42: tmp = t * (y - z) elif x <= 1.5e+145: tmp = t_1 else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(z * x)) tmp = 0.0 if (x <= -2.4e+17) tmp = t_1; elseif (x <= 4.3e+42) tmp = Float64(t * Float64(y - z)); elseif (x <= 1.5e+145) tmp = t_1; else tmp = Float64(x * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (z * x); tmp = 0.0; if (x <= -2.4e+17) tmp = t_1; elseif (x <= 4.3e+42) tmp = t * (y - z); elseif (x <= 1.5e+145) tmp = t_1; else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.4e+17], t$95$1, If[LessEqual[x, 4.3e+42], N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.5e+145], t$95$1, N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot x\\
\mathbf{if}\;x \leq -2.4 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{+42}:\\
\;\;\;\;t \cdot \left(y - z\right)\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+145}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if x < -2.4e17 or 4.2999999999999998e42 < x < 1.5000000000000001e145Initial program 100.0%
Taylor expanded in t around 0 82.6%
mul-1-neg82.6%
distribute-rgt-neg-in82.6%
neg-sub082.6%
sub-neg82.6%
+-commutative82.6%
associate--r+82.6%
neg-sub082.6%
remove-double-neg82.6%
Simplified82.6%
Taylor expanded in z around inf 60.8%
if -2.4e17 < x < 4.2999999999999998e42Initial program 99.9%
Taylor expanded in t around inf 81.4%
Taylor expanded in t around inf 81.4%
Taylor expanded in t around inf 71.5%
if 1.5000000000000001e145 < x Initial program 100.0%
Taylor expanded in y around inf 76.4%
*-commutative76.4%
Simplified76.4%
Taylor expanded in x around inf 68.2%
mul-1-neg68.2%
unsub-neg68.2%
Simplified68.2%
Final simplification67.5%
(FPCore (x y z t) :precision binary64 (if (<= x -2.8e+47) (+ x (* z x)) (if (<= x 2.3e+170) (- x (* t (- z y))) (* x (- 1.0 y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.8e+47) {
tmp = x + (z * x);
} else if (x <= 2.3e+170) {
tmp = x - (t * (z - y));
} 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 (x <= (-2.8d+47)) then
tmp = x + (z * x)
else if (x <= 2.3d+170) then
tmp = x - (t * (z - y))
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 (x <= -2.8e+47) {
tmp = x + (z * x);
} else if (x <= 2.3e+170) {
tmp = x - (t * (z - y));
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.8e+47: tmp = x + (z * x) elif x <= 2.3e+170: tmp = x - (t * (z - y)) else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.8e+47) tmp = Float64(x + Float64(z * x)); elseif (x <= 2.3e+170) tmp = Float64(x - Float64(t * Float64(z - y))); else tmp = Float64(x * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.8e+47) tmp = x + (z * x); elseif (x <= 2.3e+170) tmp = x - (t * (z - y)); else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.8e+47], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.3e+170], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{+47}:\\
\;\;\;\;x + z \cdot x\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+170}:\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if x < -2.79999999999999988e47Initial program 100.0%
Taylor expanded in t around 0 85.0%
mul-1-neg85.0%
distribute-rgt-neg-in85.0%
neg-sub085.0%
sub-neg85.0%
+-commutative85.0%
associate--r+85.0%
neg-sub085.0%
remove-double-neg85.0%
Simplified85.0%
Taylor expanded in z around inf 58.7%
if -2.79999999999999988e47 < x < 2.3000000000000001e170Initial program 99.9%
Taylor expanded in t around inf 77.6%
if 2.3000000000000001e170 < x Initial program 100.0%
Taylor expanded in y around inf 78.7%
*-commutative78.7%
Simplified78.7%
Taylor expanded in x around inf 75.6%
mul-1-neg75.6%
unsub-neg75.6%
Simplified75.6%
Final simplification73.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.12e+47) (not (<= x 1.5e+201))) (* z x) (* t (- y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.12e+47) || !(x <= 1.5e+201)) {
tmp = z * x;
} else {
tmp = 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.12d+47)) .or. (.not. (x <= 1.5d+201))) then
tmp = z * x
else
tmp = 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.12e+47) || !(x <= 1.5e+201)) {
tmp = z * x;
} else {
tmp = t * (y - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.12e+47) or not (x <= 1.5e+201): tmp = z * x else: tmp = t * (y - z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.12e+47) || !(x <= 1.5e+201)) tmp = Float64(z * x); else tmp = Float64(t * Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.12e+47) || ~((x <= 1.5e+201))) tmp = z * x; else tmp = t * (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.12e+47], N[Not[LessEqual[x, 1.5e+201]], $MachinePrecision]], N[(z * x), $MachinePrecision], N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.12 \cdot 10^{+47} \lor \neg \left(x \leq 1.5 \cdot 10^{+201}\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y - z\right)\\
\end{array}
\end{array}
if x < -1.12000000000000007e47 or 1.50000000000000012e201 < x Initial program 100.0%
Taylor expanded in t around 0 89.4%
mul-1-neg89.4%
distribute-rgt-neg-in89.4%
neg-sub089.4%
sub-neg89.4%
+-commutative89.4%
associate--r+89.4%
neg-sub089.4%
remove-double-neg89.4%
Simplified89.4%
Taylor expanded in z around inf 59.1%
Taylor expanded in z around inf 40.1%
if -1.12000000000000007e47 < x < 1.50000000000000012e201Initial program 99.9%
Taylor expanded in t around inf 76.9%
Taylor expanded in t around inf 76.9%
Taylor expanded in t around inf 65.4%
Final simplification57.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6e+16) (not (<= x 1.55e+46))) (* z x) (* y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6e+16) || !(x <= 1.55e+46)) {
tmp = z * 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 ((x <= (-6d+16)) .or. (.not. (x <= 1.55d+46))) then
tmp = z * 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 ((x <= -6e+16) || !(x <= 1.55e+46)) {
tmp = z * x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6e+16) or not (x <= 1.55e+46): tmp = z * x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6e+16) || !(x <= 1.55e+46)) tmp = Float64(z * x); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -6e+16) || ~((x <= 1.55e+46))) tmp = z * x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6e+16], N[Not[LessEqual[x, 1.55e+46]], $MachinePrecision]], N[(z * x), $MachinePrecision], N[(y * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+16} \lor \neg \left(x \leq 1.55 \cdot 10^{+46}\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if x < -6e16 or 1.54999999999999988e46 < x Initial program 100.0%
Taylor expanded in t around 0 83.7%
mul-1-neg83.7%
distribute-rgt-neg-in83.7%
neg-sub083.7%
sub-neg83.7%
+-commutative83.7%
associate--r+83.7%
neg-sub083.7%
remove-double-neg83.7%
Simplified83.7%
Taylor expanded in z around inf 55.5%
Taylor expanded in z around inf 37.6%
if -6e16 < x < 1.54999999999999988e46Initial program 99.9%
Taylor expanded in t around inf 81.5%
Taylor expanded in z around 0 49.0%
Taylor expanded in x around 0 38.7%
*-commutative38.7%
Simplified38.7%
Final simplification38.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.65e+36) (not (<= z 0.034))) (* z x) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.65e+36) || !(z <= 0.034)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-2.65d+36)) .or. (.not. (z <= 0.034d0))) then
tmp = z * x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.65e+36) || !(z <= 0.034)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.65e+36) or not (z <= 0.034): tmp = z * x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.65e+36) || !(z <= 0.034)) tmp = Float64(z * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.65e+36) || ~((z <= 0.034))) tmp = z * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.65e+36], N[Not[LessEqual[z, 0.034]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{+36} \lor \neg \left(z \leq 0.034\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.65e36 or 0.034000000000000002 < z Initial program 99.9%
Taylor expanded in t around 0 51.4%
mul-1-neg51.4%
distribute-rgt-neg-in51.4%
neg-sub051.4%
sub-neg51.4%
+-commutative51.4%
associate--r+51.4%
neg-sub051.4%
remove-double-neg51.4%
Simplified51.4%
Taylor expanded in z around inf 40.7%
Taylor expanded in z around inf 40.7%
if -2.65e36 < z < 0.034000000000000002Initial program 100.0%
Taylor expanded in t around inf 73.3%
Taylor expanded in x around inf 29.2%
Final simplification34.8%
(FPCore (x y z t) :precision binary64 (+ x (* (- t x) (- y z))))
double code(double x, double y, double z, double t) {
return x + ((t - 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 - x) * (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((t - x) * (y - z));
}
def code(x, y, z, t): return x + ((t - x) * (y - z))
function code(x, y, z, t) return Float64(x + Float64(Float64(t - x) * Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x + ((t - x) * (y - z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(t - x), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t - x\right) \cdot \left(y - z\right)
\end{array}
Initial program 100.0%
Final simplification100.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 64.3%
Taylor expanded in x around inf 16.2%
(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 2024088
(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))))