How to draw lines, circles and other curves

These ideas were developed more than 30 years without knowing that they were already known at that time… Today the graphics cards can easily do things like this in very little time. And today’s CPUs are of course really good at multiplying. So this has lost a lot of its immediate relevance, but it is …

Share Button

Intervals

Intervals are subsets of a universe, that are defined by upper and lower boundaries. Typically we think about real numbers, but any totally ordered universe allows the definition of intervals. Intervals are defined by lower and upper boundaries, which can be a limiting number or unlimited, typically written as for the upper bound and for …

Share Button

Carry Bit, Overflow Bit and Signed Integers

It has already been explained how the Carry Bit works for addition. Now there was interest in a comment about how it would work for negative numbers. The point is, that the calculation of the carry bit does not have any dependency on the sign. The nature of the carry bit is that it is …

Share Button

How to calculate transcendental functions

There is sometimes need to calculate transcendental functions like , , or . We get them from the library and the library relies on implementations in the CPU for most of them. This is true, if we like to do them in „double“ format, which is the standard way of doing floating point arithmetic. But …

Share Button

Modular Arithmetic

We have some articles in this blog about integers of typical programming languages and how they work. Time to introduce the underlying mathematical concepts, that have been covered implicitly until now, since they are also interesting in many other aspects. And besides, this is a very beautiful area of mathematics. Mathematics that we learn in …

Share Button

Integers in Perl 6

The language Perl 6 has been announced to be production ready by the beginning of this year. Its implementation is Rakudo, while the Perl 6 programming language itself is an abstract language definition that allows any language implementation that passes the test suite to call itself an Perl 6 implementation. The idea is not totally …

Share Button

What do +, – and * with Integer do?

When using integers in C, Java or Scala, we often use what is called int. It is presented to us as the default. And it is extremely fast. Ruby uses by default arbitrary length integers. But what do +, – and * mean? We can rebuild them, in Ruby, kind of artificially restrict the integers …

Share Button

Creating Unique Numbers

Many software systems rely on some kind of unique numbers. Uniqueness is always a question in what universe this uniqueness is required. We do see the different kinds of universes in the case of the IP-addresses. In theory they are world wide unique. In practice we have mechanisms in place like NAT, that use certain …

Share Button

Find the next entry in a sequence

In Facebook, Xing, Google+, Vk.com, Linkedin and other of these social media networks we are often encountered with a trivial question like this: 1->2 2->8 3->18 4->32 5->50 6->72 7->? There are some easy patterns. Either it is some polynomial formula or some trick with the digits. But the point is, that any such sequence …

Share Button

How to multiply long numbers

Assuming we have a multiplication of n-bit-numbers already available. Other than typical compiled languages, which assume that the multiplication result fits into the same size as the two factors, we should take a closer look. Unsigned n-bit-numbers as factors and fullfill         So we have for the product     So we …

Share Button