diff options
Diffstat (limited to 'Practical_C_Programming/Chapter_16_1.ipynb')
-rw-r--r-- | Practical_C_Programming/Chapter_16_1.ipynb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Practical_C_Programming/Chapter_16_1.ipynb b/Practical_C_Programming/Chapter_16_1.ipynb new file mode 100644 index 00000000..d1d60ff9 --- /dev/null +++ b/Practical_C_Programming/Chapter_16_1.ipynb @@ -0,0 +1,41 @@ +{ + "metadata": { + "name": "Chapter 16" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": "Chapter 16: Floating point" + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": "Example 16.1, Page number: 322" + }, + { + "cell_type": "code", + "collapsed": false, + "input": "# Example 16.1.py\n# To calculate the accuracy of calculations and storage\n\n\n# Variable declaration\nnumber1 = 1.0\nnumber2 = 1.0\ncounter = 0\n\n# Calculation and result\nwhile (number1 + number2 != number1) :\n counter += 1\n number2 = number2 / 10.0\n\nprint ('%2d digits accuracy in calculations\\n' % counter)\n\n\nnumber2 = 1.0\ncounter = 0\n\nresult = number1 + number2\ncounter += 1\nnumber2 = number2 / 10.0\n\nprint ('%2d digits accuracy in storage\\n' % counter)", + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "16 digits accuracy in calculations\n\n 1 digits accuracy in storage\n\n" + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file |