
(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%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* z x))) (t_2 (* y (- t x))) (t_3 (- x (* z t))))
(if (<= y -80000000000000.0)
t_2
(if (<= y -8.5e-47)
(* z (- x t))
(if (<= y -2.6e-213)
t_1
(if (<= y 8.2e-283)
t_3
(if (<= y 5e-229) t_1 (if (<= y 48000.0) t_3 t_2))))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (z * x);
double t_2 = y * (t - x);
double t_3 = x - (z * t);
double tmp;
if (y <= -80000000000000.0) {
tmp = t_2;
} else if (y <= -8.5e-47) {
tmp = z * (x - t);
} else if (y <= -2.6e-213) {
tmp = t_1;
} else if (y <= 8.2e-283) {
tmp = t_3;
} else if (y <= 5e-229) {
tmp = t_1;
} else if (y <= 48000.0) {
tmp = t_3;
} else {
tmp = t_2;
}
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) :: t_3
real(8) :: tmp
t_1 = x + (z * x)
t_2 = y * (t - x)
t_3 = x - (z * t)
if (y <= (-80000000000000.0d0)) then
tmp = t_2
else if (y <= (-8.5d-47)) then
tmp = z * (x - t)
else if (y <= (-2.6d-213)) then
tmp = t_1
else if (y <= 8.2d-283) then
tmp = t_3
else if (y <= 5d-229) then
tmp = t_1
else if (y <= 48000.0d0) then
tmp = t_3
else
tmp = t_2
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 t_2 = y * (t - x);
double t_3 = x - (z * t);
double tmp;
if (y <= -80000000000000.0) {
tmp = t_2;
} else if (y <= -8.5e-47) {
tmp = z * (x - t);
} else if (y <= -2.6e-213) {
tmp = t_1;
} else if (y <= 8.2e-283) {
tmp = t_3;
} else if (y <= 5e-229) {
tmp = t_1;
} else if (y <= 48000.0) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (z * x) t_2 = y * (t - x) t_3 = x - (z * t) tmp = 0 if y <= -80000000000000.0: tmp = t_2 elif y <= -8.5e-47: tmp = z * (x - t) elif y <= -2.6e-213: tmp = t_1 elif y <= 8.2e-283: tmp = t_3 elif y <= 5e-229: tmp = t_1 elif y <= 48000.0: tmp = t_3 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(z * x)) t_2 = Float64(y * Float64(t - x)) t_3 = Float64(x - Float64(z * t)) tmp = 0.0 if (y <= -80000000000000.0) tmp = t_2; elseif (y <= -8.5e-47) tmp = Float64(z * Float64(x - t)); elseif (y <= -2.6e-213) tmp = t_1; elseif (y <= 8.2e-283) tmp = t_3; elseif (y <= 5e-229) tmp = t_1; elseif (y <= 48000.0) tmp = t_3; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (z * x); t_2 = y * (t - x); t_3 = x - (z * t); tmp = 0.0; if (y <= -80000000000000.0) tmp = t_2; elseif (y <= -8.5e-47) tmp = z * (x - t); elseif (y <= -2.6e-213) tmp = t_1; elseif (y <= 8.2e-283) tmp = t_3; elseif (y <= 5e-229) tmp = t_1; elseif (y <= 48000.0) tmp = t_3; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -80000000000000.0], t$95$2, If[LessEqual[y, -8.5e-47], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.6e-213], t$95$1, If[LessEqual[y, 8.2e-283], t$95$3, If[LessEqual[y, 5e-229], t$95$1, If[LessEqual[y, 48000.0], t$95$3, t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot x\\
t_2 := y \cdot \left(t - x\right)\\
t_3 := x - z \cdot t\\
\mathbf{if}\;y \leq -80000000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -8.5 \cdot 10^{-47}:\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{elif}\;y \leq -2.6 \cdot 10^{-213}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-283}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-229}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 48000:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -8e13 or 48000 < y Initial program 100.0%
Taylor expanded in y around inf 83.6%
*-commutative83.6%
Simplified83.6%
Taylor expanded in y around inf 83.5%
if -8e13 < y < -8.4999999999999999e-47Initial program 100.0%
Taylor expanded in y around 0 84.6%
mul-1-neg84.6%
unsub-neg84.6%
Simplified84.6%
Taylor expanded in z around inf 82.5%
if -8.4999999999999999e-47 < y < -2.6000000000000001e-213 or 8.19999999999999973e-283 < y < 5.00000000000000016e-229Initial program 99.9%
Taylor expanded in t around 0 78.1%
mul-1-neg78.1%
distribute-rgt-neg-in78.1%
neg-sub078.1%
sub-neg78.1%
+-commutative78.1%
associate--r+78.1%
neg-sub078.1%
remove-double-neg78.1%
Simplified78.1%
Taylor expanded in z around inf 78.1%
if -2.6000000000000001e-213 < y < 8.19999999999999973e-283 or 5.00000000000000016e-229 < y < 48000Initial program 100.0%
Taylor expanded in t around inf 82.1%
Taylor expanded in y around 0 73.9%
associate-*r*73.9%
neg-mul-173.9%
Simplified73.9%
Final simplification79.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 y))) (t_2 (* z (- x t))) (t_3 (* y (- t x))))
(if (<= z -1.6e+15)
t_2
(if (<= z -6.2e-128)
t_3
(if (<= z 1.05e-172)
t_1
(if (<= z 2.2e-69) t_3 (if (<= z 0.032) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - y);
double t_2 = z * (x - t);
double t_3 = y * (t - x);
double tmp;
if (z <= -1.6e+15) {
tmp = t_2;
} else if (z <= -6.2e-128) {
tmp = t_3;
} else if (z <= 1.05e-172) {
tmp = t_1;
} else if (z <= 2.2e-69) {
tmp = t_3;
} else if (z <= 0.032) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_3
real(8) :: tmp
t_1 = x * (1.0d0 - y)
t_2 = z * (x - t)
t_3 = y * (t - x)
if (z <= (-1.6d+15)) then
tmp = t_2
else if (z <= (-6.2d-128)) then
tmp = t_3
else if (z <= 1.05d-172) then
tmp = t_1
else if (z <= 2.2d-69) then
tmp = t_3
else if (z <= 0.032d0) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - y);
double t_2 = z * (x - t);
double t_3 = y * (t - x);
double tmp;
if (z <= -1.6e+15) {
tmp = t_2;
} else if (z <= -6.2e-128) {
tmp = t_3;
} else if (z <= 1.05e-172) {
tmp = t_1;
} else if (z <= 2.2e-69) {
tmp = t_3;
} else if (z <= 0.032) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - y) t_2 = z * (x - t) t_3 = y * (t - x) tmp = 0 if z <= -1.6e+15: tmp = t_2 elif z <= -6.2e-128: tmp = t_3 elif z <= 1.05e-172: tmp = t_1 elif z <= 2.2e-69: tmp = t_3 elif z <= 0.032: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - y)) t_2 = Float64(z * Float64(x - t)) t_3 = Float64(y * Float64(t - x)) tmp = 0.0 if (z <= -1.6e+15) tmp = t_2; elseif (z <= -6.2e-128) tmp = t_3; elseif (z <= 1.05e-172) tmp = t_1; elseif (z <= 2.2e-69) tmp = t_3; elseif (z <= 0.032) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - y); t_2 = z * (x - t); t_3 = y * (t - x); tmp = 0.0; if (z <= -1.6e+15) tmp = t_2; elseif (z <= -6.2e-128) tmp = t_3; elseif (z <= 1.05e-172) tmp = t_1; elseif (z <= 2.2e-69) tmp = t_3; elseif (z <= 0.032) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.6e+15], t$95$2, If[LessEqual[z, -6.2e-128], t$95$3, If[LessEqual[z, 1.05e-172], t$95$1, If[LessEqual[z, 2.2e-69], t$95$3, If[LessEqual[z, 0.032], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - y\right)\\
t_2 := z \cdot \left(x - t\right)\\
t_3 := y \cdot \left(t - x\right)\\
\mathbf{if}\;z \leq -1.6 \cdot 10^{+15}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -6.2 \cdot 10^{-128}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-172}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-69}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;z \leq 0.032:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -1.6e15 or 0.032000000000000001 < z Initial program 100.0%
Taylor expanded in y around 0 83.9%
mul-1-neg83.9%
unsub-neg83.9%
Simplified83.9%
Taylor expanded in z around inf 83.9%
if -1.6e15 < z < -6.20000000000000005e-128 or 1.05e-172 < z < 2.2e-69Initial program 100.0%
Taylor expanded in y around inf 86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in y around inf 69.9%
if -6.20000000000000005e-128 < z < 1.05e-172 or 2.2e-69 < z < 0.032000000000000001Initial program 100.0%
Taylor expanded in y around inf 95.1%
*-commutative95.1%
Simplified95.1%
Taylor expanded in x around inf 73.4%
neg-mul-173.4%
unsub-neg73.4%
Simplified73.4%
Final simplification77.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))) (t_2 (* y (- t x))))
(if (<= z -1.5e+16)
t_1
(if (<= z -1.7e-142)
t_2
(if (<= z 1.35e-171)
(- x (* y x))
(if (<= z 5.8e-69) t_2 (if (<= z 0.07) (* x (- 1.0 y)) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double t_2 = y * (t - x);
double tmp;
if (z <= -1.5e+16) {
tmp = t_1;
} else if (z <= -1.7e-142) {
tmp = t_2;
} else if (z <= 1.35e-171) {
tmp = x - (y * x);
} else if (z <= 5.8e-69) {
tmp = t_2;
} else if (z <= 0.07) {
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) :: t_2
real(8) :: tmp
t_1 = z * (x - t)
t_2 = y * (t - x)
if (z <= (-1.5d+16)) then
tmp = t_1
else if (z <= (-1.7d-142)) then
tmp = t_2
else if (z <= 1.35d-171) then
tmp = x - (y * x)
else if (z <= 5.8d-69) then
tmp = t_2
else if (z <= 0.07d0) 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 t_2 = y * (t - x);
double tmp;
if (z <= -1.5e+16) {
tmp = t_1;
} else if (z <= -1.7e-142) {
tmp = t_2;
} else if (z <= 1.35e-171) {
tmp = x - (y * x);
} else if (z <= 5.8e-69) {
tmp = t_2;
} else if (z <= 0.07) {
tmp = x * (1.0 - y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) t_2 = y * (t - x) tmp = 0 if z <= -1.5e+16: tmp = t_1 elif z <= -1.7e-142: tmp = t_2 elif z <= 1.35e-171: tmp = x - (y * x) elif z <= 5.8e-69: tmp = t_2 elif z <= 0.07: tmp = x * (1.0 - y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) t_2 = Float64(y * Float64(t - x)) tmp = 0.0 if (z <= -1.5e+16) tmp = t_1; elseif (z <= -1.7e-142) tmp = t_2; elseif (z <= 1.35e-171) tmp = Float64(x - Float64(y * x)); elseif (z <= 5.8e-69) tmp = t_2; elseif (z <= 0.07) 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); t_2 = y * (t - x); tmp = 0.0; if (z <= -1.5e+16) tmp = t_1; elseif (z <= -1.7e-142) tmp = t_2; elseif (z <= 1.35e-171) tmp = x - (y * x); elseif (z <= 5.8e-69) tmp = t_2; elseif (z <= 0.07) 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]}, Block[{t$95$2 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.5e+16], t$95$1, If[LessEqual[z, -1.7e-142], t$95$2, If[LessEqual[z, 1.35e-171], N[(x - N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.8e-69], t$95$2, If[LessEqual[z, 0.07], 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)\\
t_2 := y \cdot \left(t - x\right)\\
\mathbf{if}\;z \leq -1.5 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{-142}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{-171}:\\
\;\;\;\;x - y \cdot x\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-69}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 0.07:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.5e16 or 0.070000000000000007 < z Initial program 100.0%
Taylor expanded in y around 0 83.9%
mul-1-neg83.9%
unsub-neg83.9%
Simplified83.9%
Taylor expanded in z around inf 83.9%
if -1.5e16 < z < -1.70000000000000014e-142 or 1.35000000000000007e-171 < z < 5.7999999999999997e-69Initial program 100.0%
Taylor expanded in y around inf 86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in y around inf 69.9%
if -1.70000000000000014e-142 < z < 1.35000000000000007e-171Initial program 100.0%
Taylor expanded in t around 0 74.2%
mul-1-neg74.2%
distribute-rgt-neg-in74.2%
neg-sub074.2%
sub-neg74.2%
+-commutative74.2%
associate--r+74.2%
neg-sub074.2%
remove-double-neg74.2%
Simplified74.2%
Taylor expanded in z around 0 74.2%
mul-1-neg74.2%
unsub-neg74.2%
Simplified74.2%
if 5.7999999999999997e-69 < z < 0.070000000000000007Initial program 100.0%
Taylor expanded in y around inf 78.1%
*-commutative78.1%
Simplified78.1%
Taylor expanded in x around inf 69.7%
neg-mul-169.7%
unsub-neg69.7%
Simplified69.7%
Final simplification77.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))) (t_2 (- x (* t (- z y)))))
(if (<= y -8e+52)
t_1
(if (<= y 4.8e-284)
t_2
(if (<= y 4.7e-225) (+ x (* z x)) (if (<= y 54000.0) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double t_2 = x - (t * (z - y));
double tmp;
if (y <= -8e+52) {
tmp = t_1;
} else if (y <= 4.8e-284) {
tmp = t_2;
} else if (y <= 4.7e-225) {
tmp = x + (z * x);
} else if (y <= 54000.0) {
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 = x - (t * (z - y))
if (y <= (-8d+52)) then
tmp = t_1
else if (y <= 4.8d-284) then
tmp = t_2
else if (y <= 4.7d-225) then
tmp = x + (z * x)
else if (y <= 54000.0d0) 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 = x - (t * (z - y));
double tmp;
if (y <= -8e+52) {
tmp = t_1;
} else if (y <= 4.8e-284) {
tmp = t_2;
} else if (y <= 4.7e-225) {
tmp = x + (z * x);
} else if (y <= 54000.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) t_2 = x - (t * (z - y)) tmp = 0 if y <= -8e+52: tmp = t_1 elif y <= 4.8e-284: tmp = t_2 elif y <= 4.7e-225: tmp = x + (z * x) elif y <= 54000.0: 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(x - Float64(t * Float64(z - y))) tmp = 0.0 if (y <= -8e+52) tmp = t_1; elseif (y <= 4.8e-284) tmp = t_2; elseif (y <= 4.7e-225) tmp = Float64(x + Float64(z * x)); elseif (y <= 54000.0) 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 = x - (t * (z - y)); tmp = 0.0; if (y <= -8e+52) tmp = t_1; elseif (y <= 4.8e-284) tmp = t_2; elseif (y <= 4.7e-225) tmp = x + (z * x); elseif (y <= 54000.0) 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[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8e+52], t$95$1, If[LessEqual[y, 4.8e-284], t$95$2, If[LessEqual[y, 4.7e-225], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 54000.0], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
t_2 := x - t \cdot \left(z - y\right)\\
\mathbf{if}\;y \leq -8 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{-284}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{-225}:\\
\;\;\;\;x + z \cdot x\\
\mathbf{elif}\;y \leq 54000:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.9999999999999999e52 or 54000 < y Initial program 100.0%
Taylor expanded in y around inf 84.2%
*-commutative84.2%
Simplified84.2%
Taylor expanded in y around inf 84.0%
if -7.9999999999999999e52 < y < 4.80000000000000006e-284 or 4.70000000000000014e-225 < y < 54000Initial program 100.0%
Taylor expanded in t around inf 77.5%
if 4.80000000000000006e-284 < y < 4.70000000000000014e-225Initial program 100.0%
Taylor expanded in t around 0 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
neg-sub0100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
Final simplification81.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -84.0) (not (<= x 0.0064))) (+ x (* x (- z y))) (- x (* t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -84.0) || !(x <= 0.0064)) {
tmp = x + (x * (z - y));
} else {
tmp = x - (t * (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 ((x <= (-84.0d0)) .or. (.not. (x <= 0.0064d0))) then
tmp = x + (x * (z - y))
else
tmp = x - (t * (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -84.0) || !(x <= 0.0064)) {
tmp = x + (x * (z - y));
} else {
tmp = x - (t * (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -84.0) or not (x <= 0.0064): tmp = x + (x * (z - y)) else: tmp = x - (t * (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -84.0) || !(x <= 0.0064)) tmp = Float64(x + Float64(x * Float64(z - y))); else tmp = Float64(x - Float64(t * Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -84.0) || ~((x <= 0.0064))) tmp = x + (x * (z - y)); else tmp = x - (t * (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -84.0], N[Not[LessEqual[x, 0.0064]], $MachinePrecision]], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -84 \lor \neg \left(x \leq 0.0064\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\end{array}
\end{array}
if x < -84 or 0.00640000000000000031 < x Initial program 100.0%
Taylor expanded in t around 0 86.6%
mul-1-neg86.6%
distribute-rgt-neg-in86.6%
neg-sub086.6%
sub-neg86.6%
+-commutative86.6%
associate--r+86.6%
neg-sub086.6%
remove-double-neg86.6%
Simplified86.6%
if -84 < x < 0.00640000000000000031Initial program 100.0%
Taylor expanded in t around inf 86.3%
Final simplification86.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -145000000.0) (not (<= z 200000000000.0))) (* z (- x t)) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -145000000.0) || !(z <= 200000000000.0)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-145000000.0d0)) .or. (.not. (z <= 200000000000.0d0))) then
tmp = z * (x - t)
else
tmp = x + (y * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -145000000.0) || !(z <= 200000000000.0)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -145000000.0) or not (z <= 200000000000.0): tmp = z * (x - t) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -145000000.0) || !(z <= 200000000000.0)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x + Float64(y * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -145000000.0) || ~((z <= 200000000000.0))) tmp = z * (x - t); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -145000000.0], N[Not[LessEqual[z, 200000000000.0]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -145000000 \lor \neg \left(z \leq 200000000000\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -1.45e8 or 2e11 < z Initial program 100.0%
Taylor expanded in y around 0 82.8%
mul-1-neg82.8%
unsub-neg82.8%
Simplified82.8%
Taylor expanded in z around inf 82.8%
if -1.45e8 < z < 2e11Initial program 100.0%
Taylor expanded in y around inf 92.0%
*-commutative92.0%
Simplified92.0%
Final simplification87.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))))
(if (<= z -2.65e-8)
(+ x t_1)
(if (<= z 38000000000000.0) (+ x (* y (- t x))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -2.65e-8) {
tmp = x + t_1;
} else if (z <= 38000000000000.0) {
tmp = x + (y * (t - x));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z * (x - t)
if (z <= (-2.65d-8)) then
tmp = x + t_1
else if (z <= 38000000000000.0d0) then
tmp = x + (y * (t - x))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -2.65e-8) {
tmp = x + t_1;
} else if (z <= 38000000000000.0) {
tmp = x + (y * (t - x));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -2.65e-8: tmp = x + t_1 elif z <= 38000000000000.0: tmp = x + (y * (t - x)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -2.65e-8) tmp = Float64(x + t_1); elseif (z <= 38000000000000.0) tmp = Float64(x + Float64(y * Float64(t - x))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); tmp = 0.0; if (z <= -2.65e-8) tmp = x + t_1; elseif (z <= 38000000000000.0) tmp = x + (y * (t - x)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.65e-8], N[(x + t$95$1), $MachinePrecision], If[LessEqual[z, 38000000000000.0], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -2.65 \cdot 10^{-8}:\\
\;\;\;\;x + t\_1\\
\mathbf{elif}\;z \leq 38000000000000:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.6499999999999999e-8Initial program 100.0%
Taylor expanded in y around 0 81.4%
mul-1-neg81.4%
unsub-neg81.4%
Simplified81.4%
if -2.6499999999999999e-8 < z < 3.8e13Initial program 100.0%
Taylor expanded in y around inf 93.3%
*-commutative93.3%
Simplified93.3%
if 3.8e13 < z Initial program 99.9%
Taylor expanded in y around 0 82.5%
mul-1-neg82.5%
unsub-neg82.5%
Simplified82.5%
Taylor expanded in z around inf 82.5%
Final simplification87.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.4e-29) (not (<= y 52000.0))) (* y (- t x)) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.4e-29) || !(y <= 52000.0)) {
tmp = y * (t - x);
} 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 ((y <= (-4.4d-29)) .or. (.not. (y <= 52000.0d0))) then
tmp = y * (t - x)
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 ((y <= -4.4e-29) || !(y <= 52000.0)) {
tmp = y * (t - x);
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.4e-29) or not (y <= 52000.0): tmp = y * (t - x) else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.4e-29) || !(y <= 52000.0)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(x * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.4e-29) || ~((y <= 52000.0))) tmp = y * (t - x); else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.4e-29], N[Not[LessEqual[y, 52000.0]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{-29} \lor \neg \left(y \leq 52000\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if y < -4.39999999999999981e-29 or 52000 < y Initial program 100.0%
Taylor expanded in y around inf 79.6%
*-commutative79.6%
Simplified79.6%
Taylor expanded in y around inf 78.8%
if -4.39999999999999981e-29 < y < 52000Initial program 100.0%
Taylor expanded in y around inf 42.3%
*-commutative42.3%
Simplified42.3%
Taylor expanded in x around inf 36.2%
neg-mul-136.2%
unsub-neg36.2%
Simplified36.2%
Final simplification57.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.35e+20) (not (<= y 55000.0))) (* y (- x)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.35e+20) || !(y <= 55000.0)) {
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 <= (-2.35d+20)) .or. (.not. (y <= 55000.0d0))) 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 <= -2.35e+20) || !(y <= 55000.0)) {
tmp = y * -x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.35e+20) or not (y <= 55000.0): tmp = y * -x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.35e+20) || !(y <= 55000.0)) 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 <= -2.35e+20) || ~((y <= 55000.0))) tmp = y * -x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.35e+20], N[Not[LessEqual[y, 55000.0]], $MachinePrecision]], N[(y * (-x)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.35 \cdot 10^{+20} \lor \neg \left(y \leq 55000\right):\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.35e20 or 55000 < y Initial program 100.0%
Taylor expanded in y around inf 83.2%
*-commutative83.2%
Simplified83.2%
Taylor expanded in x around inf 46.1%
neg-mul-146.1%
unsub-neg46.1%
Simplified46.1%
Taylor expanded in y around inf 45.9%
associate-*r*45.9%
neg-mul-145.9%
*-commutative45.9%
Simplified45.9%
if -2.35e20 < y < 55000Initial program 100.0%
Taylor expanded in y around inf 42.4%
*-commutative42.4%
Simplified42.4%
Taylor expanded in y around 0 32.9%
Final simplification38.9%
(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 (- 1.0 y)))
double code(double x, double y, double z, double t) {
return x * (1.0 - y);
}
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 * (1.0d0 - y)
end function
public static double code(double x, double y, double z, double t) {
return x * (1.0 - y);
}
def code(x, y, z, t): return x * (1.0 - y)
function code(x, y, z, t) return Float64(x * Float64(1.0 - y)) end
function tmp = code(x, y, z, t) tmp = x * (1.0 - y); end
code[x_, y_, z_, t_] := N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - y\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around inf 61.2%
*-commutative61.2%
Simplified61.2%
Taylor expanded in x around inf 39.6%
neg-mul-139.6%
unsub-neg39.6%
Simplified39.6%
Final simplification39.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 y around inf 61.2%
*-commutative61.2%
Simplified61.2%
Taylor expanded in y around 0 18.9%
Final simplification18.9%
(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 2024077
(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))))