
(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 (+ x (* z (- x t)))))
(if (<= z -5.4e+20)
t_1
(if (<= z 8.2e-166)
(- x (* y (- x t)))
(if (<= z 1.4e+64) (- x (* t (- z y))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x + (z * (x - t));
double tmp;
if (z <= -5.4e+20) {
tmp = t_1;
} else if (z <= 8.2e-166) {
tmp = x - (y * (x - t));
} else if (z <= 1.4e+64) {
tmp = x - (t * (z - y));
} 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 * (x - t))
if (z <= (-5.4d+20)) then
tmp = t_1
else if (z <= 8.2d-166) then
tmp = x - (y * (x - t))
else if (z <= 1.4d+64) then
tmp = x - (t * (z - y))
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 * (x - t));
double tmp;
if (z <= -5.4e+20) {
tmp = t_1;
} else if (z <= 8.2e-166) {
tmp = x - (y * (x - t));
} else if (z <= 1.4e+64) {
tmp = x - (t * (z - y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (z * (x - t)) tmp = 0 if z <= -5.4e+20: tmp = t_1 elif z <= 8.2e-166: tmp = x - (y * (x - t)) elif z <= 1.4e+64: tmp = x - (t * (z - y)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(z * Float64(x - t))) tmp = 0.0 if (z <= -5.4e+20) tmp = t_1; elseif (z <= 8.2e-166) tmp = Float64(x - Float64(y * Float64(x - t))); elseif (z <= 1.4e+64) tmp = Float64(x - Float64(t * Float64(z - y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (z * (x - t)); tmp = 0.0; if (z <= -5.4e+20) tmp = t_1; elseif (z <= 8.2e-166) tmp = x - (y * (x - t)); elseif (z <= 1.4e+64) tmp = x - (t * (z - y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.4e+20], t$95$1, If[LessEqual[z, 8.2e-166], N[(x - N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e+64], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -5.4 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-166}:\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+64}:\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.4e20 or 1.40000000000000012e64 < z Initial program 100.0%
Taylor expanded in y around 0 89.3%
mul-1-neg89.3%
unsub-neg89.3%
Simplified89.3%
if -5.4e20 < z < 8.1999999999999995e-166Initial program 100.0%
Taylor expanded in y around inf 91.8%
*-commutative91.8%
Simplified91.8%
if 8.1999999999999995e-166 < z < 1.40000000000000012e64Initial program 100.0%
Taylor expanded in t around inf 79.1%
Final simplification88.3%
(FPCore (x y z t)
:precision binary64
(if (<= x -8.4e+232)
(* x (- y))
(if (or (<= x -5.2e-98) (not (<= x 1.15e-45)))
(* x (+ z 1.0))
(* z (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8.4e+232) {
tmp = x * -y;
} else if ((x <= -5.2e-98) || !(x <= 1.15e-45)) {
tmp = x * (z + 1.0);
} 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 (x <= (-8.4d+232)) then
tmp = x * -y
else if ((x <= (-5.2d-98)) .or. (.not. (x <= 1.15d-45))) then
tmp = x * (z + 1.0d0)
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 (x <= -8.4e+232) {
tmp = x * -y;
} else if ((x <= -5.2e-98) || !(x <= 1.15e-45)) {
tmp = x * (z + 1.0);
} else {
tmp = z * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -8.4e+232: tmp = x * -y elif (x <= -5.2e-98) or not (x <= 1.15e-45): tmp = x * (z + 1.0) else: tmp = z * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -8.4e+232) tmp = Float64(x * Float64(-y)); elseif ((x <= -5.2e-98) || !(x <= 1.15e-45)) tmp = Float64(x * Float64(z + 1.0)); else tmp = Float64(z * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -8.4e+232) tmp = x * -y; elseif ((x <= -5.2e-98) || ~((x <= 1.15e-45))) tmp = x * (z + 1.0); else tmp = z * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -8.4e+232], N[(x * (-y)), $MachinePrecision], If[Or[LessEqual[x, -5.2e-98], N[Not[LessEqual[x, 1.15e-45]], $MachinePrecision]], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(z * (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.4 \cdot 10^{+232}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-98} \lor \neg \left(x \leq 1.15 \cdot 10^{-45}\right):\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\end{array}
\end{array}
if x < -8.39999999999999965e232Initial program 100.0%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 89.2%
mul-1-neg89.2%
Simplified89.2%
if -8.39999999999999965e232 < x < -5.20000000000000027e-98 or 1.14999999999999996e-45 < x Initial program 100.0%
Taylor expanded in x around inf 68.4%
mul-1-neg68.4%
unsub-neg68.4%
Simplified68.4%
Taylor expanded in y around 0 45.9%
+-commutative45.9%
Simplified45.9%
if -5.20000000000000027e-98 < x < 1.14999999999999996e-45Initial program 100.0%
Taylor expanded in y around 0 64.5%
mul-1-neg64.5%
unsub-neg64.5%
Simplified64.5%
Taylor expanded in t around inf 57.5%
Taylor expanded in x around 0 53.2%
mul-1-neg53.2%
*-commutative53.2%
distribute-rgt-neg-out53.2%
Simplified53.2%
Final simplification50.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (* z t))))
(if (<= z -2.3e-20)
t_1
(if (<= z 2.1e+64) (+ x (* y t)) (if (<= z 6e+142) (* z x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x - (z * t);
double tmp;
if (z <= -2.3e-20) {
tmp = t_1;
} else if (z <= 2.1e+64) {
tmp = x + (y * t);
} else if (z <= 6e+142) {
tmp = z * x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x - (z * t)
if (z <= (-2.3d-20)) then
tmp = t_1
else if (z <= 2.1d+64) then
tmp = x + (y * t)
else if (z <= 6d+142) then
tmp = z * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x - (z * t);
double tmp;
if (z <= -2.3e-20) {
tmp = t_1;
} else if (z <= 2.1e+64) {
tmp = x + (y * t);
} else if (z <= 6e+142) {
tmp = z * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (z * t) tmp = 0 if z <= -2.3e-20: tmp = t_1 elif z <= 2.1e+64: tmp = x + (y * t) elif z <= 6e+142: tmp = z * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(z * t)) tmp = 0.0 if (z <= -2.3e-20) tmp = t_1; elseif (z <= 2.1e+64) tmp = Float64(x + Float64(y * t)); elseif (z <= 6e+142) tmp = Float64(z * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (z * t); tmp = 0.0; if (z <= -2.3e-20) tmp = t_1; elseif (z <= 2.1e+64) tmp = x + (y * t); elseif (z <= 6e+142) tmp = z * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.3e-20], t$95$1, If[LessEqual[z, 2.1e+64], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6e+142], N[(z * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - z \cdot t\\
\mathbf{if}\;z \leq -2.3 \cdot 10^{-20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+64}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+142}:\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.2999999999999999e-20 or 5.99999999999999949e142 < z Initial program 100.0%
Taylor expanded in y around 0 83.3%
mul-1-neg83.3%
unsub-neg83.3%
Simplified83.3%
Taylor expanded in t around inf 56.7%
if -2.2999999999999999e-20 < z < 2.1e64Initial program 100.0%
Taylor expanded in t around inf 76.2%
Taylor expanded in y around inf 62.6%
if 2.1e64 < z < 5.99999999999999949e142Initial program 100.0%
Taylor expanded in x around inf 76.3%
mul-1-neg76.3%
unsub-neg76.3%
Simplified76.3%
Taylor expanded in z around inf 76.3%
Final simplification61.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -450.0)
t_1
(if (<= z 1e+64) (+ x (* y t)) (if (<= z 5e+140) (* z x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -450.0) {
tmp = t_1;
} else if (z <= 1e+64) {
tmp = x + (y * t);
} else if (z <= 5e+140) {
tmp = z * x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z * -t
if (z <= (-450.0d0)) then
tmp = t_1
else if (z <= 1d+64) then
tmp = x + (y * t)
else if (z <= 5d+140) then
tmp = z * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -450.0) {
tmp = t_1;
} else if (z <= 1e+64) {
tmp = x + (y * t);
} else if (z <= 5e+140) {
tmp = z * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -450.0: tmp = t_1 elif z <= 1e+64: tmp = x + (y * t) elif z <= 5e+140: tmp = z * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -450.0) tmp = t_1; elseif (z <= 1e+64) tmp = Float64(x + Float64(y * t)); elseif (z <= 5e+140) tmp = Float64(z * x); 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 <= -450.0) tmp = t_1; elseif (z <= 1e+64) tmp = x + (y * t); elseif (z <= 5e+140) tmp = z * x; 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, -450.0], t$95$1, If[LessEqual[z, 1e+64], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e+140], N[(z * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -450:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 10^{+64}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+140}:\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -450 or 5.00000000000000008e140 < z Initial program 100.0%
Taylor expanded in y around 0 85.4%
mul-1-neg85.4%
unsub-neg85.4%
Simplified85.4%
Taylor expanded in t around inf 57.4%
Taylor expanded in x around 0 57.3%
mul-1-neg57.3%
*-commutative57.3%
distribute-rgt-neg-out57.3%
Simplified57.3%
if -450 < z < 1.00000000000000002e64Initial program 100.0%
Taylor expanded in t around inf 75.7%
Taylor expanded in y around inf 61.6%
if 1.00000000000000002e64 < z < 5.00000000000000008e140Initial program 100.0%
Taylor expanded in x around inf 76.3%
mul-1-neg76.3%
unsub-neg76.3%
Simplified76.3%
Taylor expanded in z around inf 76.3%
Final simplification61.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -9.5e+15)
t_1
(if (<= z 8.5e+63) (* x (- 1.0 y)) (if (<= z 3.8e+145) (* z x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -9.5e+15) {
tmp = t_1;
} else if (z <= 8.5e+63) {
tmp = x * (1.0 - y);
} else if (z <= 3.8e+145) {
tmp = z * x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z * -t
if (z <= (-9.5d+15)) then
tmp = t_1
else if (z <= 8.5d+63) then
tmp = x * (1.0d0 - y)
else if (z <= 3.8d+145) then
tmp = z * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -9.5e+15) {
tmp = t_1;
} else if (z <= 8.5e+63) {
tmp = x * (1.0 - y);
} else if (z <= 3.8e+145) {
tmp = z * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -9.5e+15: tmp = t_1 elif z <= 8.5e+63: tmp = x * (1.0 - y) elif z <= 3.8e+145: tmp = z * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -9.5e+15) tmp = t_1; elseif (z <= 8.5e+63) tmp = Float64(x * Float64(1.0 - y)); elseif (z <= 3.8e+145) tmp = Float64(z * x); 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 <= -9.5e+15) tmp = t_1; elseif (z <= 8.5e+63) tmp = x * (1.0 - y); elseif (z <= 3.8e+145) tmp = z * x; 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, -9.5e+15], t$95$1, If[LessEqual[z, 8.5e+63], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.8e+145], N[(z * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{+15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+63}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+145}:\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.5e15 or 3.80000000000000012e145 < z Initial program 100.0%
Taylor expanded in y around 0 87.0%
mul-1-neg87.0%
unsub-neg87.0%
Simplified87.0%
Taylor expanded in t around inf 58.1%
Taylor expanded in x around 0 58.0%
mul-1-neg58.0%
*-commutative58.0%
distribute-rgt-neg-out58.0%
Simplified58.0%
if -9.5e15 < z < 8.5000000000000004e63Initial program 100.0%
Taylor expanded in x around inf 45.9%
mul-1-neg45.9%
unsub-neg45.9%
Simplified45.9%
Taylor expanded in z around 0 44.8%
if 8.5000000000000004e63 < z < 3.80000000000000012e145Initial program 100.0%
Taylor expanded in x around inf 76.3%
mul-1-neg76.3%
unsub-neg76.3%
Simplified76.3%
Taylor expanded in z around inf 76.3%
Final simplification52.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -8.6e-123) (not (<= t 3.1e-5))) (- x (* t (- z y))) (* x (+ (- z y) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8.6e-123) || !(t <= 3.1e-5)) {
tmp = x - (t * (z - y));
} else {
tmp = x * ((z - y) + 1.0);
}
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 <= (-8.6d-123)) .or. (.not. (t <= 3.1d-5))) then
tmp = x - (t * (z - y))
else
tmp = x * ((z - y) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8.6e-123) || !(t <= 3.1e-5)) {
tmp = x - (t * (z - y));
} else {
tmp = x * ((z - y) + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -8.6e-123) or not (t <= 3.1e-5): tmp = x - (t * (z - y)) else: tmp = x * ((z - y) + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -8.6e-123) || !(t <= 3.1e-5)) tmp = Float64(x - Float64(t * Float64(z - y))); else tmp = Float64(x * Float64(Float64(z - y) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -8.6e-123) || ~((t <= 3.1e-5))) tmp = x - (t * (z - y)); else tmp = x * ((z - y) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -8.6e-123], N[Not[LessEqual[t, 3.1e-5]], $MachinePrecision]], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.6 \cdot 10^{-123} \lor \neg \left(t \leq 3.1 \cdot 10^{-5}\right):\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\end{array}
\end{array}
if t < -8.60000000000000064e-123 or 3.10000000000000014e-5 < t Initial program 100.0%
Taylor expanded in t around inf 85.6%
if -8.60000000000000064e-123 < t < 3.10000000000000014e-5Initial program 100.0%
Taylor expanded in x around inf 84.2%
mul-1-neg84.2%
unsub-neg84.2%
Simplified84.2%
Final simplification85.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.2e-13) (not (<= y 6.2e-35))) (- x (* y (- x t))) (- x (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.2e-13) || !(y <= 6.2e-35)) {
tmp = x - (y * (x - 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 ((y <= (-3.2d-13)) .or. (.not. (y <= 6.2d-35))) then
tmp = x - (y * (x - 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 ((y <= -3.2e-13) || !(y <= 6.2e-35)) {
tmp = x - (y * (x - t));
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.2e-13) or not (y <= 6.2e-35): tmp = x - (y * (x - t)) else: tmp = x - (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.2e-13) || !(y <= 6.2e-35)) tmp = Float64(x - Float64(y * Float64(x - t))); else tmp = Float64(x - Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.2e-13) || ~((y <= 6.2e-35))) tmp = x - (y * (x - t)); else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.2e-13], N[Not[LessEqual[y, 6.2e-35]], $MachinePrecision]], N[(x - N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{-13} \lor \neg \left(y \leq 6.2 \cdot 10^{-35}\right):\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if y < -3.2e-13 or 6.20000000000000024e-35 < y Initial program 100.0%
Taylor expanded in y around inf 74.3%
*-commutative74.3%
Simplified74.3%
if -3.2e-13 < y < 6.20000000000000024e-35Initial program 100.0%
Taylor expanded in y around 0 93.5%
mul-1-neg93.5%
unsub-neg93.5%
Simplified93.5%
Taylor expanded in t around inf 75.5%
Final simplification74.8%
(FPCore (x y z t) :precision binary64 (if (<= t -20000.0) (+ x (* y t)) (if (<= t 2.1e-5) (* x (+ (- z y) 1.0)) (- x (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -20000.0) {
tmp = x + (y * t);
} else if (t <= 2.1e-5) {
tmp = x * ((z - y) + 1.0);
} 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 (t <= (-20000.0d0)) then
tmp = x + (y * t)
else if (t <= 2.1d-5) then
tmp = x * ((z - y) + 1.0d0)
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 (t <= -20000.0) {
tmp = x + (y * t);
} else if (t <= 2.1e-5) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -20000.0: tmp = x + (y * t) elif t <= 2.1e-5: tmp = x * ((z - y) + 1.0) else: tmp = x - (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -20000.0) tmp = Float64(x + Float64(y * t)); elseif (t <= 2.1e-5) tmp = Float64(x * Float64(Float64(z - y) + 1.0)); else tmp = Float64(x - Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -20000.0) tmp = x + (y * t); elseif (t <= 2.1e-5) tmp = x * ((z - y) + 1.0); else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -20000.0], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.1e-5], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -20000:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{-5}:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if t < -2e4Initial program 100.0%
Taylor expanded in t around inf 92.0%
Taylor expanded in y around inf 62.4%
if -2e4 < t < 2.09999999999999988e-5Initial program 100.0%
Taylor expanded in x around inf 77.5%
mul-1-neg77.5%
unsub-neg77.5%
Simplified77.5%
if 2.09999999999999988e-5 < t Initial program 100.0%
Taylor expanded in y around 0 61.8%
mul-1-neg61.8%
unsub-neg61.8%
Simplified61.8%
Taylor expanded in t around inf 55.4%
Final simplification66.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -185000000.0) (not (<= x 2.9e+66))) (* x (- y)) (* z (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -185000000.0) || !(x <= 2.9e+66)) {
tmp = x * -y;
} 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 ((x <= (-185000000.0d0)) .or. (.not. (x <= 2.9d+66))) then
tmp = x * -y
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 ((x <= -185000000.0) || !(x <= 2.9e+66)) {
tmp = x * -y;
} else {
tmp = z * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -185000000.0) or not (x <= 2.9e+66): tmp = x * -y else: tmp = z * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -185000000.0) || !(x <= 2.9e+66)) tmp = Float64(x * Float64(-y)); else tmp = Float64(z * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -185000000.0) || ~((x <= 2.9e+66))) tmp = x * -y; else tmp = z * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -185000000.0], N[Not[LessEqual[x, 2.9e+66]], $MachinePrecision]], N[(x * (-y)), $MachinePrecision], N[(z * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -185000000 \lor \neg \left(x \leq 2.9 \cdot 10^{+66}\right):\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\end{array}
\end{array}
if x < -1.85e8 or 2.89999999999999986e66 < x Initial program 100.0%
Taylor expanded in x around inf 79.2%
mul-1-neg79.2%
unsub-neg79.2%
Simplified79.2%
Taylor expanded in y around inf 40.8%
mul-1-neg40.8%
Simplified40.8%
if -1.85e8 < x < 2.89999999999999986e66Initial program 100.0%
Taylor expanded in y around 0 63.8%
mul-1-neg63.8%
unsub-neg63.8%
Simplified63.8%
Taylor expanded in t around inf 51.3%
Taylor expanded in x around 0 43.8%
mul-1-neg43.8%
*-commutative43.8%
distribute-rgt-neg-out43.8%
Simplified43.8%
Final simplification42.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.8e+20) (not (<= z 1.1e+64))) (* z x) (* x (- y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.8e+20) || !(z <= 1.1e+64)) {
tmp = z * x;
} else {
tmp = x * -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 <= (-5.8d+20)) .or. (.not. (z <= 1.1d+64))) then
tmp = z * x
else
tmp = x * -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.8e+20) || !(z <= 1.1e+64)) {
tmp = z * x;
} else {
tmp = x * -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.8e+20) or not (z <= 1.1e+64): tmp = z * x else: tmp = x * -y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.8e+20) || !(z <= 1.1e+64)) tmp = Float64(z * x); else tmp = Float64(x * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.8e+20) || ~((z <= 1.1e+64))) tmp = z * x; else tmp = x * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.8e+20], N[Not[LessEqual[z, 1.1e+64]], $MachinePrecision]], N[(z * x), $MachinePrecision], N[(x * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+20} \lor \neg \left(z \leq 1.1 \cdot 10^{+64}\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\end{array}
\end{array}
if z < -5.8e20 or 1.10000000000000001e64 < z Initial program 100.0%
Taylor expanded in x around inf 48.8%
mul-1-neg48.8%
unsub-neg48.8%
Simplified48.8%
Taylor expanded in z around inf 42.7%
if -5.8e20 < z < 1.10000000000000001e64Initial program 100.0%
Taylor expanded in x around inf 45.9%
mul-1-neg45.9%
unsub-neg45.9%
Simplified45.9%
Taylor expanded in y around inf 26.2%
mul-1-neg26.2%
Simplified26.2%
Final simplification33.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.4e+15) (not (<= z 230000.0))) (* z x) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.4e+15) || !(z <= 230000.0)) {
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 <= (-1.4d+15)) .or. (.not. (z <= 230000.0d0))) 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 <= -1.4e+15) || !(z <= 230000.0)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.4e+15) or not (z <= 230000.0): tmp = z * x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.4e+15) || !(z <= 230000.0)) tmp = Float64(z * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.4e+15) || ~((z <= 230000.0))) tmp = z * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.4e+15], N[Not[LessEqual[z, 230000.0]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+15} \lor \neg \left(z \leq 230000\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.4e15 or 2.3e5 < z Initial program 100.0%
Taylor expanded in x around inf 47.6%
mul-1-neg47.6%
unsub-neg47.6%
Simplified47.6%
Taylor expanded in z around inf 39.2%
if -1.4e15 < z < 2.3e5Initial program 100.0%
Taylor expanded in y around inf 87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in y around 0 23.1%
Final simplification31.1%
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Initial program 100.0%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in y around inf 58.1%
*-commutative58.1%
Simplified58.1%
Taylor expanded in y around 0 13.0%
(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 2024135
(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))))