Tuesday, September 27, 2005

Consequences of 1/10 in binary

A while ago we had a chat with Mr. Atalay about the interesting fact that you can't express the decimal 0.1 exactly in binary (try it!). I just read a report related to this fact which was the reason of 28 soldiers getting killed in the Gulf War. Excerpt:

"On February 25th, 1991, a Patriot Missile system that had been running for over 100 hours at Dhahran, Saudi Arabia had failed to intercept a SCUD missile. The SCUD hit an Army Barracks, killing 28 Americans. On the next day, the Bug Fix for the system arrived at Dhahran[2].

The reason this bug occurred is because of a problem with storing time in a 24-bit register. The problem is that time is stored to an accuracy of 1/10th of a second, but a 24-bit register does not have enough precision to store 0.1, so a small fraction of each second is lost. The result is that the register used to keep track of time is off by 0.0001% of the amount of time that the system has been in operation. The problem is that computers do not store information as a standard decimal. Instead, they use binary code, which can not accurately store 1/10th of a second...It was estimated that after running the system for twenty hours, the calculations made using the old algorithm and those made by the new algorithm differed by as much as 1/3 of a second[3]. A SCUD missile can travel more than one mile per second."

Click here and here for other cases of software malfunctions.

By the way, our chat with Mr. Atalay can be summarized as follows:

One aspect of the chaotic systems is that you need an infinite amount of knowledge about the initial conditions of the system to make some prediction (see butterfly effect). Might there be a possibility that with some other form of representation, to solve the difficulty of infinite information requirement? As an example take the decimal 0.1; If we knew only the binary system, we would need an infinite number of digits to represent 0.1 exactly. And if one day a super-intelligent alien visited us and taught us the ultra-high-tech decimal system, voilla, you have exact representation with just 1 significant digit! Of course, instead of adopting this new wisdom, we would quickly proceed to burn that infidel alien (!)

Care to think about Pi and sqrt(2)? Or shall we rather wait for the green guys in flying saucers to drop by?

3 comments:

Nart Bedin Atalay said...

Bugün, sayın Korkmaz'ın yazısından gaz alarak niçin bazı sayılar bazı notasyonlarda sonlu serilerle yazılabiliyorken diğerler notasyonlarda yazılamıyor problemini düşündüm. Açıkcası bir sonuca varamadım. Şu an problemin asal sayılar ile ilgili olduğu konusunda sadece his sahibiyim. Bunun bir matematiksel açıklamasını okuyup anlayabilirsem çok rahatlamış olacağım.

Bu konular için calculus kitabını okurken, olaya yeni bir bakış açısı kazandırabilecek bir şeyi fark ettim. İzin verirseniz onu anlatmaya çalışayım.

Şimdi rasyonel sayılar m ve n tam sayı (integer) olmak üzere n/m şeklinde yazılabilen sayılar. Bunların özelliği bir sayı notasyonunda sonlu olarak temsil edilmeseler bile (örn 0 ikili sayı sisteminde 0,1 onlu sayı sisteminde 1/3 vs.) sonsuza giden seri periyodik olarak tekrar ediyor.

İrrasyonel sayıları rasyonellerden ayıran özellik ise sonsuza giden seri periyodik olarak tekrar etmiyor, örnek karekök(2).

Simdi, 22/7 sayısı (yani pi) rasyonel olarak ifade edilebiliyor. Fakat kendisi bir trilyon digit e kadar hesaplanmış fakat tekrar eden bir pattern bulunamamışmış (bakınız yukardaki referans).

Bu durumda sayı teorisi tutarlı bir teori olmaktan çıkıyor mu? Pi sayısını sonlu olarak gösterebilecek bir sistem var mı? Pi sayısı niye bu kadar problemli, onu özel yapan nedir? vs. vs.

Sanıyorum, bizim bazı öngörüler için sonsuz sayıda bilgiye ihtiyaç olduğu varsaymamız, konu mankeni füzemizin kendi kendine aynı varsayımı yapmasıyla aynı şey.

Samil Korkmaz said...

Ufak bi düzeltme: 22/7 Pi için üçüncü basamağa kadar tutan bir aproksimeyşın. Pi bir irrasyonel sayı.

Nart Bedin Atalay said...

Haaaaaaaaaaa.

Çıkarılacak ders:
Heyecana yenilip aklına gelen şeyleri uzun uzadıya düşünmeden sonuçlara varmak komik durumlara düşürebilir insanı.