<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.6000.16939" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face="Courier New" size=2>Mathematically your derivation is correct,
but computationally it may be incorrect. The problem is that in an actual
computation, e.g. in Scheme,</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>(expt 10 (/ (log q) (log 10)))</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>may be</FONT></DIV>
<DIV><FONT face="Courier New" size=2>slightly less than q</FONT></DIV>
<DIV><FONT face="Courier New" size=2>or exactly equal to q</FONT></DIV>
<DIV><FONT face="Courier New" size=2>or slightly greater than q.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>This holds even when q is exact, for log is
not required to and often even cannot produce an exact result. In fact I do not
even trust that the absolute error of (/ (log q) (log 10)) is allways less than
one, where absolute error is the difference between mathematical value and
actually computed value. As another axample:</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>(- 2 (sqr (sqrt 2))) ; -->
-4.440892098500626e-016 and hence:</FONT></DIV>
<DIV><FONT face="Courier New" size=2>(zero? (- 2 (sqr (sqrt 2)))) -->
#f</FONT></DIV>
<DIV><FONT face="Courier New" size=2>Jos</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>----- Original Message ----- </FONT></DIV>
<DIV>
<DIV><FONT face="Courier New" size=2>From: "Jens Axel Søgaard" <</FONT><A
href="mailto:jensaxel@soegaard.net"><FONT face="Courier New"
size=2>jensaxel@soegaard.net</FONT></A><FONT face="Courier New"
size=2>></FONT></DIV>
<DIV><FONT face="Courier New" size=2>To: "Jos Koot" <</FONT><A
href="mailto:jos.koot@telefonica.net"><FONT face="Courier New"
size=2>jos.koot@telefonica.net</FONT></A><FONT face="Courier New"
size=2>></FONT></DIV>
<DIV><FONT face="Courier New" size=2>Cc: <</FONT><A
href="mailto:plt-scheme@list.cs.brown.edu"><FONT face="Courier New"
size=2>plt-scheme@list.cs.brown.edu</FONT></A><FONT face="Courier New"
size=2>></FONT></DIV>
<DIV><FONT face="Courier New" size=2>Sent: Thursday, November 05, 2009 2:58
PM</FONT></DIV>
<DIV><FONT face="Courier New" size=2>Subject: Re: [plt-scheme] order of
magnitude</FONT></DIV></DIV>
<DIV><FONT face="Courier New"><BR><FONT size=2></FONT></FONT></DIV><FONT
face="Courier New" size=2>2009/11/5 Jos Koot <</FONT><A
href="mailto:jos.koot@telefonica.net"><FONT face="Courier New"
size=2>jos.koot@telefonica.net</FONT></A><FONT face="Courier New"
size=2>>:<BR>> Let q be a positive rational (or real) number.<BR>> I am
looking for the greatest integer number m such that:<BR>> (<= (expt 10 m)
q)<BR><BR>I get:<BR><BR>greatest integer m s.t.: 10^m <=
q<BR>greatest integer m s.t.: log(10^m) <= log(q)<BR>greatest
integer m s.t.: m*log(10) <= log(q)<BR>greatest integer m
s.t.: m <=
log(q)/log(10)<BR>
m = floor(log(q)/log(10))<BR><BR>-- <BR>Jens Axel
Søgaard<BR></FONT></BODY></HTML>