This manual page is for Mac OS X version 10.6.3

If you are running a different version of Mac OS X, view the documentation locally:

  • In Terminal, using the man(1) command

Reading manual pages

Manual pages are intended as a quick reference for people who already understand a technology.

  • For more information about the manual page format, see the manual page for manpages(5).

  • For more information about this technology, look for other documentation in the Apple Reference Library.

  • For general information about writing shell scripts, read Shell Scripting Primer.




math::constants(n)                            Tcl Math Library                            math::constants(n)



____________________________________________________________________________________________________________

NAME
       math::constants - Mathematical and numerical constants

SYNOPSIS
       package require Tcl  ?8.3?

       package require math::constants  ?1.0.1?

       ::math::constants::constants args

       ::math::constants::print-constants args

____________________________________________________________________________________________________________

DESCRIPTION
       This  package defines some common mathematical and numerical constants.  By using the package you get
       consistent values for numbers like pi and ln(10).

       It defines two commands:

             One for importing the constants

             One for reporting which constants are defined and what values they actually have.


       The motivation for this package is that quite often, with (mathematical)  computations,  you  need  a
       good approximation to, say, the ratio of degrees to radians. You can, of course, define this like:

           variable radtodeg [expr {180.0/(4.0*atan(1.0))}]

       and use the variable radtodeg whenever you need the conversion.

       This has two drawbacks:

             You need to remember the proper formula or value and that is error-prone.

             Especially  with  the  use  of mathematical functions like atan you assume that they have been
              accurately implemented. This is seldom or never the case and for each  platform  you  can  get
              subtle differences.

       Here is the way you can do it with the math::constants package:

           package require math::constants
           ::math::constants::constants radtodeg degtorad

       which creates two variables, radtodeg and (its reciprocal) degtorad in the calling namespace.

       Constants  that  have  been defined (their values are mostly taken from mathematical tables with more
       precision than usually can be handled) include:

             basic constants like pi, e, gamma (Euler's constant)

             derived values like ln(10) and sqrt(2)

             purely numerical values such as 1/3 that are included for convenience and for  the  fact  that
              certain seemingly trivial computations like:

                  set value [expr {3.0*$onethird}]

              give exactly the value you expect (if IEEE arithmetic is available).


PROCEDURES
       The package defines the following public procedures:

       ::math::constants::constants args
              Import the constants whose names are given as arguments


       ::math::constants::print-constants args
              Print the constants whose names are given as arguments on the screen (name, value and descrip-tion) description)
              tion) or, if no arguments are given, print all defined constants. This is mainly a convenience
              procedure.


BUGS, IDEAS, FEEDBACK
       This  document,  and  the  package  it  describes,  will undoubtedly contain bugs and other problems.
       Please report such in the category math ::  constants  of  the  Tcllib  SF  Trackers  [http://source-
       forge.net/tracker/?group_id=12883].   Please  also report any ideas for enhancements you may have for
       either package and/or documentation.

KEYWORDS
       constants, degrees, e, math, pi, radians

COPYRIGHT
       Copyright (c) 2004 Arjen Markus <arjenmarkus@users.sourceforge.net>




math                                                1.0.1                                 math::constants(n)

Reporting Problems

The way to report a problem with this manual page depends on the type of problem:

Content errors
Report errors in the content of this documentation to the Tcl project.
Bug reports
Report bugs in the functionality of the described tool or API to Apple through Bug Reporter and to the Tcl project through their bug reporting page.
Formatting problems
Report formatting mistakes in the online version of these pages with the feedback links below.

Did this document help you? Yes It's good, but... Not helpful...