ftoo - a tool to convert floating point numbers to hexadecimal form |
||
Content
|
ftooA tool to convert floating point numbers to hexadecimal form.Usageftoo < input > output reads standard input, and writes it to standard output, converting floating point numbers to their hexadecimal representation. Input fileThe 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 ConstantsAny string matching the following regular expression is considered a floating point number and passed to scan_const for conversion.OPTSIGN: [+-]? NUM: [0-9]+ OPTEXP: (e{OPTSIGN}{NUM})? DOT: \. FLOAT: {OPTSIGN}{NUM}{DOT}{NUM}{OPTEXP}The expression is slightly more restrictive than required by the scan_const function in order to prevent unwanted replacements. ExampleOCTA 1.5,-1.2,55 BYTE 1.5,1e-3generates the output: OCTA #3FF8000000000000,#BFF3333333333333,55 BYTE #3FF8000000000000,1e-3Notice 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). Sourcesftoo is written as a lex file ftoo.l.Building ftooUnder 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 ExecutablesYou 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