logarthim

Paul Leyland pleyland@microsoft.com
Mon, 28 Oct 2002 05:07:30 -0800


This is a multi-part message in MIME format.

--------------InterScan_NT_MIME_Boundary
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C27E82.F8C60B94"

------_=_NextPart_001_01C27E82.F8C60B94
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Three answers:
=20
1) The log is (generally) not an integer.
2) Log(0) is undefined
2) If you want floor(log(N)), for N>1,  the function to use is =
mpz_sizeinbase()
=20
The rest you can look up in the manual.
=20
Extending the function to N<0 or N=3D1, and determining the fractional =
part is left as an exercise.
=20
=20
Paul
=20

	-----Original Message-----
	From: Jan Sahner [mailto:jan@quaeldich.de]=20
	Sent: 28 October 2002 12:22
	To: Hatem Bahig
	Cc: gmp-discuss@swox.com
	Subject: Re: logarthim
=09
=09
	I don't think that this is conceptually possible, as this should =
usually be an irrational number.=20
	Yours,=20
	Jan=20
	Hatem Bahig wrote:=20

		Dear all  I would be thankful if some one inform me the name of =
function to  calculate the logarithm (log to base 2) for any integer =
(mpz) (in GMP)? Thank you in advance.=20


------_=_NextPart_001_01C27E82.F8C60B94
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR></HEAD>
<BODY bgColor=3D#ffffff>
<DIV><SPAN class=3D075545912-28102002><FONT face=3DArial color=3D#0000ff =
size=3D2>Three=20
answers:</FONT></SPAN></DIV>
<DIV><SPAN class=3D075545912-28102002><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D075545912-28102002><FONT face=3DArial color=3D#0000ff =
size=3D2>1) The=20
log is (generally) not an integer.</FONT></SPAN></DIV>
<DIV><SPAN class=3D075545912-28102002><FONT face=3DArial color=3D#0000ff =
size=3D2>2)=20
Log(0) is undefined</FONT></SPAN></DIV>
<DIV><SPAN class=3D075545912-28102002><FONT face=3DArial color=3D#0000ff =
size=3D2>2) If=20
you want floor(log(N)), for N&gt;1, &nbsp;the function to use is=20
mpz_sizeinbase()</FONT></SPAN></DIV>
<DIV><SPAN class=3D075545912-28102002><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D075545912-28102002><FONT face=3DArial color=3D#0000ff =
size=3D2>The=20
rest you can look up in the manual.</FONT></SPAN></DIV>
<DIV><SPAN class=3D075545912-28102002><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D075545912-28102002><FONT face=3DArial color=3D#0000ff =

size=3D2>Extending the function to N&lt;0 or N=3D1, and determining the =
fractional=20
part is left as an exercise.</FONT></SPAN></DIV>
<DIV><SPAN class=3D075545912-28102002><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D075545912-28102002></SPAN><SPAN =
class=3D075545912-28102002><FONT=20
face=3DArial color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D075545912-28102002><FONT face=3DArial color=3D#0000ff =

size=3D2>Paul</FONT></SPAN></DIV>
<DIV><SPAN class=3D075545912-28102002><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid; MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr =
align=3Dleft><FONT=20
  face=3DTahoma size=3D2>-----Original Message-----<BR><B>From:</B> Jan =
Sahner=20
  [mailto:jan@quaeldich.de] <BR><B>Sent:</B> 28 October 2002 =
12:22<BR><B>To:</B>=20
  Hatem Bahig<BR><B>Cc:</B> gmp-discuss@swox.com<BR><B>Subject:</B> Re:=20
  logarthim<BR><BR></FONT></DIV>I don't think that this is conceptually=20
  possible, as this should usually be an irrational number. <BR>Yours, =
<BR>Jan=20
  <BR>Hatem Bahig wrote:=20
  <BLOCKQUOTE TYPE=3D"CITE">
    <STYLE></STYLE>
    <FONT face=3DArial><FONT size=3D-1>Dear all</FONT></FONT>&nbsp;<FONT =

    face=3DArial><FONT size=3D-1>&nbsp;I would be thankful if some one =
inform me the=20
    name of function to&nbsp; calculate the logarithm (log to base 2) =
for any=20
    integer (mpz) (in GMP)?</FONT></FONT>&nbsp;<FONT face=3DArial><FONT=20
    size=3D-1>Thank you in=20
advance.</FONT></FONT>&nbsp;</BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>
=00
------_=_NextPart_001_01C27E82.F8C60B94--

--------------InterScan_NT_MIME_Boundary--