Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Oct 2001 16:59:26 -0400
From:      The Anarcat <anarcat@anarcat.dyndns.org>
To:        Libh <freebsd-libh@freebsd.org>
Subject:   tcl integer limitations
Message-ID:  <20011023165922.F526@shall.anarcat.dyndns.org>

next in thread | raw e-mail | index | archive | help

--Pql/uPZNXIm1JCle
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi.

I'm working on making it possible to change the size units in the label
editor and the fdisk editor.

Inevitably, I must use bytes instead of sectors to represent the sizes.

The problem is that this overflows tcl's default integer type (long):

anarcat@shall[~/libh/release/diskedit]% bc=20
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.=20
60030432 * 512
30735581184
anarcat@shall[~/libh/release/diskedit]% tclsh8.3
% expr 60030432 * 512
670810112
% expr 30735581184
integer value too large to represent

I guess the proper solution is to use a floating points, but that seems
evil to me...

Unless anyone has a better idea, i'll use floating point. Or at least
try. ;)

A.

--Pql/uPZNXIm1JCle
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjvV2ikACgkQttcWHAnWiGeNcwCcDDN/Cz2NDv35wRLEIaervR6Z
fA0An1fLcGeB8YH1EPO8q5RTAtUBGVq9
=/h5o
-----END PGP SIGNATURE-----

--Pql/uPZNXIm1JCle--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-libh" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011023165922.F526>