Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #69574

Re: routine for angles needed

From glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups comp.lang.c
Subject Re: routine for angles needed
Date 2015-09-06 05:31 +0000
Organization Aioe.org NNTP Server
Message-ID <msgj3f$apd$1@speranza.aioe.org> (permalink)
References (7 earlier) <6p40satg9dn658g1tojf6q6onnp65rvjj4@4ax.com> <mpr00v$1hn$1@speranza.aioe.org> <7oa3sapt6r9q23hicbp2tpafqg3rjl98do@4ax.com> <kfnr3mcww4j.fsf@x-alumni2.alumni.caltech.edu> <lntwr8v48u.fsf@kst-u.example.com>

Show all headers | View raw


Keith Thompson <kst-u@mib.org> wrote:
> Tim Rentsch <txr@alumni.caltech.edu> writes:
>> Robert Wessel <robertwessel2@yahoo.com> writes:
> [...]
>>> Ultimately any sort of decimal encoding has to be less efficient 
>>> than binary encoding, since you invariably end up with "invalid" bit
>>> patterns. [snip]

>> This isn't right.  Using a decimal base for floating point
>> is not inherently less bit efficient than a binary base.
>> Using a decimal base can be much less convenient than
>> using a binary base, but it is not inherently less bit
>> efficient.  In particular there needn't be any invalid
>> or duplicate bit patterns.

Bit efficient is a funny term in this context. You can represent
a specific number of real values with a given number of bits.
They can be spaced differently along the real line.
 
> As sometimes happens, I suspect you're talking about something
> subtle that I haven't thought of.
 
> The most obvious way to implement decimal floating-point on a
> binary machine is to use binary-coded decimal, with each decimal
> digit encoded as 4 bits.  This is obviously bit-inefficient, using
> only 10 of 16 possible bit patterns, effectively wasting about 17%
> of the bits.
 
> Another approach I've seen is to use 10 bits to store values from
> 0 to 1000, using 1000 of 1024 possible bit patterns, which is
> about 99.66% efficient.  I think IBM has proposed, and probably
> implemented, something like this.

Not only proposed, but it is in IEEE 754-2008.
 
> Are you thinking of a scheme that represents both the significand
> and the exponent in binary, but in which the exponent simply
> represents a power of 10?  Has any system ever used such a scheme?
> Or are you thinking of something else?

The 10 bits to store three digits form works pretty well for hardware
implementations. It is much less convenient to implement in software
on a machine that otherwise does binary arithmetic. Storing the
significand in binary allows for fairly efficient (in processing
time) software implementations. You do need to do some multiply
and divide by powers of 10 for pre/post normalization. 

As with the IEEE 754-2008 forms, some bits hold a mix of exponent
and significand bits for  good bit efficiency.

-- glen


 

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-02 10:17 -0700
  Re: routine for angles needed Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-02 10:38 -0700
    Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-02 11:10 -0700
      Re: routine for angles needed Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-02 11:26 -0700
        Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-02 11:41 -0700
          Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-02 12:02 -0700
  Re: routine for angles needed Bartc <bc@freeuk.com> - 2015-08-02 18:41 +0100
    Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-02 11:43 -0700
      Re: routine for angles needed Bartc <bc@freeuk.com> - 2015-08-02 20:00 +0100
        Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-02 12:04 -0700
          Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-02 12:10 -0700
            Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-02 12:24 -0700
              Re: routine for angles needed Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-02 12:32 -0700
                Re: routine for angles needed Bartc <bc@freeuk.com> - 2015-08-02 20:40 +0100
                Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-02 12:59 -0700
                Re: routine for angles needed Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-02 13:14 -0700
                Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-02 13:39 -0700
                Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-02 13:45 -0700
                Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-03 07:48 -0700
                Re: routine for angles needed Bartc <bc@freeuk.com> - 2015-08-03 17:06 +0100
                Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-03 09:09 -0700
                Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-03 09:17 -0700
                Re: routine for angles needed Bartc <bc@freeuk.com> - 2015-08-03 17:48 +0100
                Re: routine for angles needed Keith Thompson <kst-u@mib.org> - 2015-08-03 13:44 -0700
                Re: routine for angles needed Bartc <bc@freeuk.com> - 2015-08-03 23:51 +0100
                Re: routine for angles needed Keith Thompson <kst-u@mib.org> - 2015-08-03 18:30 -0700
                Re: routine for angles needed glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-03 23:11 +0000
                Re: routine for angles needed Bartc <bc@freeuk.com> - 2015-08-04 01:32 +0100
                Re: routine for angles needed glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-04 01:14 +0000
                Re: routine for angles needed Robert Wessel <robertwessel2@yahoo.com> - 2015-08-03 20:26 -0500
                Re: routine for angles needed glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-04 18:24 +0000
                Re: routine for angles needed Robert Wessel <robertwessel2@yahoo.com> - 2015-08-05 01:46 -0500
                Re: routine for angles needed glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-05 18:06 +0000
                Re: routine for angles needed Tim Rentsch <txr@alumni.caltech.edu> - 2015-09-05 11:37 -0700
                Re: routine for angles needed Keith Thompson <kst-u@mib.org> - 2015-09-05 16:24 -0700
                Re: routine for angles needed Richard Damon <Richard@Damon-Family.org> - 2015-09-05 21:01 -0400
                Re: routine for angles needed Robert Wessel <robertwessel2@yahoo.com> - 2015-09-05 23:30 -0500
                Re: routine for angles needed glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-09-06 05:37 +0000
                Re: routine for angles needed Robert Wessel <robertwessel2@yahoo.com> - 2015-09-07 00:27 -0500
                Re: routine for angles needed glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-09-06 05:31 +0000
                Re: routine for angles needed James Kuyper <jameskuyper@verizon.net> - 2015-09-06 11:57 -0400
                Re: routine for angles needed Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-06 17:44 +0100
                Re: routine for angles needed James Kuyper <jameskuyper@verizon.net> - 2015-09-06 14:02 -0400
                Re: routine for angles needed Robert Wessel <robertwessel2@yahoo.com> - 2015-09-07 00:31 -0500
                Re: routine for angles needed Keith Thompson <kst-u@mib.org> - 2015-09-06 11:59 -0700
                Re: routine for angles needed Tim Rentsch <txr@alumni.caltech.edu> - 2015-09-06 18:04 -0700
                Re: routine for angles needed Keith Thompson <kst-u@mib.org> - 2015-09-06 18:30 -0700
                Re: routine for angles needed Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-06 18:48 -0700
                Re: routine for angles needed Robert Wessel <robertwessel2@yahoo.com> - 2015-09-07 00:44 -0500
                Re: routine for angles needed Robert Wessel <robertwessel2@yahoo.com> - 2015-08-03 20:16 -0500
                Re: routine for angles needed glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-04 01:26 +0000
                Re: routine for angles needed Robert Wessel <robertwessel2@yahoo.com> - 2015-08-05 02:05 -0500
                Re: routine for angles needed Keith Thompson <kst-u@mib.org> - 2015-08-03 18:33 -0700
                Re: routine for angles needed glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-04 21:24 +0000
                Re: routine for angles needed Robert Wessel <robertwessel2@yahoo.com> - 2015-08-03 19:41 -0500
                Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-02 12:51 -0700
                Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-02 12:56 -0700
                Re: routine for angles needed Bartc <bc@freeuk.com> - 2015-08-02 20:57 +0100
                Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-02 13:06 -0700
                Re: routine for angles needed Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-02 22:25 +0100
                Re: routine for angles needed Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-02 22:27 +0100
                Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-02 14:40 -0700
  Re: routine for angles needed "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-08-02 19:08 -0700
    Re: routine for angles needed fir <profesor.fir@gmail.com> - 2015-08-03 02:18 -0700
  Re: routine for angles needed danncorbit@gmail.com - 2015-08-12 02:18 -0700
  Re: routine for angles needed bartekltg <bartekltg@gmail.com> - 2015-09-07 05:02 +0200

csiph-web