[Date Index]
[Thread Index]
[Author Index]
Re: Floor doesn't compute in some cases
*To*: mathgroup at smc.vnet.net
*Subject*: [mg83339] Re: [mg83234] Floor doesn't compute in some cases
*From*: Bob Hanlon <hanlonr at cox.net>
*Date*: Sat, 17 Nov 2007 05:37:38 -0500 (EST)
*Reply-to*: hanlonr at cox.net
Mathematica doesn't recognize that the argument is an integer and is trying to numerically determine whether the result is above or below 5. It runs out of precision before it can decide. You can force it to recognize that the argument is an integer by using FullSimplify before Floor.
Floor[FullSimplify[Log[32]/Log[2]]]
5
In this case, using N also gives the correct result but that is risky since in general the internal machine representation might go either way depending on which integer. For example,
Table[{n, Floor[N[Log[2^n]/Log[2]]]}, {n, 10}]
{{1, 1}, {2, 2}, {3, 2}, {4, 4},
{5, 5}, {6, 5}, {7, 6}, {8, 8},
{9, 9}, {10, 10}}
Bob Hanlon
---- Valeri Astanoff <astanoff at gmail.com> wrote:
> Good day,
>
> Floor doesn't compute in some cases:
>
> Floor[Log[31]/Log[2]]
>
> 4
>
> ok, but:
>
> Floor[Log[32]/Log[2]]
>
> Floor::meprec: Internal precision limit $MaxExtraPrecision = 50.`
> reached while evaluating Floor[Log[32]/Log[2]]. >>
>
> Floor[Log[32]/Log[2]]
>
> $Version
>
> 6.0 for Microsoft Windows (32-bit) (June 19, 2007)
>
> I don't see the reason why...
>
>
> V.Astanoff
>
Prev by Date:
**Memory problem using NDSolve in For Loop**
Next by Date:
**Re: memory release problem in mathematica6.0**
Previous by thread:
**Re: Floor doesn't compute in some cases**
Next by thread:
**Re: Floor doesn't compute in some cases**
| |