Alex headshot

AlBlue’s Blog

Macs, Modularity and More

JSR294 Fantasy Version Series - Irrational

2009, eclipse, jsr294, osgi

Following on from yesterday's Planets episode, today introduces the final instalment, the irrational versioning scheme.

An irrational number is one which can't be expressed as a division of two whole numbers. So, whilst ½ and ¼ are rational, numbers like π and √2 are irrational.

A nice property of an irrational number is that (a) the digits go on for ever (if they didn't, there would be some number b which is a power of 10 that n/b would be a whole number), and (b) that they don't repeat digits. In other words, our version numbering entropy is infinitely available provided that we operate on a digit basis rather than a strict numerical comparison. Of course, this doesn't permit us to say anything about the importance of changes between subsequent digits; but then, the elegance and beauty of a version numbering system is often not taken into account when dealing with mundane requirements like being able to denote a breaking change.

There are many, some would say infinitely, available irrational numbers for us to choose from; processors SHOULD be able to handle some of them, but not necessarily all of them. In addition, versioning systems MAY have real constraints, such as the ability to represent the version number in an approximating IEEE 754 float or double (depending on bit-width of the operating system). However, they SHOULD try to represent those numbers as an infinite string in order to permit more precision.

The versioning system uses ever more accurate representations of the irrational number. For example, a product whose notional version is based on √2 would start off as version 1, then the next version would be version 1.4, then 1.4.1, and so on. As a result, a product may asymptotically approach the golden version.

Examples of this in use are TeX (the engine underneath LaTeX and others) and METAFONT. TeX is based on the digits of π whilst METAFONT is based on the digits of e. As these both asymptotically approach their mathematical counterparts, their stability will increase, until such a time as they reach π and e respectively.

We may use this to define module requirements, as in the following non-normative example

module IrrationalVersioningSystem @ ∞ {
 requires TeX @ [3.14159,π),
 requires METAFONT @ [2.718,e),
 permits Historic @ √66,

I hope you've enjoyed the last few posts on Planetary version system, Linux version system, and the Roman version system. Let's look forward to what other possibilities open up when JSR 294 is finally released!

Bonus: here's how to calculate &pi to an increasing approximation of accuracy using just random numbers. Pick a random number between 0.0 and 1.0, and multiply it by itself. Pick another random number between 0.0 and 1.0, and multiply it by itself. Add them together, and if it's less than 1, increment p by one. If it's less than 2, increment i by one. Repeat until the desired accuracy is found, approximately 10d iterations where d is the desired number of digits. The answer 4p/i ≈ &pi.