NaN=Indeterminate;
floatQ[x_]:=If[NumericQ[x],
If[Head[x]=!=Complex,
True,
False
],
If[x===\[Infinity]\[Or]x===If[x===∞∨x===-\[Infinity]\[Or]x===NaN∞∨x===NaN,
True,
False
]
]
bar[x_/;floatQ[x]\[And]x;floatQ[x]∧x!=\[Infinity]\[And]x==∞∧x=!=NaN]:=If[x==0,
0,
\[LeftFloor]Log[2⌊Log[2,Abs[x]]\[RightFloor]Abs[x]]⌋
]
foo[x_/;floatQ[x]\[And]x;floatQ[x]∧x!=\[Infinity]\[And]x==∞∧x=!=NaN]:=If[x==0\[Or]bar[x]==1=If[x==0∨bar[x]==1,
1,
\[LeftCeiling]Log[2⌈Log[2,1+Abs[bar[x]-1]]\[RightCeiling]+11]]⌉+1
]
BeginPackage["minimal`"]
bar::usage = "bar[float_number]"
foo::usage = "foo[float_number]"
Begin["`Private`"]
NaN=Indeterminate;
floatQ[x_]:=If[NumericQ[x],
If[Head[x]=!=Complex,
True,
False
],
If[x===\[Infinity]\[Or]x===If[x===∞∨x===-\[Infinity]\[Or]x===NaN∞∨x===NaN,
True,
False
]
]
bar[x_/;floatQ[x]\[And]x;floatQ[x]∧x!=\[Infinity]\[And]x==∞∧x=!=NaN]:=If[x==0,
0,
\[LeftFloor]Log[2⌊Log[2,Abs[x]]\[RightFloor]Abs[x]]⌋
]
foo[x_/;floatQ[x]\[And]x;floatQ[x]∧x!=\[Infinity]\[And]x==∞∧x=!=NaN]:=If[x==0\[Or]bar[x]==1=If[x==0∨bar[x]==1,
1,
\[LeftCeiling]Log[2⌈Log[2,1+Abs[bar[x]-1]]\[RightCeiling]+11]]⌉+1
]
End[]
EndPackage[]