## How to recover the Carry Bit

As frequent readers might have observed, I like the concept of the Carry Bit as it allows for efficient implementations of long integer arithmetic, which I would like to use as default integer type for most application development. And unfortunately such facilities are not available in high level languages like C and Java. But it …

## PI-Day

When using an arguable stupid American date format, today’s date looks like „03/14/15“ instead of 2015-03-14, which are the first few digits of . Now we all know how to calculate , we just use the Taylor series of or , which unfortunately does not converge too well when used naïvely, but there are tricks …

## Geometric and Harmonic Rounding

Most of our rounding methods are based on arithmetic rounding. Please refer to the nomenclature described in Residue Class Rounding. So we can base our rounding on a metric and the most obvious choice is the absolute value of the difference of the two parameters, . That is what everybody does and nothing else really …

## Rounding with sum

Deutsch Often we have to round some numbers in such a way that the sum is correct afterwards. The most obvious case is maybe with percentage values, where a sum other than 100% is confusing for readers. But we may even have cases where a calculation becomes incorrect if the some constraint is violated. Anyway …

## Residue Class Rounding

Deutsch If you do not know what residue classes are, just read on, it will be explained to the extent needed later on. The concept of rounding seems familiar, but let us try to grab it a little bit more systematically. Let us assume a set of numbers and a subset of it, whose elements …

## Shift- and Rotation Functions

Deutsch In a comment to Carry Bit: How does it work the question about shift and rotation functions has been asked. Which exist and how they work exactly depends off course on the CPU architecture, but I will try to give a high level overview anyway. The following aspects have to be considered: 8, 16, …

## Rounding of Money Amounts

Deutsch Many numerical calculations deal with amounts of money. It is always nice if these calculations are somewhat correct or if we can at least rest assured that we do not loose money due to such inaccuracies. Off course there are calculations that may legitimately deal with approximations, for example when calculating profits as percentages …

## Carry Bit: How does it work?

Deutsch Most of us know from elementary school how to add multi-digit numbers on paper. Usage of the carry bit is the same concept, but not for base 10, not even for base 2, but for base 256 (in the old 8-bit-days), base 65536 (in the almost as old 16-bit-days), base 4294967296 (32 bit) or …

## Overflow of Integer Types

Deutsch Handling of integral numbers has always been one of the basic capabilities of our computing devices. Any common programming language since the fifties provides this in some way. There are some significant differences between the ways integral numbers are handled in different programming languages. Dealing with the overflow There are several approaches: Integral numbers …