NAME

Language::MuldisD::Ext::Num - Muldis D extension for numeric data types and operators

VERSION

This document is Language::MuldisD::Ext::Num version 0.4.0.

PREFACE

This document is part of the Muldis D language specification, whose root document is Language::MuldisD; you should read that root document before you read this one, which provides subservient details.

DESCRIPTION

Muldis D has a mandatory core set of system-defined (eternally available) entities, which is referred to as the Muldis D core or the core; they are the minimal entities that all Muldis D implementations need to provide; they are mutually self-describing and are used to bootstrap the language; any entities outside the core, called Muldis D extensions, are non-mandatory and are defined in terms of the core or each other, but the reverse isn't true.

This current Num document describes the system-defined Muldis D Num Extension, which consists of non-integer numeric data types and operators, particularly rational and floating-point numbers.

This current document does not describe the polymorphic operators that all types, or some types including core types, have defined over them; said operators are defined once for all types in Language::MuldisD::Core.

This documentation is pending.

TYPE SUMMARY

Following are all the data types described in this document, arranged in a type graph according to their proper sub|supertype relationships (but that the first 4 just reappear from the core set to provide a similar context, and aren't re-described here):

sys.type.Universal

    sys.type.Empty

    sys.type.Scalar
        sys.type.Ordinal

            # The following are all regular ordinal scalar types.

            sys.type.Num.Rat
                sys.type.Num.RatI
                sys.type.Num.RatB
                sys.type.Num.RatD
            sys.type.Num.FloatB32
            sys.type.Num.FloatB64

This documentation is pending.

SYSTEM-DEFINED NUMERIC SCALAR DATA TYPES

These non-core scalar data types describe common kinds of numbers that are not specifically limited to having integer values. While integers are part of the Muldis D core, other kinds of simple numbers are not, for various reasons, and are represented under this "Numeric" type group instead. As is usual with the Muldis D type system, the types mentioned below are all mutually exclusive aside from explicit subtype relationships. Of course, dealing with these types in general isn't a perfect science; they stand to be revised or rewritten.

sys.type.Num.Rat

A Num.Rat is a single rational exact real number of any magnitude. It is conceptually an Int (numerator) divided by a PInt (denominator). Its default value is zero; its minimum and maximum values are conceptually infinities and practically impossible. The cardinality of this type is infinity; to define a most-generalized finite Num.Rat subtype, you must specify the greatest magnitude positive integer denominator that its values have, plus the the 2 integer end-points of the inclusive range of the numerator that all its values have. Common subtypes specify maximum denominators that are powers of either 2 or 10.

sys.type.Num.RatI

A Num.RatI (rational: integer) is a proper subtype of Num.Rat where the denominator is 1; every value of this type maps to exactly 1 Int value and vice-versa, so it is conceptually like an integer, without being disjoint to Num.Rat.

sys.type.Num.RatB

A Num.RatB (rational: binary) is a proper subtype of Num.Rat where the denominator is a power of 2; it is the best option to exactly represent non-integers that are conceptually binary or octal or hexadecimal.

sys.type.Num.RatD

A Num.RatD (rational: decimal) is a proper subtype of Num.Rat where the denominator is a power of 10; it is the best option to exactly represent non-integers that are conceptually the decimal numbers that lay-people work with.

sys.type.Num.FloatB32

A Num.FloatB32 implements a 32-bit binary floating-point numeric as specified in IEEE 754, having 1 bit for sign, 8 bits for exponent, and 23 bits for mantissa. As per the standard, most of its values are ordinary real numbers, but it has distinct representations for +/- zero, +/- infinity, and various kinds of NaNs. Its default value is positive zero; its minimum and maximum values are, respectively, negative and positive infinity. The cardinality of this type is approximately 2**32.

sys.type.Num.FloatB64

A Num.FloatB64 is the same as Num.FloatB32 but for its precision; it has 1 bit for sign, 11 bits for exponent, and 52 bits for mantissa. The cardinality of this type is approximately 2**64.

TODO: Maybe add types like FloatB128, fuzzy or interval numbers, complex numbers, and so on.

SEE ALSO

Go to Language::MuldisD for the majority of distribution-internal references, and Language::MuldisD::SeeAlso for the majority of distribution-external references.

AUTHOR

Darren Duncan (perl@DarrenDuncan.net)

LICENSE AND COPYRIGHT

This file is part of the formal specification of the Muldis D language.

Muldis D is Copyright © 2002-2007, Darren Duncan.

See the LICENSE AND COPYRIGHT of Language::MuldisD for details.

ACKNOWLEDGEMENTS

The ACKNOWLEDGEMENTS in Language::MuldisD apply to this file too.