Copyright (C) 1994, Digital Equipment Corp.
INTERFACEDragonT ; IMPORT Ctypes; TYPE CutoffMode = {normal, absolute, relative}; Digit = [0 .. 9]; PROCEDURE F (e : INTEGER; f1, f0 : INTEGER; p : INTEGER; cutoffMode : CutoffMode; cutoffPlace : INTEGER; VAR(*OUT*) digits : ARRAY OF Digit; VAR(*OUT*) count : CARDINAL; VAR(*OUT*) exp : INTEGER);
Implements the Dragon algorithm to print floating-point numbers.
The 64 mantissa bits are ((f1 & 16_ffffffff) << 32) + (f0 & 16_ffffffff)
<*EXTERNAL strtod*>
PROCEDURE strtod (nptr: Ctypes.char_star;
eptr: Ctypes.char_star_star): LONGREAL;
END DragonT.
The Dragon algorithm is described in:
"How to Print Floating-Point Numbers Accurately",
Guy L. Steele Jr. and Jon L. White,
Proceedings of the ACM Sigplan'90 conference on Programming
Language Design and Implementation,
pp 112-126.