plum-umd / the-838e-compiler

Compiler for CMSC 838E
2 stars 0 forks source link

Flonum: Double Precision Floating Point Literals and Operators #50

Closed WChung43 closed 3 years ago

WChung43 commented 3 years ago

Hello. This is my update to my implementation of the Floating point numbers for #1. I have implemented 64 point bit floating point numbers based on the IEEE 754 standard by boxing the Flonum in the heap like in Racket. I have implemented Flonum operations of addition, subtraction, equality, less than or equal to, and type checking.

Idea:

The Flonum will be represented first by a pointer with its most right three bits flagged by 3 ones. In the address in the heap that this pointer points to, I have stored double precision floating point numbers in the 64-bit integer by storing the mantissa m, the exponent e, and the sign s where the floating point number = (-1)^s * 2^(e - 1023) + (1+m). The first 52 most-right bits will represent the mantissa m in binary form without the decimal point, the next 11 most-right bits will represent the exponent e, and the next bit will represent the sign s that will be 0 for positive or 1 for negative.

The summary of the changes I made are:

General Changes

types.rkt

unload-bits-asm.rkt

main.c

compile.rkt

test-runner.rkt

Possible things to add next: