TERRA Datentechnik,  Technical Support Sheet
=========================================================================

TZ-920413.2/Bj
Logitech Modula-2 4.0
Standard Library

Subject: Library Module "DurationOps" works not correctly.
         Due to new (Short)-REAL type.
-------------------------------------------------------------

Related modules: "Calendar and "Chronometer"

The library module "DurationOps" uses internally 8 Byte REAL-
numbers for computations on duration units. The module
was originally developed for use with 8 Byte (Double
precision) REAL-Numbers. Since in Modula-2 V4 the
standard type REAL corresponds to a 4 Byte REAL with an
accuracy of about 7 decimal digits some results calculated
in the module will lead to a REAL-overflow which is
not detected by the system. The only effect is that
the module delivers wrong results.

Possible workarounds:

- Use LONGREAL-Types instead of REAL-Types in the definition
  and implementation part of "DurationOps".
  Plus : Easy to apply.
  Minus: You have to change the definition module.

- Use LONREAL-Types instead of REAL-Types only for the
  critical parts in the implementation module. This is possible
  since the exported types are sufficent to hold all expected
  values.
  Plus : You can maintain the compatibility to the standard
         library.
  Minus: You have to write REAL to LONGREAL conversion routines
         and vice versa.

- Call TERRA for new modules for 'Calendar' and 'Chronometer' which
  do not import 'DurationOps' and not use REAL-arithmetic. See
  the notes below.


IT MAY BE THAT THERE ARE FURTHER MODULES WITH THE SAME ERROR, I.E.,
ALL MODULES USING REAL NUMBERS THAT CAME FROM V3.4 MAY SHOW THIS
BEHAVIOUR.



Notes on Modules: "CalendaTerra" and "ChronoTerra"
--------------------------------------------------

The modules "CalendaTerra" and "ChronoTerra" may serve as a replacement
for the modules "Calendar" and "Chronometer" of the Logitech/MultiScope
Modula-2 standard library. The main difference is that the new modules
use LONGINT instead of REAL arithmetic, and do not use module "Duration-
Ops" of the standard library anymore. The duration type provided by
"DurationOps" has been replaced by a new and simpler duration type
provided by module "Calendar".

Due to these differences, the new modules are simpler, smaller, and
faster, in particular if there is no 80x87 coprocessor. They may save
up to about 4.5 KB of memory.

The definition module "ChronoTerra" is almost identical to "Chronometer",
except that certain specifications have been corrected, and some
parameters which are not needed anymore have been removed. Also, the
duration type is imported from "CalendaTerra" instead of "DurationOps".

Module "CalendaTerra" basically provides the same features as "Calendar"
and "DurationOps". Because a simpler duration type (days and milliseconds)
is used, the duration formatting features of "DurationOps" have been left
away. Also, the new "Precision" type is simpler than the equivalent "Unit"
type provided by "DurationOps". The procedure names have been unified
and simplified, and the order of the parameters has been unified, too.
For any procedure performing an arithmetic or comparision operation with
two operands a call "Operation (x1, x2)" corresponds to the notation
"x1 operator x2". There is one case where this requires the parameters
to be exchanged when converting code that uses "Calendar" to code using
"CalendaTerra": "Calendar.LaterOrSameDate (x, y, p)" must be mapped to
"CalendaTerra.LaterEqualDate (y, x, p)".

If you intend to use the new modules, you may also want to adapt and
recompile the modules "DateFormat" (definition and implementation module)
and "Random" of the standard library, such that they import type "Date"
from "CalendaTerra" instead of "Calendar".

Notes:

 -  "Calendar and "Chronometer" are the only standard library modules
    importing "DurationOps".

 -  "Chronometer", "DateFormat" and "Random" are the only standard
    library modules importing "Calendar".

 -  "Chronometer" is not imported by any other standard library module.

                             * * *
