User Tools

Site Tools


notes:discrete:fall2022:projects:lmr1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:discrete:fall2022:projects:lmr1 [2022/10/26 22:12] – [PROGRAM] bolsen1notes:discrete:fall2022:projects:lmr1 [2022/10/28 03:55] (current) – [OUTPUT SPECIFICATIONS] dmuck
Line 23: Line 23:
 *For anybody interested in editing the wiki page, here is the dokuwiki user guide: https://www.dokuwiki.org/wiki:syntax#basic_text_formatting -Ash *For anybody interested in editing the wiki page, here is the dokuwiki user guide: https://www.dokuwiki.org/wiki:syntax#basic_text_formatting -Ash
 ====OUTPUT SPECIFICATIONS==== ====OUTPUT SPECIFICATIONS====
-Determine a unified means of output so that all submissions have an identical format. Should get identical output to running non-bitwise versions of the same functions. Ex: your function subtraction of 27 and 3 should output 24 just like  27 - 3 = 24.+Determine a unified means of output so that all submissions have an identical format. Should get identical output to running non-bitwise versions of the same functions.  
 + 
 +Example: your function subtraction of 27 and 3 should output 24 just like  27 - 3 = 24.  
 + 
 +Make sure to be mindful of what numbers you are using in the tests. You should ideally pick numbers that could cause problems in your code, that way you can see if you are missing a case, or maybe a function is incorrect. Other than this, there is no output specification. Show your function does what it's supposed to do.
  
 =====PROGRAM===== =====PROGRAM=====
Line 30: Line 34:
 When it comes to binary division and multiplication, you may want to try using your add and subtract functions to complete the division and multiplication functions. For multiplication, you will want to add a 12-bit array to itself n amount of times based on the other function input. This may require the creation of a binary to int converter for this solution to work. When it comes to binary division and multiplication, you may want to try using your add and subtract functions to complete the division and multiplication functions. For multiplication, you will want to add a 12-bit array to itself n amount of times based on the other function input. This may require the creation of a binary to int converter for this solution to work.
 =====EXAMPLES===== =====EXAMPLES=====
 +====COOL BITWISE TRICKS==== 
 +1. Right-shift is equivalent to dividing by 2\\ 
 +2. Left-shift is equivalent to multiplying by 2\\ 
 +3. AND can be used on the first bit to check for odd/even\\
 =====VERIFICATION===== =====VERIFICATION=====
 Make sure to test multiple different numbers, some numbers may work while others may not. Make sure to test multiple different numbers, some numbers may work while others may not.
Line 38: Line 45:
  
 =====PSEUDOCODE===== =====PSEUDOCODE=====
 +
 +=====C++ operator overloading=====
 +C++ operator overloading could be relevant to this project as a means of cleaning up your code. With operator overloading you could go from
 +<code>
 +multiply(a, b)
 +</code>
 +To:
 +<code>
 +a * b
 +</code>
 +If you're interested in doing this the basic syntax is as follows:
 +<code>
 +struct MyStruct
 +{
 +    MyStruct operator*(MyStruct other_struct) { ... }
 +    bool operator==(int x) { ... }
 +}
 +</code>
 +Its just a function with some nice syntax!
  
notes/discrete/fall2022/projects/lmr1.1666822336.txt.gz · Last modified: 2022/10/26 22:12 by bolsen1