Skip to main content
GameDev.net gamedev.net
🔒 Locked

Division by 0 problem solved - apparently

Started by Endar Dec 7, 2006 at 9:04 AM 50 replies 9k views
Original Post
Endar
Endar
Dr James Anderson has solved the divide by zero problem ... apparently. (link from slashdot)
Quote:
Imagine you're landing on an aeroplane and the automatic pilot's working," he suggests. "If it divides by zero and the computer stops working - you're in big trouble. ... But Dr Anderson has come up with a theory that proposes a new number - 'nullity' - which sits outside the conventional number line. ... "We've just solved a problem that hasn't been solved for twelve hundred years - and it's that easy," proclaims Dr Anderson having demonstrated his solution on a whiteboard at Highdown School, in Emmer Green.
He has invented/named something called "nullity", which he defines as 0 / 0. So, he defines it as zero divided by zero. First of all, I'm fairly sure that if an airplane attempts to perform a divide by zero, an exception is thrown. I started writing a very basic operating system and that was like the 3rd thing that was included, the ability to throw an exception for a divide by zero. And this guy is apparently from the Computer Science department of the University of Reading. Anyway, could someone watch the video and explain it to me? I'm not particularly strong in maths, but it doesn't really seem to me like he's done anything. To my inadequate mathematics brain, it looks like he's just named something and said "Look, I've solved it." Please correct me if I'm wrong, but is it possible to create something that is completely seperate from the number line and still say that it can be used without breaking all the maths that is used in the number line? Or is that exactly what imaginary numbers are? Edit:: Oh, I also like this excerpt from his comment: "I’ll put a proof at the end of this message, but let’s be clear on what this means." He obviously didn't check to see that his message was too long for a single comment.
[size="2"][size=2]Mort, Duke of Sto Helit: NON TIMETIS MESSOR -- Don't Fear The Reaper
KaptainKomunist
KaptainKomunist
OK.

Most modern languages stopped shitting bricks when encountering x/0 a while ago. For devices such as those listed in the article, it would require a redesign of the processor. i, infinity, and NaN all work great in modern languages, however it's impossible to represent them in a strictly numerical manner in memory.
Raghar
Raghar
I have library that allows division by zero precisely. It also allows
a * 0 = b
b / 0 = a

I really don't understand why would anyone like to define result of 0/0 as a special number.
Dmytry
Dmytry
Ok. Welcome to many years ago. My computer already has NAN .
ToohrVyk
ToohrVyk
Quote:
Original post by Endar
Imagine you're landing on an aeroplane and the automatic pilot's working," he suggests. "If it divides by zero and the computer stops working - you're in big trouble.


Huh. Critical systems should be proven to be safe from these bugs anyway, before they are used at all.

And even if they are, redundant systems exist for a reason. If everything else fails, flip the hard reset switch (planes have these, and they're fast).
kSquared
kSquared
Quote:
Original post by ToohrVyk
Quote:
Original post by Endar
Imagine you're landing on an aeroplane and the automatic pilot's working," he suggests. "If it divides by zero and the computer stops working - you're in big trouble.


Huh. Critical systems should be proven to be safe from these bugs anyway, before they are used at all.

And even if they are, redundant systems exist for a reason. If everything else fails, flip the hard reset switch (planes have these, and they're fast).

It shouldn't matter anyway. Almost every modern programming language I can think of has some kind of exception-handling capability. Even if a divide-by-zero occurred, it would surely not be crippling in a properly designed system.
- k2 "Choose a job you love, and you'll never have to work a day in your life." — Confucius"Logic will get you from A to B. Imagination will get you everywhere." — Albert Einstein"Money is the most egalitarian force in society. It confers power on whoever holds it." — Roger Starr{General Programming Forum FAQ<
ToohrVyk
ToohrVyk
Quote:
Original post by kSquared
It shouldn't matter anyway. Almost every modern programming language I can think of has some kind of exception-handling capability. Even if a divide-by-zero occurred, it would surely not be crippling in a properly designed system.


Then again, a lot of aircraft-handling code is written in C (Airbus A340 comes to mind). And also, most embedded systems have either C-only support, or C and a subset of C++ which does not support exceptions.

python_regious
python_regious
Quote:
Original post by ToohrVyk
Quote:
Original post by kSquared
It shouldn't matter anyway. Almost every modern programming language I can think of has some kind of exception-handling capability. Even if a divide-by-zero occurred, it would surely not be crippling in a properly designed system.


Then again, a lot of aircraft-handling code is written in C (Airbus A340 comes to mind). And also, most embedded systems have either C-only support, or C and a subset of C++ which does not support exceptions.


Erm, not really. Ada is used in most safety critial applications that I can think of. The code for most aircraft, all space craft, signalling systems for trains, and a lot of military applications is written in Ada. Ada (83) was invented for this very purpose - that being realtime and safety crital applications. ( As examples that I know for certain off the top of my head - the A380 software uses ada, as does the Boeing 777 ).

Besides, the best programming language in the world is useless unless you have a decent test harness and testing strategy.
If at first you don't succeed, redefine success.
ToohrVyk
ToohrVyk
Quote:
Original post by python_regious
Erm, not really. Ada is used in most safety critial applications that I can think of. The code for most aircraft, all space craft, signalling systems for trains, and a lot of military applications is written in Ada.


That's possible. However, the primary flight system on the A340 was written in C, and I doubt that they would move away from Ada if they had used in previous versions. EDIT: also, the the electric flight control code used by the A380 on its maiden flight was written in C.

Quote:
Besides, the best programming language in the world is useless unless you have a decent test harness and testing strategy.


True. Unexpected arithmetic errors aren't due to a lack of exceptions. In the end, you still have to prove (or test, but that's less convincing) that the critical system behaves as expected.
jfclavette
jfclavette
The article is light on anything meaningful. What do we have, what's the theory ?

0/0 = nullity <=> 0*nullity = 0 <=> nullity*nullity = WTF1 <=> nullity+nullity = WTF2 <=> k*nullity = WTF3 <=> k/0 = WTF4 ?

Is multiplication by nullity commutative ?
I teleported home one night; With Ron and Sid and Meg; Ron stole Meggie's heart away; And I got Sydney's leg. <> I'm blogging, emo style
Raghar
Raghar
Could you imagine they don't have any equation with zero in denominator? Or could you imagine they are testing for zero where they should?

It's unimportant if that language uses exceptions, or not. The versions used in the critical industry, or with micro editions, are often different.
python_regious
python_regious
Quote:
Original post by ToohrVyk
Quote:
Original post by python_regious
Erm, not really. Ada is used in most safety critial applications that I can think of. The code for most aircraft, all space craft, signalling systems for trains, and a lot of military applications is written in Ada.


That's possible. However, the primary flight system on the A340 was written in C, and I doubt that they would move away from Ada if they had used in previous versions.


Fair enough, though I believe Airbus are using Ada for at least part of their software.

Quote:

Quote:
Besides, the best programming language in the world is useless unless you have a decent test harness and testing strategy.


True. Unexpected arithmetic errors aren't due to a lack of exceptions. In the end, you still have to prove (or test, but that's less convincing) that the critical system behaves as expected.


Well, testing is really the only method to be able to prove that the software under test is actually doing what it should (and just as importantly not doing what it shouldn't). Developing a good testing strategy (unit, integration and functional) is paramount. Anyway, I digress from the topic [smile].
If at first you don't succeed, redefine success.
ToohrVyk
ToohrVyk
Quote:
Original post by python_regious
Fair enough, though I believe Airbus are using Ada for at least part of their software.


I hear it's used for the command interface.

Quote:

Well, testing is really the only method to be able to prove that the software under test is actually doing what it should (and just as importantly not doing what it shouldn't). Developing a good testing strategy (unit, integration and functional) is paramount.


The approach used by Airbus is different: they sprinkle their code with assertions, add several common sense constraints (no divide-by-zero, no writing outside arrays, no calling sqrt on a negative number), and then run the entire code through a static analysis program (Astrée). The static analysis program then lists possible errors, which are corrected, until it is proven that no assertions or constraints are violated anymore. EDIT: this isn't to say that they don't also use tests, simply that the soundness of their programs is proven instead of just tested.

Unlike tests (where there is always a possibility that an untested case is buggy), static analysis proves that no runtime errors happen. Of course, asserting conditions and constraints is a little bit like writing unit tests, but you can be a lot more expressive with it (in static analysis, assert(x > 0) means x is always positive, in testing it means x is positive in all tested cases).
CTar
CTar
Quote:
Original post by jfclavette
The article is light on anything meaningful. What do we have, what's the theory ?

0/0 = nullity <=> 0*nullity = 0 <=> nullity*nullity = WTF1 <=> nullity+nullity = WTF2 <=> k*nullity = WTF3 <=> k/0 = WTF4 ?

Is multiplication by nullity commutative ?


Here is a paper trying to explain it better, I haven't read it yet, so can comment on it.
python_regious
python_regious
Quote:
Original post by ToohrVyk
Quote:
Original post by python_regious
Fair enough, though I believe Airbus are using Ada for at least part of their software.


I hear it's used for the command interface.

Quote:

Well, testing is really the only method to be able to prove that the software under test is actually doing what it should (and just as importantly not doing what it shouldn't). Developing a good testing strategy (unit, integration and functional) is paramount.


The approach used by Airbus is different: they sprinkle their code with assertions, add several common sense constraints (no divide-by-zero, no writing outside arrays, no calling sqrt on a negative number), and then run the entire code through a static analysis program (Astrée). The static analysis program then lists possible errors, which are corrected, until it is proven that no assertions or constraints are violated anymore. EDIT: this isn't to say that they don't also use tests, simply that the soundness of their programs is proven instead of just tested.

Unlike tests (where there is always a possibility that an untested case is buggy), static analysis proves that no runtime errors happen. Of course, asserting conditions and constraints is a little bit like writing unit tests, but you can be a lot more expressive with it (in static analysis, assert(x > 0) means x is always positive, in testing it means x is positive in all tested cases).


I see. Well, you can't verify code integrity with static analysis alone (though, it's good for enforcing coding standards, and the like). You have to drive the SUT with some sort of dynamic test and gather results from that (in the form of code coverage - D0-178B Level A MC/DC for instance - a military condition on software and general checks). When dynamically testing software you need some sort of test harness that can gather coverage information on the SUT - such that you know what bits of code have been tested, and which have not, and so you can verify values in and out of the SUT, can verify call sequences and so forth. Do you guys (I presume you work for Airbus) not use any sort of test harness then? (for example, IBM's Rational, IPL's Cantata(++) and AdaTEST95 [smile], etc?)

Yeah... I work with this sorta thing... [smile]
If at first you don't succeed, redefine success.
ToohrVyk
ToohrVyk
Quote:
Original post by python_regious
I see. Well, you can't verify code integrity with static analysis alone (though, it's good for enforcing coding standards, and the like).


Code integrity can be verified. What is harder to verify is the correspondence between what the written code does, and what the contractor expects. This is usually expressed as a combination of three approaches: models (proven outside the program using ad hoc proof techniques), assertions (to check that the properties of a model have been implemented correctly, proven through static analysis) and dynamic testing (comparing the expected output with the real output, for a given input, over a given duration).

Quote:
(I presume you work for Airbus)


Nope, I'm with the École normale supérieure, which provides the Astrée static analysis tool used by Airbus.

Most dynamic tests used on airplanes are integrated into the on-board control system. I don't know the specific details of this, but I'm pretty sure that every time the electronic system of a plane is turned on, it runs diagnostic tests to check that both software and hardware act correctly.
python_regious
python_regious
Quote:


Nope, I'm with the École normale supérieure, which provides the Astrée static analysis tool used by Airbus.

Most dynamic tests used on airplanes are integrated into the on-board control system. I don't know the specific details of this, but I'm pretty sure that every time the electronic system of a plane is turned on, it runs diagnostic tests to check that both software and hardware act correctly.


Cool. Well, I know Boeing use unit testing techniques on their software (using AdaTEST95), however I should bloody well hope that they have an onboard diagnostic system!
If at first you don't succeed, redefine success.
CTar
CTar
The problem with that article is that it's trying to impress people by saying "look here's a new scientist, smarter than Einstein" and proceeds to follow him into a school with fairly young students. He makes a couple of bad comments at the school like it hasn't been solved for a very long time, "it's that simple" even though it's only that simple by definition, etc. I believe this is to catch their interest, but it certainly isn't true. All mathematicians know that we could just give 0/0 a name, and it has been done before (IEEE floating point's NaN).

In his actual paper he describes that he's aware of the IEEE approach, but he feels the need for 3 number types: plain numbers, silent numbers and signaling numbers combined with the fact that it contains a number not equal to itself (NaN != NaN) means that IEEE is doomed. He believes that his transreal numbers will solve this, because they only need one number type and doesn't contains the same absurd things IEEE do.

In many ways it isn't consistent, for instance x = y doesn't imply that x-y=0, x-x isn't guaranteed to be 0, etc.

People need to keep in mind the purpose of these numbers is as a foundation for a computing machine (Perspex).
Kaze
Kaze
i believe numbers in .net can hold a infinity value if a /0 occurs

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.