Same motivation as this q. Why doesn't Rationalize work for 0.?
Interval[{0., 1.}] // Map[Rationalize, #, {2}] &
Interval[{-4.45015*10^-308,1}]
There's nothing wrong with 0. by itself:
{0., 1.} // Map[Rationalize]
{0, 1}
Same motivation as this q. Why doesn't Rationalize work for 0.?
Interval[{0., 1.}] // Map[Rationalize, #, {2}] &
Interval[{-4.45015*10^-308,1}]
There's nothing wrong with 0. by itself:
{0., 1.} // Map[Rationalize]
{0, 1}
I believe this has to do with the fact that intervals "grow" just a bit on evaluation with machine numbers to ensure that values at the endpoint will be included in the interval.
NestList[Interval @@ # &, Interval[{0., 1.}], 5] // InputForm
(*
{Interval[{-2.2250738585072014*^-308, 1.0000000000000002}],
Interval[{-4.450147717014403*^-308, 1.0000000000000004}],
Interval[{-6.675221575521604*^-308, 1.0000000000000007}],
Interval[{-8.900295434028806*^-308, 1.0000000000000009}],
Interval[{-1.1125369292536007*^-307, 1.000000000000001}],
Interval[{-1.3350443151043208*^-307, 1.0000000000000013}]}
*)
I'm only guessing at why it is designed this way. The docs give a pretty vague description.
"For approximate machine- or arbitrary-precision numbers x, Interval[x] yields an interval reflecting the uncertainty in x."
Edit:
Just to make it a little more interesting, this is what it appears to be doing to the endpoints.
NestList[# + {$MinMachineNumber, $MachineEpsilon} &, {0., 1.}, 5] // InputForm
(*
{{0., 1.},
{2.2250738585072014*^-308, 1.0000000000000002},
{4.450147717014403*^-308, 1.0000000000000004},
{6.675221575521604*^-308, 1.0000000000000007},
{8.900295434028806*^-308, 1.0000000000000009},
{1.1125369292536007*^-307, 1.000000000000001}}
*)
I suspect that in general the step is $MachineEpsilon but zero is a special case as it often is in Mathematica.
Rationalize[]if seen fit. – J. M.'s missing motivation Aug 05 '15 at 20:30Map[Rationalize[#, 0] &, Interval[{0., 1.}], {2}]– Dr. belisarius Aug 05 '15 at 20:32Interval[{0., 1.}] // Map[Rationalize[#, 0.0000000000000001] &, #, {2}] &– alancalvitti Aug 05 '15 at 20:33Intervalspecific. – alancalvitti Aug 05 '15 at 20:34Interval[{0., 1.}]/2 // Rationalizefor demonstrating how bad my floating-point intuition is. – Patrick Stevens Aug 05 '15 at 20:36Interval[{0., 1.}]/2 // Rationalize // Traceand$MinMachineNumbershows that "though this be madness, yet there is method in't." – Michael E2 Aug 05 '15 at 23:00Rationalizebefore evaluatingInterval. – Daniel Lichtblau Aug 06 '15 at 00:29