math::machineparameters(3tcl) | tclrep | math::machineparameters(3tcl) |
math::machineparameters - Compute double precision machine parameters.
package require Tcl 8.4
package require snit
package require math::machineparameters 0.1
machineparameters create objectname ?options...?
objectname configure ?options...?
objectname cget opt
objectname destroy
objectname compute
objectname get key
objectname tostring
objectname print
The math::machineparameters package is the Tcl equivalent of the DLAMCH LAPACK function. In floating point systems, a floating point number is represented by
x = +/- d1 d2 ... dt basis^e
0 <= di <= basis - 1, i = 1, t
The compute method computes all machine parameters. Then, the get method can be used to get each parameter. The print method prints a report on standard output.
In the following example, one compute the parameters of a desktop under Linux with the following Tcl 8.4.19 properties :
% parray tcl_platform tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i686 tcl_platform(os) = Linux tcl_platform(osVersion) = 2.6.24-19-generic tcl_platform(platform) = unix tcl_platform(tip,268) = 1 tcl_platform(tip,280) = 1 tcl_platform(user) = <username> tcl_platform(wordSize) = 4
set pp [machineparameters create %AUTO%] $pp compute $pp print $pp destroy
Machine parameters Epsilon : 1.11022302463e-16 Beta : 2 Rounding : proper Mantissa : 53 Maximum exponent : 1024 Minimum exponent : -1021 Overflow threshold : 8.98846567431e+307 Underflow threshold : 2.22507385851e-308
Epsilon = 1.11022302462515654E-016 Safe minimum = 2.22507385850720138E-308 Base = 2.0000000000000000 Precision = 2.22044604925031308E-016 Number of digits in mantissa = 53.000000000000000 Rounding mode = 1.00000000000000000 Minimum exponent = -1021.0000000000000 Underflow threshold = 2.22507385850720138E-308 Largest exponent = 1024.0000000000000 Overflow threshold = 1.79769313486231571E+308 Reciprocal of safe minimum = 4.49423283715578977E+307
set pp [machineparameters create %AUTO%] $pp compute set eps [$pp get -epsilon] $pp destroy
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category math of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please also report any ideas for enhancements you may have for either package and/or documentation.
When proposing code changes, please provide unified diffs, i.e the output of diff -u.
Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.
Copyright (c) 2008 Michael Baudin <michael.baudin@sourceforge.net>
1.0 | tcllib |