Log.htm 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>Log# ( x# )</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. x = any positive number.
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. Natural logarithm of x. This is the inverse of Exp( ). <br />
  21. <br />
  22. y = Log( x ) means y satifies x = Exp( y ). <br />
  23. <br />
  24. The base of the natural logarithm is e = Exp(1) = 2.71828... <br />
  25. <br />
  26. See also Exp()
  27. </td>
  28. </tr>
  29. </table>
  30. <h1><a href=../2d_examples/Log.bb>Example</a></h1>
  31. <table>
  32. <tr>
  33. <td>
  34. ; Log example <br />
  35. <br />
  36. ; NaN means "Not a Number", the numerical result is invalid. <br />
  37. <br />
  38. ; NOTE: All logarithm functions are related. For example, there is no <br />
  39. ; Log8 function in Blitz, but we can easily make one. <br />
  40. <br />
  41. HidePointer <br />
  42. <br />
  43. Print "Log8( -1 ) = " + Log8( -1 ) <br />
  44. Print "Log8( 0 ) = " + Log8( 0 ) <br />
  45. Print <br />
  46. <br />
  47. ; ... and now some well behaved numbers... <br />
  48. <br />
  49. x# = 1.0 / 4096.0 ; small positive number <br />
  50. <br />
  51. For n = 1 To 15 <br />
  52. <br />
  53. Print "Log8( " + LSet( x, 13 ) + " ) = " + Log8( x ) <br />
  54. x = 8 * x <br />
  55. <br />
  56. Next <br />
  57. <br />
  58. WaitKey() : End <br />
  59. <br />
  60. <br />
  61. Function Log8# ( x# ) <br />
  62. <br />
  63. Return Log( x ) / Log( 8 ) <br />
  64. <br />
  65. End Function
  66. </td>
  67. </tr>
  68. </table>
  69. <br>
  70. <a target=_top href=../index.htm>Index</a><br>
  71. <br>
  72. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=Log&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  73. </html>