
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (- 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
(let* ((t_1 (* x (- 1.0 y))) (t_2 (+ x (* x z))) (t_3 (+ x (* (- y z) t))))
(if (<= t -6.8e-44)
t_3
(if (<= t -1.5e-82)
t_1
(if (<= t -2.9e-134)
t_2
(if (<= t -3.2e-296) t_1 (if (<= t 4.5e-29) t_2 t_3)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - y);
double t_2 = x + (x * z);
double t_3 = x + ((y - z) * t);
double tmp;
if (t <= -6.8e-44) {
tmp = t_3;
} else if (t <= -1.5e-82) {
tmp = t_1;
} else if (t <= -2.9e-134) {
tmp = t_2;
} else if (t <= -3.2e-296) {
tmp = t_1;
} else if (t <= 4.5e-29) {
tmp = t_2;
} else {
tmp = t_3;
}
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 = x + (x * z)
t_3 = x + ((y - z) * t)
if (t <= (-6.8d-44)) then
tmp = t_3
else if (t <= (-1.5d-82)) then
tmp = t_1
else if (t <= (-2.9d-134)) then
tmp = t_2
else if (t <= (-3.2d-296)) then
tmp = t_1
else if (t <= 4.5d-29) then
tmp = t_2
else
tmp = t_3
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 = x + (x * z);
double t_3 = x + ((y - z) * t);
double tmp;
if (t <= -6.8e-44) {
tmp = t_3;
} else if (t <= -1.5e-82) {
tmp = t_1;
} else if (t <= -2.9e-134) {
tmp = t_2;
} else if (t <= -3.2e-296) {
tmp = t_1;
} else if (t <= 4.5e-29) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - y) t_2 = x + (x * z) t_3 = x + ((y - z) * t) tmp = 0 if t <= -6.8e-44: tmp = t_3 elif t <= -1.5e-82: tmp = t_1 elif t <= -2.9e-134: tmp = t_2 elif t <= -3.2e-296: tmp = t_1 elif t <= 4.5e-29: tmp = t_2 else: tmp = t_3 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - y)) t_2 = Float64(x + Float64(x * z)) t_3 = Float64(x + Float64(Float64(y - z) * t)) tmp = 0.0 if (t <= -6.8e-44) tmp = t_3; elseif (t <= -1.5e-82) tmp = t_1; elseif (t <= -2.9e-134) tmp = t_2; elseif (t <= -3.2e-296) tmp = t_1; elseif (t <= 4.5e-29) tmp = t_2; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - y); t_2 = x + (x * z); t_3 = x + ((y - z) * t); tmp = 0.0; if (t <= -6.8e-44) tmp = t_3; elseif (t <= -1.5e-82) tmp = t_1; elseif (t <= -2.9e-134) tmp = t_2; elseif (t <= -3.2e-296) tmp = t_1; elseif (t <= 4.5e-29) tmp = t_2; else tmp = t_3; 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[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.8e-44], t$95$3, If[LessEqual[t, -1.5e-82], t$95$1, If[LessEqual[t, -2.9e-134], t$95$2, If[LessEqual[t, -3.2e-296], t$95$1, If[LessEqual[t, 4.5e-29], t$95$2, t$95$3]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - y\right)\\
t_2 := x + x \cdot z\\
t_3 := x + \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -6.8 \cdot 10^{-44}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t \leq -1.5 \cdot 10^{-82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -2.9 \cdot 10^{-134}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -3.2 \cdot 10^{-296}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.5 \cdot 10^{-29}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if t < -6.80000000000000033e-44 or 4.4999999999999998e-29 < t Initial program 100.0%
Taylor expanded in t around inf 91.9%
if -6.80000000000000033e-44 < t < -1.4999999999999999e-82 or -2.89999999999999993e-134 < t < -3.20000000000000013e-296Initial program 100.0%
Taylor expanded in t around 0 88.6%
mul-1-neg88.6%
distribute-rgt-neg-in88.6%
sub-neg88.6%
+-commutative88.6%
distribute-neg-in88.6%
remove-double-neg88.6%
sub-neg88.6%
Simplified88.6%
Taylor expanded in z around 0 63.8%
*-rgt-identity63.8%
mul-1-neg63.8%
distribute-rgt-neg-out63.8%
distribute-lft-in63.8%
unsub-neg63.8%
Simplified63.8%
if -1.4999999999999999e-82 < t < -2.89999999999999993e-134 or -3.20000000000000013e-296 < t < 4.4999999999999998e-29Initial program 100.0%
Taylor expanded in t around 0 81.9%
mul-1-neg81.9%
distribute-rgt-neg-in81.9%
sub-neg81.9%
+-commutative81.9%
distribute-neg-in81.9%
remove-double-neg81.9%
sub-neg81.9%
Simplified81.9%
Taylor expanded in y around 0 68.5%
*-commutative68.5%
Simplified68.5%
Final simplification80.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- z))))
(if (<= z -6.8e+184)
t_1
(if (<= z -5.6e+168)
(* x z)
(if (<= z -1.6e+100)
t_1
(if (<= z 1100000000.0)
(+ x (* y t))
(if (<= z 5.2e+115) (+ x (* x z)) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double tmp;
if (z <= -6.8e+184) {
tmp = t_1;
} else if (z <= -5.6e+168) {
tmp = x * z;
} else if (z <= -1.6e+100) {
tmp = t_1;
} else if (z <= 1100000000.0) {
tmp = x + (y * t);
} else if (z <= 5.2e+115) {
tmp = x + (x * z);
} 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 = t * -z
if (z <= (-6.8d+184)) then
tmp = t_1
else if (z <= (-5.6d+168)) then
tmp = x * z
else if (z <= (-1.6d+100)) then
tmp = t_1
else if (z <= 1100000000.0d0) then
tmp = x + (y * t)
else if (z <= 5.2d+115) then
tmp = x + (x * z)
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 = t * -z;
double tmp;
if (z <= -6.8e+184) {
tmp = t_1;
} else if (z <= -5.6e+168) {
tmp = x * z;
} else if (z <= -1.6e+100) {
tmp = t_1;
} else if (z <= 1100000000.0) {
tmp = x + (y * t);
} else if (z <= 5.2e+115) {
tmp = x + (x * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * -z tmp = 0 if z <= -6.8e+184: tmp = t_1 elif z <= -5.6e+168: tmp = x * z elif z <= -1.6e+100: tmp = t_1 elif z <= 1100000000.0: tmp = x + (y * t) elif z <= 5.2e+115: tmp = x + (x * z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(-z)) tmp = 0.0 if (z <= -6.8e+184) tmp = t_1; elseif (z <= -5.6e+168) tmp = Float64(x * z); elseif (z <= -1.6e+100) tmp = t_1; elseif (z <= 1100000000.0) tmp = Float64(x + Float64(y * t)); elseif (z <= 5.2e+115) tmp = Float64(x + Float64(x * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * -z; tmp = 0.0; if (z <= -6.8e+184) tmp = t_1; elseif (z <= -5.6e+168) tmp = x * z; elseif (z <= -1.6e+100) tmp = t_1; elseif (z <= 1100000000.0) tmp = x + (y * t); elseif (z <= 5.2e+115) tmp = x + (x * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * (-z)), $MachinePrecision]}, If[LessEqual[z, -6.8e+184], t$95$1, If[LessEqual[z, -5.6e+168], N[(x * z), $MachinePrecision], If[LessEqual[z, -1.6e+100], t$95$1, If[LessEqual[z, 1100000000.0], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.2e+115], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -6.8 \cdot 10^{+184}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{+168}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{+100}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1100000000:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+115}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.8000000000000003e184 or -5.5999999999999998e168 < z < -1.5999999999999999e100 or 5.2000000000000001e115 < z Initial program 100.0%
Taylor expanded in t around inf 64.2%
Taylor expanded in y around 0 58.4%
mul-1-neg58.4%
unsub-neg58.4%
Simplified58.4%
Taylor expanded in x around 0 58.4%
associate-*r*58.4%
neg-mul-158.4%
*-commutative58.4%
Simplified58.4%
if -6.8000000000000003e184 < z < -5.5999999999999998e168Initial program 100.0%
Taylor expanded in t around 0 86.1%
mul-1-neg86.1%
distribute-rgt-neg-in86.1%
sub-neg86.1%
+-commutative86.1%
distribute-neg-in86.1%
remove-double-neg86.1%
sub-neg86.1%
Simplified86.1%
sub-neg86.1%
distribute-rgt-in71.8%
Applied egg-rr71.8%
associate-+r+71.8%
distribute-lft-neg-out71.8%
unsub-neg71.8%
*-un-lft-identity71.8%
distribute-rgt-out71.8%
Applied egg-rr71.8%
Taylor expanded in z around inf 86.1%
*-commutative86.1%
Simplified86.1%
if -1.5999999999999999e100 < z < 1.1e9Initial program 100.0%
Taylor expanded in t around inf 76.4%
Taylor expanded in y around inf 62.8%
if 1.1e9 < z < 5.2000000000000001e115Initial program 99.9%
Taylor expanded in t around 0 62.7%
mul-1-neg62.7%
distribute-rgt-neg-in62.7%
sub-neg62.7%
+-commutative62.7%
distribute-neg-in62.7%
remove-double-neg62.7%
sub-neg62.7%
Simplified62.7%
Taylor expanded in y around 0 58.6%
*-commutative58.6%
Simplified58.6%
Final simplification61.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- z))))
(if (<= z -3.1e+184)
t_1
(if (<= z -6e+168)
(* x z)
(if (<= z -2.2e+101)
t_1
(if (<= z 1450000000.0)
(+ x (* y t))
(if (<= z 7.5e+116) (* x z) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double tmp;
if (z <= -3.1e+184) {
tmp = t_1;
} else if (z <= -6e+168) {
tmp = x * z;
} else if (z <= -2.2e+101) {
tmp = t_1;
} else if (z <= 1450000000.0) {
tmp = x + (y * t);
} else if (z <= 7.5e+116) {
tmp = x * z;
} 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 = t * -z
if (z <= (-3.1d+184)) then
tmp = t_1
else if (z <= (-6d+168)) then
tmp = x * z
else if (z <= (-2.2d+101)) then
tmp = t_1
else if (z <= 1450000000.0d0) then
tmp = x + (y * t)
else if (z <= 7.5d+116) then
tmp = x * z
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 = t * -z;
double tmp;
if (z <= -3.1e+184) {
tmp = t_1;
} else if (z <= -6e+168) {
tmp = x * z;
} else if (z <= -2.2e+101) {
tmp = t_1;
} else if (z <= 1450000000.0) {
tmp = x + (y * t);
} else if (z <= 7.5e+116) {
tmp = x * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * -z tmp = 0 if z <= -3.1e+184: tmp = t_1 elif z <= -6e+168: tmp = x * z elif z <= -2.2e+101: tmp = t_1 elif z <= 1450000000.0: tmp = x + (y * t) elif z <= 7.5e+116: tmp = x * z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(-z)) tmp = 0.0 if (z <= -3.1e+184) tmp = t_1; elseif (z <= -6e+168) tmp = Float64(x * z); elseif (z <= -2.2e+101) tmp = t_1; elseif (z <= 1450000000.0) tmp = Float64(x + Float64(y * t)); elseif (z <= 7.5e+116) tmp = Float64(x * z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * -z; tmp = 0.0; if (z <= -3.1e+184) tmp = t_1; elseif (z <= -6e+168) tmp = x * z; elseif (z <= -2.2e+101) tmp = t_1; elseif (z <= 1450000000.0) tmp = x + (y * t); elseif (z <= 7.5e+116) tmp = x * z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * (-z)), $MachinePrecision]}, If[LessEqual[z, -3.1e+184], t$95$1, If[LessEqual[z, -6e+168], N[(x * z), $MachinePrecision], If[LessEqual[z, -2.2e+101], t$95$1, If[LessEqual[z, 1450000000.0], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.5e+116], N[(x * z), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -3.1 \cdot 10^{+184}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -6 \cdot 10^{+168}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -2.2 \cdot 10^{+101}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1450000000:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+116}:\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.0999999999999998e184 or -5.9999999999999996e168 < z < -2.2000000000000001e101 or 7.5e116 < z Initial program 100.0%
Taylor expanded in t around inf 64.2%
Taylor expanded in y around 0 58.4%
mul-1-neg58.4%
unsub-neg58.4%
Simplified58.4%
Taylor expanded in x around 0 58.4%
associate-*r*58.4%
neg-mul-158.4%
*-commutative58.4%
Simplified58.4%
if -3.0999999999999998e184 < z < -5.9999999999999996e168 or 1.45e9 < z < 7.5e116Initial program 99.9%
Taylor expanded in t around 0 68.6%
mul-1-neg68.6%
distribute-rgt-neg-in68.6%
sub-neg68.6%
+-commutative68.6%
distribute-neg-in68.6%
remove-double-neg68.6%
sub-neg68.6%
Simplified68.6%
sub-neg68.6%
distribute-rgt-in65.0%
Applied egg-rr65.0%
associate-+r+65.0%
distribute-lft-neg-out65.0%
unsub-neg65.0%
*-un-lft-identity65.0%
distribute-rgt-out65.0%
Applied egg-rr65.0%
Taylor expanded in z around inf 63.3%
*-commutative63.3%
Simplified63.3%
if -2.2000000000000001e101 < z < 1.45e9Initial program 100.0%
Taylor expanded in t around inf 76.4%
Taylor expanded in y around inf 62.8%
Final simplification61.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- z))) (t_2 (* x (- 1.0 y))))
(if (<= t -0.0071)
t_1
(if (<= t 3.2e-81)
t_2
(if (<= t 4200000000000.0) (* x z) (if (<= t 3.3e+39) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double t_2 = x * (1.0 - y);
double tmp;
if (t <= -0.0071) {
tmp = t_1;
} else if (t <= 3.2e-81) {
tmp = t_2;
} else if (t <= 4200000000000.0) {
tmp = x * z;
} else if (t <= 3.3e+39) {
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 = t * -z
t_2 = x * (1.0d0 - y)
if (t <= (-0.0071d0)) then
tmp = t_1
else if (t <= 3.2d-81) then
tmp = t_2
else if (t <= 4200000000000.0d0) then
tmp = x * z
else if (t <= 3.3d+39) 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 = t * -z;
double t_2 = x * (1.0 - y);
double tmp;
if (t <= -0.0071) {
tmp = t_1;
} else if (t <= 3.2e-81) {
tmp = t_2;
} else if (t <= 4200000000000.0) {
tmp = x * z;
} else if (t <= 3.3e+39) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * -z t_2 = x * (1.0 - y) tmp = 0 if t <= -0.0071: tmp = t_1 elif t <= 3.2e-81: tmp = t_2 elif t <= 4200000000000.0: tmp = x * z elif t <= 3.3e+39: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(-z)) t_2 = Float64(x * Float64(1.0 - y)) tmp = 0.0 if (t <= -0.0071) tmp = t_1; elseif (t <= 3.2e-81) tmp = t_2; elseif (t <= 4200000000000.0) tmp = Float64(x * z); elseif (t <= 3.3e+39) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * -z; t_2 = x * (1.0 - y); tmp = 0.0; if (t <= -0.0071) tmp = t_1; elseif (t <= 3.2e-81) tmp = t_2; elseif (t <= 4200000000000.0) tmp = x * z; elseif (t <= 3.3e+39) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * (-z)), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -0.0071], t$95$1, If[LessEqual[t, 3.2e-81], t$95$2, If[LessEqual[t, 4200000000000.0], N[(x * z), $MachinePrecision], If[LessEqual[t, 3.3e+39], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(-z\right)\\
t_2 := x \cdot \left(1 - y\right)\\
\mathbf{if}\;t \leq -0.0071:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{-81}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 4200000000000:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;t \leq 3.3 \cdot 10^{+39}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -0.0071000000000000004 or 3.30000000000000021e39 < t Initial program 100.0%
Taylor expanded in t around inf 95.6%
Taylor expanded in y around 0 58.5%
mul-1-neg58.5%
unsub-neg58.5%
Simplified58.5%
Taylor expanded in x around 0 51.4%
associate-*r*51.4%
neg-mul-151.4%
*-commutative51.4%
Simplified51.4%
if -0.0071000000000000004 < t < 3.2e-81 or 4.2e12 < t < 3.30000000000000021e39Initial program 100.0%
Taylor expanded in t around 0 84.9%
mul-1-neg84.9%
distribute-rgt-neg-in84.9%
sub-neg84.9%
+-commutative84.9%
distribute-neg-in84.9%
remove-double-neg84.9%
sub-neg84.9%
Simplified84.9%
Taylor expanded in z around 0 55.3%
*-rgt-identity55.3%
mul-1-neg55.3%
distribute-rgt-neg-out55.3%
distribute-lft-in55.3%
unsub-neg55.3%
Simplified55.3%
if 3.2e-81 < t < 4.2e12Initial program 99.9%
Taylor expanded in t around 0 61.2%
mul-1-neg61.2%
distribute-rgt-neg-in61.2%
sub-neg61.2%
+-commutative61.2%
distribute-neg-in61.2%
remove-double-neg61.2%
sub-neg61.2%
Simplified61.2%
sub-neg61.2%
distribute-rgt-in54.7%
Applied egg-rr54.7%
associate-+r+54.7%
distribute-lft-neg-out54.7%
unsub-neg54.7%
*-un-lft-identity54.7%
distribute-rgt-out54.7%
Applied egg-rr54.7%
Taylor expanded in z around inf 51.5%
*-commutative51.5%
Simplified51.5%
Final simplification53.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- z))))
(if (<= t -2.15e-18)
t_1
(if (<= t -1.2e-148)
(* x z)
(if (<= t -1.25e-235) x (if (<= t 3500.0) (* x z) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double tmp;
if (t <= -2.15e-18) {
tmp = t_1;
} else if (t <= -1.2e-148) {
tmp = x * z;
} else if (t <= -1.25e-235) {
tmp = x;
} else if (t <= 3500.0) {
tmp = x * z;
} 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 = t * -z
if (t <= (-2.15d-18)) then
tmp = t_1
else if (t <= (-1.2d-148)) then
tmp = x * z
else if (t <= (-1.25d-235)) then
tmp = x
else if (t <= 3500.0d0) then
tmp = x * z
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 = t * -z;
double tmp;
if (t <= -2.15e-18) {
tmp = t_1;
} else if (t <= -1.2e-148) {
tmp = x * z;
} else if (t <= -1.25e-235) {
tmp = x;
} else if (t <= 3500.0) {
tmp = x * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * -z tmp = 0 if t <= -2.15e-18: tmp = t_1 elif t <= -1.2e-148: tmp = x * z elif t <= -1.25e-235: tmp = x elif t <= 3500.0: tmp = x * z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(-z)) tmp = 0.0 if (t <= -2.15e-18) tmp = t_1; elseif (t <= -1.2e-148) tmp = Float64(x * z); elseif (t <= -1.25e-235) tmp = x; elseif (t <= 3500.0) tmp = Float64(x * z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * -z; tmp = 0.0; if (t <= -2.15e-18) tmp = t_1; elseif (t <= -1.2e-148) tmp = x * z; elseif (t <= -1.25e-235) tmp = x; elseif (t <= 3500.0) tmp = x * z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * (-z)), $MachinePrecision]}, If[LessEqual[t, -2.15e-18], t$95$1, If[LessEqual[t, -1.2e-148], N[(x * z), $MachinePrecision], If[LessEqual[t, -1.25e-235], x, If[LessEqual[t, 3500.0], N[(x * z), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(-z\right)\\
\mathbf{if}\;t \leq -2.15 \cdot 10^{-18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.2 \cdot 10^{-148}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;t \leq -1.25 \cdot 10^{-235}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 3500:\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.1500000000000001e-18 or 3500 < t Initial program 100.0%
Taylor expanded in t around inf 92.4%
Taylor expanded in y around 0 57.2%
mul-1-neg57.2%
unsub-neg57.2%
Simplified57.2%
Taylor expanded in x around 0 49.3%
associate-*r*49.3%
neg-mul-149.3%
*-commutative49.3%
Simplified49.3%
if -2.1500000000000001e-18 < t < -1.2000000000000001e-148 or -1.2499999999999999e-235 < t < 3500Initial program 100.0%
Taylor expanded in t around 0 83.7%
mul-1-neg83.7%
distribute-rgt-neg-in83.7%
sub-neg83.7%
+-commutative83.7%
distribute-neg-in83.7%
remove-double-neg83.7%
sub-neg83.7%
Simplified83.7%
sub-neg83.7%
distribute-rgt-in81.6%
Applied egg-rr81.6%
associate-+r+81.6%
distribute-lft-neg-out81.6%
unsub-neg81.6%
*-un-lft-identity81.6%
distribute-rgt-out81.6%
Applied egg-rr81.6%
Taylor expanded in z around inf 43.4%
*-commutative43.4%
Simplified43.4%
if -1.2000000000000001e-148 < t < -1.2499999999999999e-235Initial program 99.9%
Taylor expanded in t around inf 58.4%
Taylor expanded in x around inf 38.5%
Final simplification46.2%
(FPCore (x y z t) :precision binary64 (if (<= t -1.8e+177) (+ x (* y t)) (if (or (<= t -2.55e-14) (not (<= t 114.0))) (- x (* z t)) (+ x (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.8e+177) {
tmp = x + (y * t);
} else if ((t <= -2.55e-14) || !(t <= 114.0)) {
tmp = x - (z * t);
} else {
tmp = x + (x * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-1.8d+177)) then
tmp = x + (y * t)
else if ((t <= (-2.55d-14)) .or. (.not. (t <= 114.0d0))) then
tmp = x - (z * t)
else
tmp = x + (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.8e+177) {
tmp = x + (y * t);
} else if ((t <= -2.55e-14) || !(t <= 114.0)) {
tmp = x - (z * t);
} else {
tmp = x + (x * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.8e+177: tmp = x + (y * t) elif (t <= -2.55e-14) or not (t <= 114.0): tmp = x - (z * t) else: tmp = x + (x * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.8e+177) tmp = Float64(x + Float64(y * t)); elseif ((t <= -2.55e-14) || !(t <= 114.0)) tmp = Float64(x - Float64(z * t)); else tmp = Float64(x + Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.8e+177) tmp = x + (y * t); elseif ((t <= -2.55e-14) || ~((t <= 114.0))) tmp = x - (z * t); else tmp = x + (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.8e+177], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, -2.55e-14], N[Not[LessEqual[t, 114.0]], $MachinePrecision]], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{+177}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;t \leq -2.55 \cdot 10^{-14} \lor \neg \left(t \leq 114\right):\\
\;\;\;\;x - z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot z\\
\end{array}
\end{array}
if t < -1.80000000000000001e177Initial program 100.0%
Taylor expanded in t around inf 100.0%
Taylor expanded in y around inf 67.4%
if -1.80000000000000001e177 < t < -2.5499999999999999e-14 or 114 < t Initial program 100.0%
Taylor expanded in t around inf 90.8%
Taylor expanded in y around 0 59.5%
mul-1-neg59.5%
unsub-neg59.5%
Simplified59.5%
if -2.5499999999999999e-14 < t < 114Initial program 100.0%
Taylor expanded in t around 0 83.0%
mul-1-neg83.0%
distribute-rgt-neg-in83.0%
sub-neg83.0%
+-commutative83.0%
distribute-neg-in83.0%
remove-double-neg83.0%
sub-neg83.0%
Simplified83.0%
Taylor expanded in y around 0 58.2%
*-commutative58.2%
Simplified58.2%
Final simplification59.6%
(FPCore (x y z t) :precision binary64 (if (<= z -0.44) (* x z) (if (<= z 5.8e-243) x (if (<= z 12200000000.0) (* x (- y)) (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.44) {
tmp = x * z;
} else if (z <= 5.8e-243) {
tmp = x;
} else if (z <= 12200000000.0) {
tmp = x * -y;
} else {
tmp = x * z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-0.44d0)) then
tmp = x * z
else if (z <= 5.8d-243) then
tmp = x
else if (z <= 12200000000.0d0) then
tmp = x * -y
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.44) {
tmp = x * z;
} else if (z <= 5.8e-243) {
tmp = x;
} else if (z <= 12200000000.0) {
tmp = x * -y;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.44: tmp = x * z elif z <= 5.8e-243: tmp = x elif z <= 12200000000.0: tmp = x * -y else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.44) tmp = Float64(x * z); elseif (z <= 5.8e-243) tmp = x; elseif (z <= 12200000000.0) tmp = Float64(x * Float64(-y)); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.44) tmp = x * z; elseif (z <= 5.8e-243) tmp = x; elseif (z <= 12200000000.0) tmp = x * -y; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.44], N[(x * z), $MachinePrecision], If[LessEqual[z, 5.8e-243], x, If[LessEqual[z, 12200000000.0], N[(x * (-y)), $MachinePrecision], N[(x * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.44:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-243}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 12200000000:\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -0.440000000000000002 or 1.22e10 < z Initial program 100.0%
Taylor expanded in t around 0 51.8%
mul-1-neg51.8%
distribute-rgt-neg-in51.8%
sub-neg51.8%
+-commutative51.8%
distribute-neg-in51.8%
remove-double-neg51.8%
sub-neg51.8%
Simplified51.8%
sub-neg51.8%
distribute-rgt-in47.9%
Applied egg-rr47.9%
associate-+r+47.9%
distribute-lft-neg-out47.9%
unsub-neg47.9%
*-un-lft-identity47.9%
distribute-rgt-out47.9%
Applied egg-rr47.9%
Taylor expanded in z around inf 43.3%
*-commutative43.3%
Simplified43.3%
if -0.440000000000000002 < z < 5.79999999999999953e-243Initial program 100.0%
Taylor expanded in t around inf 83.6%
Taylor expanded in x around inf 37.0%
if 5.79999999999999953e-243 < z < 1.22e10Initial program 100.0%
Taylor expanded in t around 0 54.1%
mul-1-neg54.1%
distribute-rgt-neg-in54.1%
sub-neg54.1%
+-commutative54.1%
distribute-neg-in54.1%
remove-double-neg54.1%
sub-neg54.1%
Simplified54.1%
sub-neg54.1%
distribute-rgt-in54.1%
Applied egg-rr54.1%
Taylor expanded in z around 0 52.6%
mul-1-neg52.6%
*-commutative52.6%
unsub-neg52.6%
*-commutative52.6%
Simplified52.6%
Taylor expanded in y around inf 33.6%
associate-*r*33.6%
neg-mul-133.6%
*-commutative33.6%
Simplified33.6%
Final simplification39.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.45e-34) (not (<= t 1.65e+37))) (+ x (* (- y z) t)) (+ x (* x (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.45e-34) || !(t <= 1.65e+37)) {
tmp = x + ((y - z) * t);
} else {
tmp = x + (x * (z - y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.45d-34)) .or. (.not. (t <= 1.65d+37))) then
tmp = x + ((y - z) * t)
else
tmp = x + (x * (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.45e-34) || !(t <= 1.65e+37)) {
tmp = x + ((y - z) * t);
} else {
tmp = x + (x * (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.45e-34) or not (t <= 1.65e+37): tmp = x + ((y - z) * t) else: tmp = x + (x * (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.45e-34) || !(t <= 1.65e+37)) tmp = Float64(x + Float64(Float64(y - z) * t)); else tmp = Float64(x + Float64(x * Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.45e-34) || ~((t <= 1.65e+37))) tmp = x + ((y - z) * t); else tmp = x + (x * (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.45e-34], N[Not[LessEqual[t, 1.65e+37]], $MachinePrecision]], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{-34} \lor \neg \left(t \leq 1.65 \cdot 10^{+37}\right):\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\end{array}
\end{array}
if t < -1.4500000000000001e-34 or 1.65e37 < t Initial program 100.0%
Taylor expanded in t around inf 95.6%
if -1.4500000000000001e-34 < t < 1.65e37Initial program 100.0%
Taylor expanded in t around 0 82.7%
mul-1-neg82.7%
distribute-rgt-neg-in82.7%
sub-neg82.7%
+-commutative82.7%
distribute-neg-in82.7%
remove-double-neg82.7%
sub-neg82.7%
Simplified82.7%
Final simplification89.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.062) (not (<= z 1.0))) (* x z) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.062) || !(z <= 1.0)) {
tmp = x * z;
} 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 <= (-0.062d0)) .or. (.not. (z <= 1.0d0))) then
tmp = x * z
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 <= -0.062) || !(z <= 1.0)) {
tmp = x * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.062) or not (z <= 1.0): tmp = x * z else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.062) || !(z <= 1.0)) tmp = Float64(x * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -0.062) || ~((z <= 1.0))) tmp = x * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.062], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x * z), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.062 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.062 or 1 < z Initial program 100.0%
Taylor expanded in t around 0 52.5%
mul-1-neg52.5%
distribute-rgt-neg-in52.5%
sub-neg52.5%
+-commutative52.5%
distribute-neg-in52.5%
remove-double-neg52.5%
sub-neg52.5%
Simplified52.5%
sub-neg52.5%
distribute-rgt-in48.7%
Applied egg-rr48.7%
associate-+r+48.7%
distribute-lft-neg-out48.7%
unsub-neg48.7%
*-un-lft-identity48.7%
distribute-rgt-out48.7%
Applied egg-rr48.7%
Taylor expanded in z around inf 43.1%
*-commutative43.1%
Simplified43.1%
if -0.062 < z < 1Initial program 100.0%
Taylor expanded in t around inf 79.5%
Taylor expanded in x around inf 30.1%
Final simplification36.8%
(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 68.1%
Taylor expanded in x around inf 16.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 2024085
(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))))