2 ms·
There are two separate challenges here. 1. Very rarely, a computer will add 1 and 1 and end up with something other than 2. Search for 'cosmic bitflips' Given
by d1sxeyes 4y ago
There are two separate challenges here.
1. Very rarely, a computer will add 1 and 1 and end up with something other than 2. Search for 'cosmic bitflips'
Given how rare this kind of event is, it shouldn't be necessary, in every case involving a computer, to prove that that specific computer will reliably produce 2 when asked to add 1 and 1.
As a result, it makes sense to presume that a computer is operating correctly unless there is evidence to the contrary.
However, challenge 2 comes in when you start to generalise.
2. Humans often (accidentally or intentionally) tell computers to do things wrongly. Consider the below obviously contrived example:
function divide(pounds, divisor) {
return (pounds/divisor).toFixed(2);
}
function multiply(pounds, multiplier) {
return (pounds*multiplier).toFixed(2);
}
function getUnitPrice(pricePerKg, unitsPerKg) {
return divide(pricePerKg, unitsPerKg)
}
function makeSale(unitPrice, qty) {
return multiply(unitPrice, qty)
}
const widgetPricePerKg = 10;
const widgetUnitsPerKg = 3;
const widgetUnitPrice = getUnitPrice(widgetPricePerKg, widgetUnitsPerKg);
const widgetsSold = 3;
const totalSales = makeSale(widgetUnitPrice, widgetsSold);
const kilosOfWidgetsSold = divide(widgetsSold, widgetUnitsPerKg);
const expectedSalesValue = multiply(kilosOfWidgetsSold, widgetPricePerKg);
console.assert(totalSales === expectedSalesValue, 'Total Sales is not equal to Expected Sales Value');
This sample shows how easily a computer, operating correctly, can be mislead by a careless programmer. You could even have test suites which end up with errors, for example if the units per Kg were 4, or the price per Kg were 13 and the units per Kg were 10.
It is important to draw the line between 'operating correctly' and 'operating as intended'.
- fargle 4y agocorrect! if ever faced with this situation, the hair should be split. We can accept that the action of the computer machinery is, without evidence to the contrary, assumed to be correct. It's not a "computer" error. BUT, the programming of said computer is certainly not infallible. In fact, without evidence to the contrary, I think there is ample precedent that a computer program is full of bugs and should be trusted not one bit. Where's the evidence that the program was tested? Designed to safety or reliability standards? Etc. If I was ever required to "prove" that a computer system (including programming) was faulty, Hoo-Boy! Give me access to the source code. It's a fair bet you could find one bug per every 100 lines of code without trying. The days of "nope - computer sez..." are over. Every judge, jury person has experienced these issues personally too. The position of infallible computer system will not stand long.