Re: 80 to 64-bit FP conversion

From: Yomi <yomi_at_roadrunner.com>
Date: Thu, 28 Jan 1999 15:15:50 PST

What I want to do is convert the precision of fractional real numbers from
80 bits to 64 bits, without rounding to an integer. The difference in
precision can be displayed as follows:

: F80>64 ( -- ) ( F: r -- r' )
  PAD DUP DF! DF@ ;

: .FDIFF ( -- ) ( F: r -- )
  FDUP F80>64 F- FS. ;

Here are some examples:

1.1E .FDIFF 1.331E-16
0.9E .FDIFF 8.897E-17
0.5E .FDIFF 0.000E+01
1E1 .FDIFF 0.000E+01

There seems to be no difference for any of the integer values, but perhaps
some differences occur with very large numbers. I just thought there
should be a more direct way than PAD DUP DF! DF@ to do the conversion for
fractional values.

Terry

----------
>
> Original sender: "Dennis Ruffer" <druffer_at_forth.com>
> Terry,
>
> This is where you need to use the FROUND options in the FpMath-Config
dialog
> box. If you do a FROUND on a calculated 80-bit number, you end up with
the
> same value as if you stored it into a DFVARIABLE (aka FVARIABLE) and
fetched
> it back again. At least that is how it's supposed to work. ;)
>
> DaR
>
> > -----Original Message-----
> > From: talk_at_forth.com [mailto:talk_at_forth.com]
> > Sent: Thursday, January 28, 1999 10:13 AM
> > To: Members of SF Talk
> > Subject: SFTALK: 80 to 64-bit FP conversion
> >
> >
> > Original sender: "Yomi" <yomi_at_roadrunner.com>
> > Is there a way to convert 80-bit FP numbers to 64-bit FP numbers
directly
> > on the FP hardware stack?
> >
> > I've been ordering FP numbers, and have been caught by precision
> > differences when comparing 80-bit calculated FP numbers to 64-bit
> > stored FP
> > numbers. My conversion fix is to store, then fetch, but it seems like
> > there should be a more direct way to do it.
> >
> > Terry Johnson
> > yomi_at_roadrunner.com
> >

.
Received on Thu Jan 28 1999 - 15:15:50 PST


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 08-Feb-2012. Archive updated nightly.