float init 0 request

monkyyy crazymonkyyy at gmail.com
Fri Aug 21 19:29:24 UTC 2026


On Friday, 21 August 2026 at 18:20:35 UTC, Walter Bright wrote:
> On 8/20/2026 7:36 PM, Steven Schveighoffer wrote:
>> This contrived almost impossible to occur scenario where zero 
>> somehow equates to a factor of 2000 which was not caught in 
>> testing is not convincing.
>
> I've written numerical analysis programs. One has to be very 
> careful with the math, because small roundoff errors can 
> accumulate to very large errors.
>
> Avionics software does get tested very thoroughly. But problems 
> still happen, including ones that have caused crashes.
>
>
>> I can play too:
>> 
>> ```d
>> if(gas < amountNeeded) warnPilot();
>> ```
>
> Not really. The avionics gives a number of how much gas needs 
> to be put in the tanks. See this case study:
>
> "Air Canada Flight 143 ran out of fuel because of a metric unit 
> conversion error. Ground crews calculated the required fuel 
> load in pounds instead of kilograms for a brand-new Boeing 767, 
> loading less than half the necessary fuel. This mistake was 
> compounded by a malfunctioning fuel gauge system that had been 
> cleared for departure, leaving the crew unaware they were 
> flying with empty tanks until both engines quit at 41,000 feet."
>
> https://en.wikipedia.org/wiki/Gimli_Glider

Presumably the `amountneeded` is calculated by subtracting two 
gps coordinates
what if the gps sensor returns nan when disconnected for 3 
minutes.

Then the fuel needed only uses max fuel over the flight to make 
sure if the fuel estimate was under estimated it would gracefully 
still check.

This max used nan safetly, return nan when either argument is nan 
cause ummm safety. Returning nan indefently.

And then the airplane exploded killing everyone.

Anyway, moral of the story, nan bad.

---

Moralizing api choices using invented airplane thought 
experiments gets old. You *can not* make a correct and complete 
system, and imagining all possible theatrical airplanes would 
require completeness.


More information about the Digitalmars-d mailing list