GithubHelp home page GithubHelp logo

evysgarden / es-cpsf-fixed-point-ws22 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nilhoel1/es-cpsf-fixed-point-ws22

0.0 0.0 0.0 15 KB

Simple coding exercise for a fixed point data type in c++.

Shell 5.61% C++ 74.26% CMake 16.03% Dockerfile 4.10%

es-cpsf-fixed-point-ws22's Introduction

Fixed-Point

Getting Started

This repository contains a setup for a VS Code devcontainer. The devcontainer and VSCode are the recommended setup. If you have access to GitHub Workspaces, you may start the project in your own GitHub fork.

1.) Install Docker on your System.

2.) Install the official VS Code version from Microsoft. The devcontainer will not work with an OSS derivate of VS Code.

3.) Install the Remote Development extension for VS Code.

4.) Press "F1" and run "Remote-Containers: Open folder in container" and select this repository.

5.) All build commands can now be accessed by pressing "ctrl+shift+b". Run config on your very first start. Then run build, to build the project and your changes later on.

6.) The tests menu can be opened by clicking on the flask symbol on the side Bar. Run the tests by clicking on the play button or debug a test by clicking on the play button with the bug on it.

I don't want to use VS Code!!!

We also provide a script for running the build commands. For dependencies please see the Docker file in .devcontainer. Please see the help instructions from helper.sh.

Please provide one of the following arguments:
  clean               Deletes the build folder
  config              Creates build folder and configures build System
  c | compile | build Compiles the Project
  t | test            Execute Unit tests, only test that Fail are printed.

The Exercise

Check out the FixedPoint.cpp file in the FixedPoint folder. There you will see the function bodies for the operators +, - and *. The exercise is to implement all three functions. A good example is to look at the already implemented division and print function as reference. Once all Unit Tests pass, the exercise is considered solved.

The Fixed Point implementation

The implementation of our fixed point is very straight forward. It uses a datatype T, which can be either int8_t, int16_t, int32_t or int64_t, to encode its Value. Please be aware, that the Value is encoded as a signed Value in two's complement. The second type is the FracBits, which is the number of how many bits are used for encoding the digits after the fixed point. A fixed point with T=int8_t and FracBit=3 would be represented like this:

0b 00011.010

And constructed like one of those:

Fixp<int8_t, 3> A(0b00011010);
Fixp<int8_t, 3> A(26);
Fixp<int8_t, 3> A(0x1A);

The tests

To pass the exercise all Tests have to be passed by your implementation.

es-cpsf-fixed-point-ws22's People

Contributors

nilhoel1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.