tcl8.5: large float-value to very wide int ?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

tcl8.5: large float-value to very wide int ?

From: Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at>
Date: Sat Dec 10 2005 - 15:51:23 CET

I'm currently playing around with large numbers
(about 100 digits long), and I'd need an approximation
to the square-root. That would mean, I'd need the
largest number, whose square is lower-or-equal to the
given number.

set n 123456789......(lotsa digits).....0123456789
expr {sqrt($n)} -> 1.1111111061111111e+49

converting this to wide or int, gives me utter garbage
(something modulo 2**64 or 2**32)

In my case, I'd even be satisfied with something like:
 111111110611111110000000000000000000...0000
thus, a large integer in "some" vicinity of
sqrt($n), but I don't even get that :-(

Of course,
  11111111061111110993611110581861108108154842000984
(obtained with "bc") would be the ultimate goal.
Received on Sun Dec 11 13:54:51 2005