music

# arithmetic functions

## summary

This subchapter looks at arithmetic functions.

## free computer programming text book project

If you like the idea of this project,

### 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.

# arithmetic functions

This subchapter looks at arithmetic functions.

“42.1/2 The predefined standard library packages provide facilities such as string manipulation, containers of various kinds (vectors, lists, maps, etc.), mathematical functions, random number generation, and access to the execution environment.” —:Ada-Europe’s Ada Reference Manual: Introduction: Language Summary See legal information

“2 Finally, a predefined environment of standard packages is provided, including facilities for, among others, input-output, string manipulation, numeric elementary functions, and random number generation.” —:Ada-Europe’s Ada Reference Manual: Section 1: General See legal information

The absolute value of a real number is defined as the square root of the square of the number.

ALGOL    abs(E) — ALGOL-60 library function that returns the absolute value of an expression.
APL    |(x) — APL monadic function that returns the absolute value of a scalar, vector, or matrix. Form is |B.
BASIC    ABS(x) — BASIC library function that returns the absolute value of an expression. Some BASIC interpreters only allow the expression x to be a variable name or a numeric literal. Many BASIC interpreters allow the use of ABS within any arithmetic expression.
JOVIAL    ABS(x) — JOVIAL function that returns the absolute value of a numeric data type.
LISP    ABS(x) — LISP function that takes one argument of type number and returns the absolute value.
Pascal    abs(x) — Pascal standard function that returns the absolute value of an argument x.
PL/I    ABS — Pl/I built-in function that returns the absolute value of a variable or expression.
PostScript    abs(x) — PosScript arithmetic operator that places on the top of the stack the absolute value of the number previously on the top of stack. Returns the same numeric type unless the number is the most negative integer, in which case it returns a real.

ALGOL    sign(E) — ALGOL-60 library function that returns the sign (plus + or minus -) of an expression.
BASIC    SGN(x) — BASIC library function that returns the sign of an expression. The result of negative one (-1) indicates a negative number. The result of zero (0) indicates zero. The result of positive one (1) indicates a positive number. nbsp; SGN(x) — JOVIAL function that returns the sign of a numeric data type. The results are +1 for positive, 0 for zero, and -1 for negative.

Pascal    odd(x) — Pascal standard function that returns true if an argument x is odd; otherise returns false (x must be INTEGER)..

ALGOL    sqrt(E) — ALGOL-60 library function that returns the square root of an expression.
Pascal    sqrt(x) — Pascal standard function that returns the REAL square root of an argument x.

Pascal    sqr(x) — Pascal standard function that returns the square of an argument x..

BASIC    RND — BASIC library function that returns a random number. The random number is between zero (0) and one (1). You can muliply by a larger number and then round or truncate to an integer to obtain an integer range (such as for a roll of dice). The official ANSI tsandard calls for RND to be used alone, but most BASIC compilers use the form of RND(n), where n has a compiler specific meaning. The ANSI standard calls for the sequence of random numbers to always be exactly the same on each run of a program (for debugging purposes) unless the BASIC command word RANDOMIZE is used..

## 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.

1.1.5 Built-In Functions

The JOVIAL built-in functions provide advanced, specialized
operations that are not covered by the JOVIAL operators.

ABS(x)         Absolute value of x
SGN(x)         +1, 0, or -1 for x>0, x=0, x<0

Chapter 1 Introduction, page 9

# 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).

## view text bookHTML 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
 Tweets by @osdata

## 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,

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)

Some or all of the material on this web page appears in the

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

†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.