
(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-def100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))) (t_2 (* z (- x t))))
(if (<= y -1400000.0)
t_1
(if (<= y -2.5e-83)
t_2
(if (<= y -1.05e-301) (+ x (* z x)) (if (<= y 1.08e+40) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double t_2 = z * (x - t);
double tmp;
if (y <= -1400000.0) {
tmp = t_1;
} else if (y <= -2.5e-83) {
tmp = t_2;
} else if (y <= -1.05e-301) {
tmp = x + (z * x);
} else if (y <= 1.08e+40) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = y * (t - x)
t_2 = z * (x - t)
if (y <= (-1400000.0d0)) then
tmp = t_1
else if (y <= (-2.5d-83)) then
tmp = t_2
else if (y <= (-1.05d-301)) then
tmp = x + (z * x)
else if (y <= 1.08d+40) then
tmp = t_2
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 t_2 = z * (x - t);
double tmp;
if (y <= -1400000.0) {
tmp = t_1;
} else if (y <= -2.5e-83) {
tmp = t_2;
} else if (y <= -1.05e-301) {
tmp = x + (z * x);
} else if (y <= 1.08e+40) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) t_2 = z * (x - t) tmp = 0 if y <= -1400000.0: tmp = t_1 elif y <= -2.5e-83: tmp = t_2 elif y <= -1.05e-301: tmp = x + (z * x) elif y <= 1.08e+40: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) t_2 = Float64(z * Float64(x - t)) tmp = 0.0 if (y <= -1400000.0) tmp = t_1; elseif (y <= -2.5e-83) tmp = t_2; elseif (y <= -1.05e-301) tmp = Float64(x + Float64(z * x)); elseif (y <= 1.08e+40) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); t_2 = z * (x - t); tmp = 0.0; if (y <= -1400000.0) tmp = t_1; elseif (y <= -2.5e-83) tmp = t_2; elseif (y <= -1.05e-301) tmp = x + (z * x); elseif (y <= 1.08e+40) tmp = t_2; 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]}, Block[{t$95$2 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1400000.0], t$95$1, If[LessEqual[y, -2.5e-83], t$95$2, If[LessEqual[y, -1.05e-301], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.08e+40], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
t_2 := z \cdot \left(x - t\right)\\
\mathbf{if}\;y \leq -1400000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -2.5 \cdot 10^{-83}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.05 \cdot 10^{-301}:\\
\;\;\;\;x + z \cdot x\\
\mathbf{elif}\;y \leq 1.08 \cdot 10^{+40}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -1.4e6 or 1.08000000000000001e40 < y Initial program 99.9%
Taylor expanded in x around 0 96.5%
fma-def98.2%
mul-1-neg98.2%
Simplified98.2%
Taylor expanded in y around inf 79.6%
neg-mul-179.6%
sub-neg79.6%
Simplified79.6%
if -1.4e6 < y < -2.5e-83 or -1.0499999999999999e-301 < y < 1.08000000000000001e40Initial program 100.0%
Taylor expanded in x around 0 100.0%
fma-def100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in z around inf 72.5%
mul-1-neg72.5%
unsub-neg72.5%
Simplified72.5%
if -2.5e-83 < y < -1.0499999999999999e-301Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 81.9%
Taylor expanded in y around 0 81.9%
*-commutative81.9%
Simplified81.9%
Final simplification77.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))))
(if (<= z -2.9e+24)
t_1
(if (<= z -1.02e-8)
(* y (- t x))
(if (<= z 3e-45)
(+ x (* (- y z) t))
(if (<= z 2.15e+30) (* x (- 1.0 y)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -2.9e+24) {
tmp = t_1;
} else if (z <= -1.02e-8) {
tmp = y * (t - x);
} else if (z <= 3e-45) {
tmp = x + ((y - z) * t);
} else if (z <= 2.15e+30) {
tmp = x * (1.0 - 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 = z * (x - t)
if (z <= (-2.9d+24)) then
tmp = t_1
else if (z <= (-1.02d-8)) then
tmp = y * (t - x)
else if (z <= 3d-45) then
tmp = x + ((y - z) * t)
else if (z <= 2.15d+30) then
tmp = x * (1.0d0 - 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 = z * (x - t);
double tmp;
if (z <= -2.9e+24) {
tmp = t_1;
} else if (z <= -1.02e-8) {
tmp = y * (t - x);
} else if (z <= 3e-45) {
tmp = x + ((y - z) * t);
} else if (z <= 2.15e+30) {
tmp = x * (1.0 - y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -2.9e+24: tmp = t_1 elif z <= -1.02e-8: tmp = y * (t - x) elif z <= 3e-45: tmp = x + ((y - z) * t) elif z <= 2.15e+30: tmp = x * (1.0 - y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -2.9e+24) tmp = t_1; elseif (z <= -1.02e-8) tmp = Float64(y * Float64(t - x)); elseif (z <= 3e-45) tmp = Float64(x + Float64(Float64(y - z) * t)); elseif (z <= 2.15e+30) tmp = Float64(x * Float64(1.0 - y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); tmp = 0.0; if (z <= -2.9e+24) tmp = t_1; elseif (z <= -1.02e-8) tmp = y * (t - x); elseif (z <= 3e-45) tmp = x + ((y - z) * t); elseif (z <= 2.15e+30) tmp = x * (1.0 - y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.9e+24], t$95$1, If[LessEqual[z, -1.02e-8], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3e-45], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.15e+30], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -2.9 \cdot 10^{+24}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.02 \cdot 10^{-8}:\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-45}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+30}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -2.89999999999999979e24 or 2.15e30 < z Initial program 100.0%
Taylor expanded in x around 0 98.4%
fma-def99.2%
mul-1-neg99.2%
Simplified99.2%
Taylor expanded in z around inf 80.2%
mul-1-neg80.2%
unsub-neg80.2%
Simplified80.2%
if -2.89999999999999979e24 < z < -1.02000000000000003e-8Initial program 100.0%
Taylor expanded in x around 0 100.0%
fma-def100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 80.9%
neg-mul-180.9%
sub-neg80.9%
Simplified80.9%
if -1.02000000000000003e-8 < z < 3.00000000000000011e-45Initial program 100.0%
Taylor expanded in t around inf 78.7%
if 3.00000000000000011e-45 < z < 2.15e30Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
distribute-rgt-neg-out100.0%
unsub-neg100.0%
*-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in t around inf 90.3%
*-commutative90.3%
Simplified90.3%
Taylor expanded in x around inf 84.8%
neg-mul-184.8%
unsub-neg84.8%
Simplified84.8%
Final simplification80.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- x))) (t_2 (- (* z t))))
(if (<= y -1.18e-32)
t_1
(if (<= y -2.65e-99)
t_2
(if (<= y -1.04e-302) x (if (<= y 3.9e+74) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * -x;
double t_2 = -(z * t);
double tmp;
if (y <= -1.18e-32) {
tmp = t_1;
} else if (y <= -2.65e-99) {
tmp = t_2;
} else if (y <= -1.04e-302) {
tmp = x;
} else if (y <= 3.9e+74) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = y * -x
t_2 = -(z * t)
if (y <= (-1.18d-32)) then
tmp = t_1
else if (y <= (-2.65d-99)) then
tmp = t_2
else if (y <= (-1.04d-302)) then
tmp = x
else if (y <= 3.9d+74) then
tmp = t_2
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 * -x;
double t_2 = -(z * t);
double tmp;
if (y <= -1.18e-32) {
tmp = t_1;
} else if (y <= -2.65e-99) {
tmp = t_2;
} else if (y <= -1.04e-302) {
tmp = x;
} else if (y <= 3.9e+74) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * -x t_2 = -(z * t) tmp = 0 if y <= -1.18e-32: tmp = t_1 elif y <= -2.65e-99: tmp = t_2 elif y <= -1.04e-302: tmp = x elif y <= 3.9e+74: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(-x)) t_2 = Float64(-Float64(z * t)) tmp = 0.0 if (y <= -1.18e-32) tmp = t_1; elseif (y <= -2.65e-99) tmp = t_2; elseif (y <= -1.04e-302) tmp = x; elseif (y <= 3.9e+74) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * -x; t_2 = -(z * t); tmp = 0.0; if (y <= -1.18e-32) tmp = t_1; elseif (y <= -2.65e-99) tmp = t_2; elseif (y <= -1.04e-302) tmp = x; elseif (y <= 3.9e+74) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-x)), $MachinePrecision]}, Block[{t$95$2 = (-N[(z * t), $MachinePrecision])}, If[LessEqual[y, -1.18e-32], t$95$1, If[LessEqual[y, -2.65e-99], t$95$2, If[LessEqual[y, -1.04e-302], x, If[LessEqual[y, 3.9e+74], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(-x\right)\\
t_2 := -z \cdot t\\
\mathbf{if}\;y \leq -1.18 \cdot 10^{-32}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -2.65 \cdot 10^{-99}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.04 \cdot 10^{-302}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{+74}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -1.17999999999999997e-32 or 3.90000000000000008e74 < y Initial program 99.9%
Taylor expanded in x around 0 96.5%
fma-def98.2%
mul-1-neg98.2%
Simplified98.2%
Taylor expanded in y around inf 78.1%
neg-mul-178.1%
sub-neg78.1%
Simplified78.1%
Taylor expanded in t around 0 48.5%
mul-1-neg48.5%
distribute-rgt-neg-in48.5%
Simplified48.5%
if -1.17999999999999997e-32 < y < -2.6500000000000002e-99 or -1.04000000000000002e-302 < y < 3.90000000000000008e74Initial program 100.0%
Taylor expanded in t around inf 69.9%
Taylor expanded in z around inf 45.3%
associate-*r*45.3%
mul-1-neg45.3%
Simplified45.3%
if -2.6500000000000002e-99 < y < -1.04000000000000002e-302Initial program 99.9%
Taylor expanded in t around inf 78.1%
Taylor expanded in x around inf 53.8%
Final simplification48.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))))
(if (<= z -3.6e+24)
t_1
(if (<= z -5.6e-110)
(* y (- t x))
(if (<= z 2.05e+30) (* x (- 1.0 y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -3.6e+24) {
tmp = t_1;
} else if (z <= -5.6e-110) {
tmp = y * (t - x);
} else if (z <= 2.05e+30) {
tmp = x * (1.0 - 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 = z * (x - t)
if (z <= (-3.6d+24)) then
tmp = t_1
else if (z <= (-5.6d-110)) then
tmp = y * (t - x)
else if (z <= 2.05d+30) then
tmp = x * (1.0d0 - 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 = z * (x - t);
double tmp;
if (z <= -3.6e+24) {
tmp = t_1;
} else if (z <= -5.6e-110) {
tmp = y * (t - x);
} else if (z <= 2.05e+30) {
tmp = x * (1.0 - y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -3.6e+24: tmp = t_1 elif z <= -5.6e-110: tmp = y * (t - x) elif z <= 2.05e+30: tmp = x * (1.0 - y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -3.6e+24) tmp = t_1; elseif (z <= -5.6e-110) tmp = Float64(y * Float64(t - x)); elseif (z <= 2.05e+30) tmp = Float64(x * Float64(1.0 - y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); tmp = 0.0; if (z <= -3.6e+24) tmp = t_1; elseif (z <= -5.6e-110) tmp = y * (t - x); elseif (z <= 2.05e+30) tmp = x * (1.0 - y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.6e+24], t$95$1, If[LessEqual[z, -5.6e-110], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.05e+30], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+24}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{-110}:\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{+30}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -3.59999999999999983e24 or 2.05000000000000003e30 < z Initial program 100.0%
Taylor expanded in x around 0 98.4%
fma-def99.2%
mul-1-neg99.2%
Simplified99.2%
Taylor expanded in z around inf 80.2%
mul-1-neg80.2%
unsub-neg80.2%
Simplified80.2%
if -3.59999999999999983e24 < z < -5.6000000000000001e-110Initial program 100.0%
Taylor expanded in x around 0 96.3%
fma-def96.3%
mul-1-neg96.3%
Simplified96.3%
Taylor expanded in y around inf 68.1%
neg-mul-168.1%
sub-neg68.1%
Simplified68.1%
if -5.6000000000000001e-110 < z < 2.05000000000000003e30Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in99.9%
Applied egg-rr99.9%
distribute-rgt-neg-out99.9%
unsub-neg99.9%
*-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in t around inf 98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in x around inf 70.3%
neg-mul-170.3%
unsub-neg70.3%
Simplified70.3%
Final simplification75.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.8e-54) (not (<= t 46.0))) (+ x (* t (- y z))) (- x (* x (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.8e-54) || !(t <= 46.0)) {
tmp = x + (t * (y - z));
} else {
tmp = x - (x * (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 ((t <= (-6.8d-54)) .or. (.not. (t <= 46.0d0))) then
tmp = x + (t * (y - z))
else
tmp = x - (x * (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.8e-54) || !(t <= 46.0)) {
tmp = x + (t * (y - z));
} else {
tmp = x - (x * (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6.8e-54) or not (t <= 46.0): tmp = x + (t * (y - z)) else: tmp = x - (x * (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6.8e-54) || !(t <= 46.0)) tmp = Float64(x + Float64(t * Float64(y - z))); else tmp = Float64(x - Float64(x * Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -6.8e-54) || ~((t <= 46.0))) tmp = x + (t * (y - z)); else tmp = x - (x * (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6.8e-54], N[Not[LessEqual[t, 46.0]], $MachinePrecision]], N[(x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.8 \cdot 10^{-54} \lor \neg \left(t \leq 46\right):\\
\;\;\;\;x + t \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot \left(y - z\right)\\
\end{array}
\end{array}
if t < -6.79999999999999975e-54 or 46 < t Initial program 100.0%
Taylor expanded in t around inf 84.6%
if -6.79999999999999975e-54 < t < 46Initial program 99.9%
Taylor expanded in t around 0 83.9%
mul-1-neg83.9%
distribute-rgt-neg-in83.9%
neg-sub083.9%
sub-neg83.9%
+-commutative83.9%
associate--r+83.9%
neg-sub083.9%
remove-double-neg83.9%
Simplified83.9%
Final simplification84.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.3e-17) (not (<= y 2.3e+40))) (+ x (* y (- t x))) (+ x (* z (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.3e-17) || !(y <= 2.3e+40)) {
tmp = x + (y * (t - x));
} 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 <= (-4.3d-17)) .or. (.not. (y <= 2.3d+40))) then
tmp = x + (y * (t - x))
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 <= -4.3e-17) || !(y <= 2.3e+40)) {
tmp = x + (y * (t - x));
} else {
tmp = x + (z * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.3e-17) or not (y <= 2.3e+40): tmp = x + (y * (t - x)) else: tmp = x + (z * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.3e-17) || !(y <= 2.3e+40)) tmp = Float64(x + Float64(y * Float64(t - x))); 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 <= -4.3e-17) || ~((y <= 2.3e+40))) tmp = x + (y * (t - x)); else tmp = x + (z * (x - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.3e-17], N[Not[LessEqual[y, 2.3e+40]], $MachinePrecision]], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.3 \cdot 10^{-17} \lor \neg \left(y \leq 2.3 \cdot 10^{+40}\right):\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\end{array}
\end{array}
if y < -4.30000000000000023e-17 or 2.29999999999999994e40 < y Initial program 99.9%
Taylor expanded in y around inf 79.2%
*-commutative79.2%
Simplified79.2%
if -4.30000000000000023e-17 < y < 2.29999999999999994e40Initial program 100.0%
Taylor expanded in y around 0 94.9%
mul-1-neg94.9%
unsub-neg94.9%
Simplified94.9%
Final simplification87.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.2e-91) (not (<= t 4.3e-74))) (* t (- y z)) (* y (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e-91) || !(t <= 4.3e-74)) {
tmp = t * (y - z);
} else {
tmp = y * -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 ((t <= (-5.2d-91)) .or. (.not. (t <= 4.3d-74))) then
tmp = t * (y - z)
else
tmp = y * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e-91) || !(t <= 4.3e-74)) {
tmp = t * (y - z);
} else {
tmp = y * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.2e-91) or not (t <= 4.3e-74): tmp = t * (y - z) else: tmp = y * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.2e-91) || !(t <= 4.3e-74)) tmp = Float64(t * Float64(y - z)); else tmp = Float64(y * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5.2e-91) || ~((t <= 4.3e-74))) tmp = t * (y - z); else tmp = y * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.2e-91], N[Not[LessEqual[t, 4.3e-74]], $MachinePrecision]], N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(y * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{-91} \lor \neg \left(t \leq 4.3 \cdot 10^{-74}\right):\\
\;\;\;\;t \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\end{array}
\end{array}
if t < -5.20000000000000028e-91 or 4.29999999999999972e-74 < t Initial program 100.0%
Taylor expanded in x around 0 97.3%
fma-def98.7%
mul-1-neg98.7%
Simplified98.7%
Taylor expanded in t around inf 65.6%
if -5.20000000000000028e-91 < t < 4.29999999999999972e-74Initial program 99.9%
Taylor expanded in x around 0 99.9%
fma-def100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 44.8%
neg-mul-144.8%
sub-neg44.8%
Simplified44.8%
Taylor expanded in t around 0 39.9%
mul-1-neg39.9%
distribute-rgt-neg-in39.9%
Simplified39.9%
Final simplification54.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.5e-55) (not (<= t 3e+26))) (* t (- y z)) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.5e-55) || !(t <= 3e+26)) {
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 <= (-5.5d-55)) .or. (.not. (t <= 3d+26))) 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 <= -5.5e-55) || !(t <= 3e+26)) {
tmp = t * (y - z);
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.5e-55) or not (t <= 3e+26): tmp = t * (y - z) else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.5e-55) || !(t <= 3e+26)) 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 <= -5.5e-55) || ~((t <= 3e+26))) tmp = t * (y - z); else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.5e-55], N[Not[LessEqual[t, 3e+26]], $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 -5.5 \cdot 10^{-55} \lor \neg \left(t \leq 3 \cdot 10^{+26}\right):\\
\;\;\;\;t \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if t < -5.4999999999999999e-55 or 2.99999999999999997e26 < t Initial program 100.0%
Taylor expanded in x around 0 96.9%
fma-def98.5%
mul-1-neg98.5%
Simplified98.5%
Taylor expanded in t around inf 70.5%
if -5.4999999999999999e-55 < t < 2.99999999999999997e26Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in96.8%
Applied egg-rr96.8%
distribute-rgt-neg-out96.8%
unsub-neg96.8%
*-commutative96.8%
Applied egg-rr96.8%
Taylor expanded in t around inf 72.1%
*-commutative72.1%
Simplified72.1%
Taylor expanded in x around inf 56.0%
neg-mul-156.0%
unsub-neg56.0%
Simplified56.0%
Final simplification63.3%
(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 (if (or (<= y -7.2e-6) (not (<= y 3.3e+34))) (* y (- x)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.2e-6) || !(y <= 3.3e+34)) {
tmp = y * -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 ((y <= (-7.2d-6)) .or. (.not. (y <= 3.3d+34))) then
tmp = y * -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 ((y <= -7.2e-6) || !(y <= 3.3e+34)) {
tmp = y * -x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.2e-6) or not (y <= 3.3e+34): tmp = y * -x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.2e-6) || !(y <= 3.3e+34)) tmp = Float64(y * Float64(-x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.2e-6) || ~((y <= 3.3e+34))) tmp = y * -x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.2e-6], N[Not[LessEqual[y, 3.3e+34]], $MachinePrecision]], N[(y * (-x)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{-6} \lor \neg \left(y \leq 3.3 \cdot 10^{+34}\right):\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -7.19999999999999967e-6 or 3.29999999999999988e34 < y Initial program 99.9%
Taylor expanded in x around 0 96.7%
fma-def98.3%
mul-1-neg98.3%
Simplified98.3%
Taylor expanded in y around inf 76.6%
neg-mul-176.6%
sub-neg76.6%
Simplified76.6%
Taylor expanded in t around 0 47.6%
mul-1-neg47.6%
distribute-rgt-neg-in47.6%
Simplified47.6%
if -7.19999999999999967e-6 < y < 3.29999999999999988e34Initial program 100.0%
Taylor expanded in t around inf 73.0%
Taylor expanded in x around inf 35.0%
Final simplification41.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.75e-53) (not (<= y 1.62e-6))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.75e-53) || !(y <= 1.62e-6)) {
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.75d-53)) .or. (.not. (y <= 1.62d-6))) 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.75e-53) || !(y <= 1.62e-6)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.75e-53) or not (y <= 1.62e-6): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.75e-53) || !(y <= 1.62e-6)) 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.75e-53) || ~((y <= 1.62e-6))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.75e-53], N[Not[LessEqual[y, 1.62e-6]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.75 \cdot 10^{-53} \lor \neg \left(y \leq 1.62 \cdot 10^{-6}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.74999999999999997e-53 or 1.61999999999999995e-6 < y Initial program 100.0%
Taylor expanded in t around inf 52.7%
Taylor expanded in y around inf 35.5%
*-commutative35.5%
Simplified35.5%
if -1.74999999999999997e-53 < y < 1.61999999999999995e-6Initial program 100.0%
Taylor expanded in t around inf 71.9%
Taylor expanded in x around inf 37.8%
Final simplification36.6%
(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 61.8%
Taylor expanded in x around inf 19.7%
Final simplification19.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 2023306
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:herbie-target
(+ x (+ (* t (- y z)) (* (- x) (- y z))))
(+ x (* (- y z) (- t x))))