Point Notation: Difference between revisions

From NARS2000
Jump to navigationJump to search
No edit summary
Line 132: Line 132:
== Variable-Precision Floating Point Notation ==
== Variable-Precision Floating Point Notation ==


This notation allows you to enter '''Decimal''' and '''Exponential''' point values as variable-precision floating point numbers.  For example, <apll>2.3<pn>v</pn></apll> or <apll>2E¯3<pn>v</pn></apll>.
This notation allows you to enter '''Decimal''' and '''Exponential''' point values as variable-precision floating point numbers.  For example, <apll>2.3<pn>v</pn></apll> or <apll>2<pn>E</pn>¯3<pn>v</pn></apll>.


In this form, the bits of precision of the number is specified by the value of <apll>⎕FPC</apll> at the time the number is fixed.  Alternatively, the suffix <apll><pn>v</pn></apll> may be followed by an unsigned integer (<apll>≥53</apll>) to specify the number of bits of precision of the number, overriding the value of <apll>⎕FPC</apll>.  For example <apll>2.3<pn>v</pn>64</apll> is a shorthand for <apll>2.3</apll> as a VFP number with <apll>64</apll> bits of precision.
In this form, the bits of precision of the number is specified by the value of <apll>⎕FPC</apll> at the time the number is fixed.  Alternatively, the suffix <apll><pn>v</pn></apll> may be followed by an unsigned integer (<apll>≥53</apll>) to specify the number of bits of precision of the number, overriding the value of <apll>⎕FPC</apll>.  For example <apll>2.3<pn>v</pn>64</apll> is a shorthand for <apll>2.3</apll> as a VFP number with <apll>64</apll> bits of precision.

Revision as of 20:49, 29 July 2018

Overview

Base Point Notation: e.g., 16b10FFFFas a shorthand for 16⊥1 0 15 15 15 15 15.
Euler Point Notation: e.g., 2x3 as a shorthand for 2∙e3 or 2×(*1)*3.
Pi Point Notation: e.g., 2p3 as a shorthand for 2∙π3 or 2×(○1)*3.
Gamma Point Notation: e.g., 2g3 as a shorthand for 2∙γ3 where γ is the Euler-Mascheroni Constant.
Hypercomplex Point Notation: e.g., 2J3 or 2i3 as a shorthand for 2+3×√¯1, or 2ad3 (Angle in Degrees), 2ar3 (Angle in Radians), or 2au3 (Angle in Unit Normalized) all for Complex numbers, or 1i2j3k4 for a Quaternion number, or 1i2j3k4l5ij6jk7kl8 for an Octonion number.
Ball Arithmetic Point Notation: e.g., 2.3±1E¯9 to indicate a Ball with a Midpoint of 2.3 and a Radius of 1E¯9. Also, 2.3± is a shorthand for 2.3±0.
Rational Point Notation: e.g., 2r3 as a shorthand for 2÷3 as an infinite precision rational number, or 123x as a means of representing 123 as an infinite precision integer — the suffix x is actually a shorthand for r1, that is, infinite precision integers are actually represented as rational numbers with a denominator of 1.
Variable-Precision Floating Point Notation: e.g., 2.3v as a shorthand for 2.3 as a variable-precision floating point number, or 123v as a means of representing 123 as a VFP number whose fractional part is zero.
Exponential Point Notation: e.g., 2e3 or 2E3 as a shorthand for 2∙103 or 2×10*3.
Decimal Point Notation: e.g., 2.5 as a shorthand for or 2+5÷10.
Base, Euler, Pi, Gamma, and Rational Point Notations are extensions to the familiar Decimal Point Notation as well as Exponential Point or Scientific Notation methods of entering numeric constants. Thanks to the designers of J for these clever ideas.


Base Point Notation

This notation makes it easy to enter numeric constants in an arbitrary base.

The number to the left of the b is the base of the number system for the characters to the right of the b. The base may be represented in several ways including integers, Exponential, Decimal, Euler, Pi, Gamma, Hypercomplex, Rational, and Variable Precision Floating Point Notation, but not Base Point Notation.

For example, 1e3b111 is the same as 1000b111.

Note that the base may also be negative as in ¯1b0z, fractional as in 0.1b1234, or Hypercomplex as in 0J1b321.

The characters to the right of the b may range from 0-9 or a-z where the latter range is a way of representing numbers from 10-35 in a single character. The uppercase letters (A-Z) have the same values as the corresponding lowercase case letters and may be used instead of or intermixed with them.

For example, 10bzzZz is the same as 10⊥35 35 35 35, and 1r2b111 is the same as 0.5b111 except for precision — the former is Multiple-Precision and the latter is Fixed.

A decimal point may appear anywhere in the characters to the right of the b to indicate that the characters to its right represent the fractional part of the number in the given base.

For example, 2b111.111 is (6⍴1)+.×2*2..¯3 which is 7.875.

Euler Point Notation

This notation allows you to enter numeric constants that are in the form of the product of a multiplier and e (≅ 2.718281828459045... — base of the natural logarithms) raised to an exponent, that is, MeE or M×(*1)*E. The numbers to the left (multiplier) and right (exponent) of the x may be represented in several ways including integers, Decimal, Exponential, Hypercomplex, Rational, or Variable Precision Floating Point Notation, but not Base, Euler, Pi, or Gamma Point Notation.

For example, 1e2x1.1 is the same as 100x1.1, and 1r2x1.1e2 is the same as 0.5x110.

Both the multiplier and exponent may be negative and/or fractional as in ¯1e2x¯3.3.

Pi Point Notation

This notation allows you to enter numeric constants that are in the form of the product of a multiplier and π (≅ 3.141592653589793... — ratio of a circle's circumference and diameter) raised to an exponent, that is, E or M×(○1)*E. The numbers to the left (multiplier) and right (exponent) of the p may be represented in several ways including integers, Decimal, Exponential, Hypercomplex, Rational, or Variable Precision Floating Point Notation, but not Base, Euler, Pi, or Gamma Point Notation.

For example, 1e2p1.1 is the same as 100p1.1, and 1r2p1.1e2 is the same as 0.5p110.

Both the multiplier and exponent may be negative and/or fractional as in ¯1e2p¯3.3.

Gamma Point Notation

This notation allows you to enter numeric constants that are in the form of the product of a multiplier and γ (≅ 0.5772156649015329... — limiting difference between the harmonic series and the natural logarithm) raised to an exponent, that is, E or M×γ*E. The numbers to the left (multiplier) and right (exponent) of the g may be represented in several ways including integers, Decimal, Exponential, Rational, or Variable Precision Floating Point Notation, but not Base, Euler, Pi, or Gamma Point Notation.

For example, 1e2g1.1 is the same as 100g1.1, and 1r2g1.1e2 is the same as 0.5g110.

Both the multiplier and exponent may be negative and/or fractional as in ¯1e2g¯3.3.

Hypercomplex Point Notation

This notation allows you to enter Complex, Quaternion, and Octonion numbers in various forms such as a combination of a Real part followed by one or more Hypercomplex units (2nd, 4th, or 8th root of ¯1) times the corresponding coefficient. For more details, see Hypercomplex Notation in APL.

Ball Arithmetic Point Notation

This notation allows you to enter Ball Arithmetic point values. A Ball consists of a Midpoint and a Radius. The two values are separated by a plus-or-minus sign (±) as in 2.3±1E¯9. If the Radius is zero, it may be omitted.

Ball Arithmetic numbers may also be used as a lefthand part of Base, and any part of Euler, Pi, Gamma, or Hypercomplex Point Notations. For more information, see Ball Arithmetic.

Rational Point Notation

This notation allows you to enter fractions as rational numbers and have them be retained as rational numbers. Rational numbers (using the r infix separator only, not the x suffix) may also be used as a lefthand part of Base, and either part of Euler, Pi, or Gamma Point Notations. For more information, see Rational Numbers. This notation also accepts strings that contain Decimal and/or Exponential point notation such as 0.5x, 0.5r3, 1E¯3r1.5, etc. and represents them as a Rational number.

Variable-Precision Floating Point Notation

This notation allows you to enter Decimal and Exponential point values as variable-precision floating point numbers. For example, 2.3v or 2E¯3v.

In this form, the bits of precision of the number is specified by the value of ⎕FPC at the time the number is fixed. Alternatively, the suffix v may be followed by an unsigned integer (≥53) to specify the number of bits of precision of the number, overriding the value of ⎕FPC. For example 2.3v64 is a shorthand for 2.3 as a VFP number with 64 bits of precision.

VFP numbers (using the v suffix) may also be used as a lefthand part of Base, and either part of Euler, Pi, or Gamma Point Notations. For more information, see Variable-precision Floating Point (VFP) Numbers.

Exponential Point Notation

This familiar notation (sometimes called scientific notation) allows you to enter numeric constants that are in the form of the product of a multiplier and a (possibly negative) power of 10. Exponential numbers (using either the e or E infix separator) may also be used as a lefthand par of Base, and either part of Euler, Pi, or Gamma, Hypercomplex Point Notations.

For example, ¯1.1e2 is the same as ¯110.0, and 1.1E¯6 is the same as 0.0000011.

Decimal Point Notation

This basic notation allows you to enter a decimal value with an integer part and fractional part separated by a period (.) as in 2.3.

Mixed Notation

The above notations may be combined in a single Point Notation String with the restrictions discussed above, a summary of which follows:

  • The right part of Base Point Notation may not contain any of the above Point Notations except for Decimal.
  • The left part of Base Point Notation may contain any of the above Point Notations except itself.
  • Decimal, Exponential, Rational, Variable Precision, Ball, and Hypercomplex Point Notations may appear in either or both parts of Euler, Pi, or Gamma Point Notations.
  • No two of Euler, Pi, or Gamma Point Notations may appear in the same Point Notation String.

In terms of Binding Strength, the Notation with the highest binding strength is Decimal. That is, Decimal Point Notation numbers are constructed first. From highest to lowest binding strength, the sequence is as follows:

  • 7. Decimal
  • 6. Exponential
  • 5. Rational, Variable Precision Floating Point
  • 4. Ball Arithmetic
  • 3. Hypercomplex
  • 2. Euler, Pi, Gamma
  • 1. Base

Notations with the same binding strength may not be mixed (e.g., 1r2v is an error). Otherwise, any notation may incorporate notations with a higher binding strength but may not incorporate notations with an equal or lower binding strength.

This latter case need not signal an error, but instead it might produce a different interpretation. For example,

1r2p1J3 is interpreted as 1r2×(○1x)*1J3 not as 1r2p1+0J3 because Rational and Hypercomplex Point Notations are constructed before Pi Point Notation is.

NARS 2000 Lang
Tool
Bar
+ - × ÷ * ! ? |
< = >
~ § π .. ,
/ \ ¨ .
_ ¯
Second Row i j k i j k l g p r v x