Agenda

Converting between different number systems
Writing simple c codes
Using the less obvious features of printf(like width field and precision)

Notes

  • Why is the exponent in ieee format stored as an unsigned int instead of in 2’s complement.

$ \ $

$ \ $

$ \ $

  • Using width field, precision in printf

    The value of the field width or precision can be specified as a separate parameter like so:

     printf("%*d*", 3, my_var)
    

    Here 3 represents the value of the width field

$ \ $

  • Even after specifying math.h as #include, the way to make the code work properly is to do this:

     $ gcc my_file.c -lm