Newsgroups: comp.lang.tcl
From: "Ihug" <p...@fastbase.co.nz>
Date: Wed, 20 Jul 2005 12:47:44 +1200
Local: Tues, Jul 19 2005 8:47 pm
Subject: Re: float2IEEE numbers - 64 bit?
I found my own solution by taking the original wiki script and maintaining
it myself for double precion: (there may be bugs!!!) proc ieee754 { value } { # If the following math fails, then it's because of the logarithm. That set fraction [expr {$fraction * 16.}] set fraction [expr {($fraction - $f1f) * 256.}] set fraction [expr {($fraction - $f2f) * 256.}] set fraction [expr {($fraction - $f3f) * 256.}] set fraction [expr {($fraction - $f4f) * 256.}] set fraction [expr {($fraction - $f5f) * 256.}] set fraction [expr {($fraction - $f6f) * 256.}] for {set i 1} {$i <= 7} {incr i} { set se1 [expr {($sign ? 128 : 0) | ($exponent >> 4)}] set bytes [binary format cccccccc $f7 $f6 $f5 $f4 $f3 $f2 $e2f1 $se1] return $bytes >I am trying to write IEEE 754 64 bit numbers.
> The following wiki page has a procedure "float2IEEE" that writes a 32 bit > number. > How would I modify this to output 64 bit? You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||