Code Monkey home page Code Monkey logo

wat-c's Introduction

Integer arithmetics

Signed integer overflow

How many square roots of 1?

Run int/sq.c with following values of a:

  • INT32_MAX
  • INT32_MAX - 1
  • INT32_MIN
  • INT32_MIN + 1

Integer simplifications

Run int/simpl_0.c, int/simpl_1a.c and int/simpl_1b.c compiled with gcc vs. clang at different optimization levels (-O0 to -O3)

Identity elements

Run int/id_elem.c (the result is independent of the optimization level).

Comparison optimization

Run int/comp_0a.c and int/comp_0b.c compiled with gcc vs. clang at different optimization levels (-O0 to -O3)

Absolute value

Do you think it's always nonnegative? Run int/abs.c.

Float arithmetics

NaNs and partial order

Run float/comp.c, float/irreflexivity_0.c and float/irreflexivity_1.c. Floats are only strictly partially ordered (the reflexivity is violated), since NaN != NaN. Except you compile with -Ofast or -ffast-math. ¯\_(ツ)_/¯

Associativity of addition, associativity of multiplication

This is the simplest one. Floats are non-associative since they can over- and underflow. Run float/associativity_add.c and float/associativity_mult.c.

Distributivity of multiplication and addition

Run float/distributivity.c. Also, try compiling with -Ofast.

Underflow

Run float/sq.c.

Subnormals

Run float/inf_challenge.c.

wat-c's People

Contributors

mp4096 avatar

Stargazers

 avatar

Watchers

 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.