music
OSdata.com: programming text book 

OSdata.com

fixed point numbers

summary

    Representing fixed point numbers in a computer.

free computer programming text book project

table of contents
If you like the idea of this project,
then please donate some money.
more information on donating

Google

stub section

    This subchapter is a stub section. It will be filled in with instructional material later. For now it serves the purpose of a place holder for the order of instruction.

    Professors are invited to give feedback on both the proposed contents and the propsed order of this text book. Send commentary to Milo, PO Box 1361, Tustin, California, 92781, USA.

JOVIAL

    The following material is from the unclassified Computer Programming Manual for the JOVIAL (J73) Language, RADC-TR-81-143, Final Technical Report of June 1981.


    The kinds of values provided by JOVIAL reflect the applications
    of the language; they are oriented toward engineering and contrl
    programming rather than, for example, commercial and business
    programming.  The JOVIAL values are:
    3.  Fixed values, which are numbers with constant scale
        factors.  They are sometimes used for physical
        quantities (primarily to save time and/or storage) when
        the range of the value is narrow and predictable.  For
        example, fixed values might be used in a computation
        that had to run on a computer for which floating-point
        hardware was not available or was too slow.

    Chapter 1 INTRODUCTION, page 2

         ITEM ANGLE A 2,13;    A fixed item, whose value is stored
                               with fixed scaling, namely two bits to
                               the left of the binary point and
                               thirteen fractional bits.  Thus it
                               accomodate a value in the range -4 <
                               value < +4 to a precision of
                               1/(2**14).

    Chapter 1 INTRODUCTION, page 4

fixed point numbers

    Representing fixed point numbers in a computer.

PL/I

    Fixed Decimal declarations:

    type of data: coded arithmetic (Binary Coded Decimal, packed two decimal digits to a single 8-bit byte)

    S/360, S/370 data format: packed decimal

    default precision: five (5) decimal digits

    maximum precision: 15 decimal digits

    example:

    DECLARE DOLLAR_AMOUNT FIXED DECIMAL (9,2) INIT (100.00);

    First number in declaration is the total number of stored digits. Second number in declaration (optional) is the number of digits to the right of an implied decimal point. If the second number is zero or left out, then the number is an integer.

    Fixed decimal is more efficient if the precision is declared as an odd number of digits (because of extra code generated to guarantee that the last half of an even number of decimal digits remains zero). Numbers too large to fit into the specified storage will be truncated. Numbers too small to fill the entire storage space will be zero-filled.

    Fixed Binary declarations:

    type of data: coded arithmetic (binary )

    S/360, S/370 data format: fixed point

    default precision: 16 bits

    maximum precision: 31 bits

    example:

    DECLARE LOCAL_DISTANCE FIXED BINARY (31,16) INIT (256.5);

    First number in declaration is the total number of stored bits. Second number in declaration (optional) is the number of bits to the right of an implied “decimal” point. If the second number is zero or left out, then the number is an integer.

    Generally the fastest execution time for arithmetic. Sizes 16 bits or fewer are stored in two bytes. Sizes 17-31 bits are stored in four bytes.

    Undeclared variables starting with the letters I through N, inclusive, default to FIXED BINARY (15).

    Many decimal fractions have no exact binary equivalent, which may result in a small rounding error.

Ada

    “31 Every object in the language has a type, which characterizes a set of values and a set of applicable operations. The main classes of types are elementary types (comprising enumeration, numeric, and access types) and composite types (including array and record types).” —:Ada-Europe’s Ada Reference Manual: Introduction: Language Summary See legal information

    “33 Numeric types provide a means of performing exact or approximate numerical computations. Exact computations use integer types, which denote sets of consecutive integers. Approximate computations use either fixed point types, with absolute bounds on the error, or floating point types, with relative bounds on the error. The numeric types Integer, Float, and Duration are predefined.” —:Ada-Europe’s Ada Reference Manual: Introduction: Language Summary See legal information


free music player coding example

    Coding example: I am making heavily documented and explained open source code for a method to play music for free — almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).

    View music player in action: www.musicinpublic.com/.

    Create your own copy from the original source code/ (presented for learning programming).


return to table of contents
free downloadable college text book

view text book
HTML file

Because I no longer have the computer and software to make PDFs, the book is available as an HTML file, which you can convert into a PDF.

previous page next page
previous page next page

free computer programming text book project

Building a free downloadable text book on computer programming for university, college, community college, and high school classes in computer programming.

If you like the idea of this project,
then please donate some money.

send donations to:
Milo
PO Box 1361
Tustin, California 92781

Supporting the entire project:

    If you have a business or organization that can support the entire cost of this project, please contact Pr Ntr Kmt (my church)

more information on donating

Some or all of the material on this web page appears in the
free downloadable college text book on computer programming.


Google


Made with Macintosh

    This web site handcrafted on Macintosh computers using Tom Bender’s Tex-Edit Plus and served using FreeBSD .

Viewable With Any Browser


    †UNIX used as a generic term unless specifically used as a trademark (such as in the phrase “UNIX certified”). UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Ltd.

    Names and logos of various OSs are trademarks of their respective owners.

    Copyright © 2010, 2012 Milo

    Created: October 31, 2010

    Last Updated: September 20, 2012


return to table of contents
free downloadable college text book

previous page next page
previous page next page