Mailinglist Archive: opensuse (3337 mails)

< Previous Next >
Re: [SLE] Real Numbers representation in Tcl language
  • From: Roger Oberholtzer <roger@xxxxxx>
  • Date: Wed, 12 Apr 2006 21:45:15 +0200
  • Message-id: <1144871115.7510.12.camel@xxxxxxxxxxxxx>
On Wed, 2006-04-12 at 14:54 -0400, Jerry Feldman wrote:
> On Wednesday 12 April 2006 10:53 am, Roger Oberholtzer wrote:
> > Tcl simply uses the underlying machine's representation. No funny stuff.
> > An integer is 32 bits.
> But, Maura is talking floating point, and double precision floating point
> numbers in C are 64-bit on 32-bit and 64-bit platforms.

Tcl has only one floating point storage format. It is the C double. So,
whatever your C compiler does to store a double is what you will get in
Tcl. Nothing more or less.

When converting doubles to strings, tcl by default will provide 12
decimal places. This can be changed via the tcl_precision setting.

> int is always 32-bit on 32-bit and 64-bit systems, and long is 32-bits on
> 32-bit systems and 64-bits on 64-bit systems.

AFAIK, Tcl only runs on 32-bit or 64-bit machines. And, on these, Tcl
acts as stared above for floating point representation. Tcl does not
have a concept of 'type' in the script environment. Internally, it
determines the best binary storage for a value based on how it parses
variable assignment.

> --
> Jerry Feldman <gaf@xxxxxxx>
> Boston Linux and Unix user group
> http://www.blu.org PGP key id:C5061EA9
> PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
>


< Previous Next >