Archive: forth/pfe/qfloating

Up to parent directory


The qfloating module is located in the dnw branch of Guido Draheim's PFE site at SourceForge. It implements an optional Quad Floating-Point Word Set. With a few natural exceptions, there is a quad word with Q prefixed to the name for each word in the updated floating module. To see the scope of both modules, look at the synonyms in the file qfsynos.fs, which can be used for testing quad float words with existing floating-point tests.

The code uses libquadmath, which is part of gcc. As far as we know, the only official way to install the library is as part of a gcc installation. The dnw branch ./configure step finds both the library and its include file on our macos and linux systems, but the paths are not readily visible. Here's the current version of the include file at GitHub: quadmath.h. And here's the API documentation: GCC libquadmath.

The floating point encoding corresponds to the IEEE 754-2008 binary128 format, which has a storage width of 128 bits, a significand precision p of 113 bits, including an implicit leading bit, a maximum exponent emax of 16,383, and a minimum exponent emin of -16,382. We call these quad floats, or simply quads. Like the binary32 single float and binary64 double float formats, there are no gaps in the binary representation of quad floats. Double floats are the PFE default.

Separate qfloat stack

The floating and qfloating modules are independent of each other, with one exception to be mentioned shortly, and can be loaded individually or simultaneously. The qfloat stack is separate from both the float and data stacks.

Floating-point syntax

The syntax for floating-point data in text input and output is identical for the two modules, but with independent input conversion and output print precision.

The traditional PFE outer interpreter has one slot for floating-point interpretation, which can hold a null pointer for no interpretation, a pointer to the double-float interpreter for a separate floating-point stack, or a pointer to a double-float interpreter for an integrated stack, implemented in Krishna Myneni's fpnostack module. The quad-float interpreter uses the same slot.

Switching the pointers between the double-float and quad-float interpreters when both modules are loaded is an experimental feature, provided by the floating module word SET-INTERPRET-FLOAT and the qfloating module word SET-INTERPRET-QFLOAT. Further invocations of LOADM on the modules don't have that effect, because LOADM <module> literally becomes a noop once <module> is loaded.

Known problems

  1. SEE does not work with quad floats in definitions, nor in QFCONSTANTs.
  2. .S ignores quad floats.
  3. Documentation is skimpy.



Up to top of archive