Про округление
Feb. 23rd, 2023 08:48 pmСамый громкий провал вышел 25 февраля 1991 года, когда выпущенная иракцами ракета “Al Hussein” попала в казармы в Дахране (Саудовская Аравия) убив 28 американских солдат и ранив более сотни. Казармы находились под защитой комплекса «ПЭТРИОТ», который обнаружил ракету… но из-за накопившейся ошибки, связанной с дефектным алгоритмом округления данных, при попытке взять ракету на сопровождение потерял ее из виду. По иронии, техническая команда, которая должна была установить соответствующий патч, прибыла в Дахран 26 февраля – на следующий день после атаки.
https://fonzeppelin.livejournal.com/264312.html
Specifically, the time in tenths of second as measured by the system's internal clock was multiplied by 1/10 to produce the time in seconds. This calculation was performed using a 24 bit fixed point register. In particular, the value 1/10, which has a non-terminating binary expansion, was chopped at 24 bits after the radix point. The small chopping error, when multiplied by the large number giving the time in tenths of a second, lead to a significant error. Indeed, the Patriot battery had been up around 100 hours, and an easy calculation shows that the resulting time error due to the magnified chopping error was about 0.34 seconds. (The number 1/10 equals 1/24+1/25+1/28+1/29+1/212 +1/213+.... In other words, the binary expansion of 1/10 is 0.0001100110011001100110011001100.... Now the 24 bit register in the Patriot stored instead 0.00011001100110011001100 introducing an error of 0.0000000000000000000000011001100... binary, or about 0.000000095 decimal. Multiplying by the number of tenths of a second in 100 hours gives 0.000000095×100×60×60×10=0.34.) A Scud travels at about 1,676 meters per second, and so travels more than half a kilometer in this time.
https://www.iro.umontreal.ca/~mignotte/IFT2425/Disasters.html
https://fonzeppelin.livejournal.com/264312.html
Specifically, the time in tenths of second as measured by the system's internal clock was multiplied by 1/10 to produce the time in seconds. This calculation was performed using a 24 bit fixed point register. In particular, the value 1/10, which has a non-terminating binary expansion, was chopped at 24 bits after the radix point. The small chopping error, when multiplied by the large number giving the time in tenths of a second, lead to a significant error. Indeed, the Patriot battery had been up around 100 hours, and an easy calculation shows that the resulting time error due to the magnified chopping error was about 0.34 seconds. (The number 1/10 equals 1/24+1/25+1/28+1/29+1/212 +1/213+.... In other words, the binary expansion of 1/10 is 0.0001100110011001100110011001100.... Now the 24 bit register in the Patriot stored instead 0.00011001100110011001100 introducing an error of 0.0000000000000000000000011001100... binary, or about 0.000000095 decimal. Multiplying by the number of tenths of a second in 100 hours gives 0.000000095×100×60×60×10=0.34.) A Scud travels at about 1,676 meters per second, and so travels more than half a kilometer in this time.
https://www.iro.umontreal.ca/~mignotte/IFT2425/Disasters.html