User Tools

Site Tools


notes:discrete:fall2022:projects:lmr2

BACKGROUND

Here is a link to a wikipedia article describing how the binary32 (also known as float in C) format works within the IEEE 754 standard: https://en.wikipedia.org/wiki/Single-precision_floating-point_format

Also, here is a presentation showing basic math operations on floating points: https://www.cs.utah.edu/~rajeev/cs3810/slides/3810-20-11.pdf

For those who prefer a video format, here are some videos to help explain the standard:
Basics of IEEE 754: https://www.youtube.com/watch?v=RuKkePyo9zk
Floating Point Addition: https://www.youtube.com/watch?v=aH11flclJDI
Floating Point Subtraction: https://www.youtube.com/watch?v=JnorFLL86DE

Here is an example: Given in IEEE 754: 11000000110110011001100110011010 First bit (bit 0)- Represents positive or negative. In this case, the first bit is one, hence negative. Bit 1-8 represents the exponent, 10000001 or 129 Bit 9-32 represents the fraction, .10110011001100110011010, or ~~.7000000.

Hence, we have -1 (because first bit is 1) times (1.7000000)×2^129-127 = -6.8 Here is a helpful resource: http://mathcenter.oxford.emory.edu/site/cs170/ieee754/

SPECIFICATIONS

Math functions should perform float operations following the IEEE 754 standard. You should have a demo showing off the functionality of the math functions you have made. The way you do this is up to you, but if you have any questions whether your demo is up to standard, you should ask in discord before submitting.

OUTPUT SPECIFICATIONS

Your display demo should output the result of whatever math function you are displaying.

PROGRAM

EXAMPLES

VERIFICATION

No verification script this week. Better luck next ti… wait there isn't a next time! Anyways, all verification will be manual for lmr2. Since we're working with 32 bit arrays this week, if your demo is based on user input, it might be easier to comment out the demo and manually set the array's to values you want to test.

PSEUDOCODE

Cool pattern I found

Let's say we are trying to convert a standard decimal value into a float. We can begin by diving out all valid exponent bits, for example if we are converting 5.125 then our one and only valid exponent would be 4. We thus set the bit representing 4x bit to 1, and then arrive at our precision bits. After dividing by 4, we are left with 1.28125. We can subtract 1 from our value, which leaves 0.28125. We continue this until we have 0 or have passed by the smallest valued precision bit.

notes/discrete/fall2022/projects/lmr2.txt · Last modified: 2022/11/16 18:42 by gsuber