ftoo - a tool to convert floating point numbers to hexadecimal form

Table of Content



A tool to convert floating point numbers to hexadecimal form.


ftoo < input > output

reads standard input, and writes it to standard output, converting floating point numbers to their hexadecimal representation.

Input file

The input file is usually an mms file containing floating point constants. These constants are replaced by their hexadecimal representation as computed by the function scan_const defined in mmix-arith.w (respectively mmix-arith.c).

Syntax of Floating Point Constants

Any string matching the following regular expression is considered a floating point number and passed to scan_const for conversion.
OPTSIGN:  [+-]?
NUM:   [0-9]+
DOT:   \.

The expression is slightly more restrictive than required by the scan_const function in order to prevent unwanted replacements.


        OCTA	1.5,-1.2,55
	BYTE	1.5,1e-3
generates the output:
        OCTA    #3FF8000000000000,#BFF3333333333333,55
        BYTE    #3FF8000000000000,1e-3
Notice that there is absolutely no checking for correct MMIX code (BYTE!) and that "1e-3" is not converted (the correct form for conversion would be 1.0e-3).


ftoo is written as a lex file ftoo.l.

Building ftoo

Under Linux, to build ftoo from the source file, you need to generate ftoo.c using flex, and then compile it together with mmix-arith.c and link it against the flex library:
flex -o ftoo.c  ftoo.l
gcc  ftoo.c mmix-arith.c -lfl -o ftoo


You can download an executable for 32-Bit Linux here: ftoo and for OSX you find it here: ftoo.

Please help to keep this site up to date! If you want to point out important material or projects that are not listed here, if you find errors or want to suggest improvements, please send email to email