DIGITAL LIBRARY
ON EXPLAINING VARIABLE RANGE IN STANDARD PROGRAMMING LANGUAGES (TO STEM STUDENTS)
University North (CROATIA)
About this paper:
Appears in: ICERI2019 Proceedings
Publication year: 2019
Pages: 1551-1561
ISBN: 978-84-09-14755-7
ISSN: 2340-1095
doi: 10.21125/iceri.2019.0445
Conference name: 12th annual International Conference of Education, Research and Innovation
Dates: 11-13 November, 2019
Location: Seville, Spain
Abstract:
In addition to many specialised computing tools for solving different kind of technical and mathematical problems, students in STEM fields are often required to develop and use their own solutions - often implemented as more or less complex programmes written in standard programming languages such as C/C++, Java, Python, Pascal and others. Depending on curriculums of lower range education (secondary schools and high schools) and their personal interests (e.g. hobists), those students may show different range of knowledge related to programming skills. In our undergraduate courses (in electrical engineering and multimedia) we decided, based on quite pronounced divergence among students, to include full course for learning fundamentals of programming in C with some minor inclusion of C++ basics. In relation to other courses, for example computer architecture and digital electronics, we are always trying to give our students full broad picture and somehow interconnect those fields. One of the first classes relates to the declaration of variables, with special notes about numeric variables (integer numbers in this case) and range limitations - this simple theory is not an issue, but when put in front of real-world practical problem, students often somehow oversee those fundamental definitions.

In this article we will present a simple calculation function - calculation of factorials (direct multiplicative loop solution, not approximation expression) - and detect and depict a problem that appears due limited range, or better to say, influence of bit-length of certain integer type to obtaining proper results. Different kind of variable types will be discussed, while exact mathematical explanation and calculation of result limits will be given. The same function will be checked in few programming languages in addition to C (Java, Pascal among “standard old-school” languages and JavaScript, PHP, Python as other often used languages). Also, specialised, open-source and free, computing tool with its accompanying language, SciLab, will be used to check whether such tools give some better results out of the box. Comparison of results (calculation limits) will be given, with explanations. In C programming language, some remarks about additional extension of integer type limits (how to use 128 bit integers, or other “visual” solution capable of finding right solution values, but representing them as string instead of numbers) will be covered.
Keywords:
Programming, variable, range, integer, bit-length, education, explain, limit, C, Pascal, Java.