[Date Index]
[Thread Index]
[Author Index]
Re: Floor doesn't compute in some cases
*To*: mathgroup at smc.vnet.net
*Subject*: [mg83356] Re: Floor doesn't compute in some cases
*From*: David Bailey <dave at Remove_Thisdbailey.co.uk>
*Date*: Sun, 18 Nov 2007 04:47:36 -0500 (EST)
*References*: <fhmhvm$avf$1@smc.vnet.net>
Bob Hanlon wrote:
> 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
>>
>
>
It is worth mentioning that this issue is discussed in the Floor
documentation as a "Special Issue", but in a fairly cryptic way. The
error message itself just links to the description of the Floor function
- so unless you open all the sections of that page, you are none the wiser!
This is yet another example of the fact that WRI should have a serious
review of their documentation.
David Bailey
http://www.dbaileyconsultancy.co.uk
Prev by Date:
**Re: Trouble with Rotate**
Next by Date:
**Re: Minimizing Mathematica file size for source code control?**
Previous by thread:
**Re: Floor doesn't compute in some cases**
Next by thread:
**Re: Floor doesn't compute in some cases**
| |