Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Real Users find the one combination of bizarre input values that shuts down the system for days.


tech / sci.electronics.design / Re: 0.0 / 0.0 = -NAN ?

SubjectAuthor
* Re: 0.0 / 0.0 = -NAN ?jlarkin
`* Re: 0.0 / 0.0 = -NAN ?Ricky
 +* Re: 0.0 / 0.0 = -NAN ?legg
 |+- Re: 0.0 / 0.0 = -NAN ?Martin Brown
 |+* Re: 0.0 / 0.0 = -NAN ?jlarkin
 ||`* Re: 0.0 / 0.0 = -NAN ?legg
 || `* Re: 0.0 / 0.0 = -NAN ?John Larkin
 ||  `* Re: 0.0 / 0.0 = -NAN ?whit3rd
 ||   +- Re: 0.0 / 0.0 = -NAN ?Ricky
 ||   `- Re: 0.0 / 0.0 = -NAN ?John Larkin
 |`* Re: 0.0 / 0.0 = -NAN ?whit3rd
 | `* Re: 0.0 / 0.0 = -NAN ?jlarkin
 |  +* Re: 0.0 / 0.0 = -NAN ?Martin Brown
 |  |+- Re: 0.0 / 0.0 = -NAN ?jlarkin
 |  |`* Re: 0.0 / 0.0 = -NAN ?Joe Gwinn
 |  | +* Re: 0.0 / 0.0 = -NAN ?Lasse Langwadt Christensen
 |  | |`* Re: 0.0 / 0.0 = -NAN ?Joe Gwinn
 |  | | `- Re: 0.0 / 0.0 = -NAN ?Phil Hobbs
 |  | +* Re: 0.0 / 0.0 = -NAN ?John Larkin
 |  | |`- Re: 0.0 / 0.0 = -NAN ?Ricky
 |  | +* Re: 0.0 / 0.0 = -NAN ?Ricky
 |  | |+- Re: 0.0 / 0.0 = -NAN ?Joe Gwinn
 |  | |`* Re: 0.0 / 0.0 = -NAN ?none
 |  | | `- Re: 0.0 / 0.0 = -NAN ?Joe Gwinn
 |  | `* Re: 0.0 / 0.0 = -NAN ?Martin Brown
 |  |  +- Re: 0.0 / 0.0 = -NAN ?jlarkin
 |  |  `- Re: 0.0 / 0.0 = -NAN ?Joe Gwinn
 |  +* Re: 0.0 / 0.0 = -NAN ?whit3rd
 |  |`- Re: 0.0 / 0.0 = -NAN ?John Larkin
 |  `* Re: 0.0 / 0.0 = -NAN ?Phil Hobbs
 |   +* Re: 0.0 / 0.0 = -NAN ?Lasse Langwadt Christensen
 |   |+* Re: 0.0 / 0.0 = -NAN ?Ricky
 |   ||`- Re: 0.0 / 0.0 = -NAN ?Lasse Langwadt Christensen
 |   |+- Re: 0.0 / 0.0 = -NAN ?Phil Hobbs
 |   |`* Re: 0.0 / 0.0 = -NAN ?Martin Brown
 |   | +* Re: 0.0 / 0.0 = -NAN ?jlarkin
 |   | |`* Re: 0.0 / 0.0 = -NAN ?John Walliker
 |   | | `- Re: 0.0 / 0.0 = -NAN ?jlarkin
 |   | +* Re: 0.0 / 0.0 = -NAN ?rbowman
 |   | |+* Re: 0.0 / 0.0 = -NAN ?Lasse Langwadt Christensen
 |   | ||`- Re: 0.0 / 0.0 = -NAN ?rbowman
 |   | |`* Re: 0.0 / 0.0 = -NAN ?Phil Hobbs
 |   | | `* Re: 0.0 / 0.0 = -NAN ?jlarkin
 |   | |  `- Re: 0.0 / 0.0 = -NAN ?Phil Hobbs
 |   | `* Re: 0.0 / 0.0 = -NAN ?Phil Hobbs
 |   |  +* Re: 0.0 / 0.0 = -NAN ?whit3rd
 |   |  |`- Re: 0.0 / 0.0 = -NAN ?Martin Brown
 |   |  `- Re: 0.0 / 0.0 = -NAN ?Martin Brown
 |   `* Re: 0.0 / 0.0 = -NAN ?John Larkin
 |    `* Re: 0.0 / 0.0 = -NAN ?Phil Hobbs
 |     `* Re: 0.0 / 0.0 = -NAN ?jlarkin
 |      +* Re: 0.0 / 0.0 = -NAN ?Phil Hobbs
 |      |`- Re: 0.0 / 0.0 = -NAN ?jlarkin
 |      `- Re: 0.0 / 0.0 = -NAN ?Ricky
 `* Re: 0.0 / 0.0 = -NAN ?Ricky
  `* Re: 0.0 / 0.0 = -NAN ?Lasse Langwadt Christensen
   `- Re: 0.0 / 0.0 = -NAN ?Ricky

Pages:123
Re: 0.0 / 0.0 = -NAN ?

<4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=95846&group=sci.electronics.design#95846

  copy link   Newsgroups: sci.electronics.design
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
NNTP-Posting-Date: Sat, 30 Apr 2022 11:11:30 -0500
From: jlar...@highlandsniptechnology.com
Newsgroups: sci.electronics.design
Subject: Re: 0.0 / 0.0 = -NAN ?
Date: Sat, 30 Apr 2022 09:11:27 -0700
Message-ID: <4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com>
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com>
X-Newsreader: Forte Agent 3.1/32.783
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 51
X-Trace: sv3-XUBTKuwRYcvjOzEtibzgHHwGS6aVfQaG7A0pIwE6ugknEPa6tHLIm4BpyxTg+QRXEWpqgqaIwwRtRin!va2kxtl8JwvR8YdPdavE2+1OaWaBnZCJehLsEhoMfQe/3IIeWS3eXwtANLuahOpWo/IW5UPNUXLn!4KsIgA==
X-Complaints-To: www.supernews.com/docs/abuse.html
X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2384
 by: jlar...@highlandsniptechnology.com - Sat, 30 Apr 2022 16:11 UTC

On Sat, 30 Apr 2022 08:31:47 -0700 (PDT), Skybuck Flying
<skybuckflying@gmail.com> wrote:

>When exception masks are all enabled to stop the processor from throwing floating point exceptions the following calculation produces a somewhat strange result:
>
>0.0 / 0.0 = -nan
>
>(At least in Delphi).
>
>For now I will assume this is the case in C/C++ as well and with that I mean on x86/x64 which should and seems to be following IEEE 754 floating-point format.
>
>I am a little bit surprised by this and I want/need to know more. Where is this defined that 0.0 / 0.0 should be -NAN ?!?
>
>Problem is with the code, example:
>
>T := 0;
>D := 0.0 / 0.0;
>P := T * D;
>
>This screws up P. instead of P being zero, P is now also -NAN ?!?
>
>I find this very strange but ok.
>
>I guess a simple solution could be to set D to 0 explicitly for this case, is there perhaps another solution ? Maybe some kind of mask or rounding mode so that additional branch is not necessary ???
>
>Bye for now,
>Skybuck.

I wrote an s32.32 saturating math package for the 68K that always did
what was most reasonable.

0/0 = 0

n/0 = saturated max

big/little = saturated max

big+big = saturated max

It ran real-world control loops sensibly without crashing.

--

Anybody can count to one.

- Robert Widlar

Re: 0.0 / 0.0 = -NAN ?

<9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=95852&group=sci.electronics.design#95852

  copy link   Newsgroups: sci.electronics.design
X-Received: by 2002:ac8:5b51:0:b0:2f3:8654:53b2 with SMTP id n17-20020ac85b51000000b002f3865453b2mr4298004qtw.300.1651340851043;
Sat, 30 Apr 2022 10:47:31 -0700 (PDT)
X-Received: by 2002:a81:855:0:b0:2f8:9123:c97e with SMTP id
82-20020a810855000000b002f89123c97emr4768800ywi.343.1651340850774; Sat, 30
Apr 2022 10:47:30 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: sci.electronics.design
Date: Sat, 30 Apr 2022 10:47:30 -0700 (PDT)
In-Reply-To: <4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.138.223.107; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 24.138.223.107
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com> <4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com>
Subject: Re: 0.0 / 0.0 = -NAN ?
From: gnuarm.d...@gmail.com (Ricky)
Injection-Date: Sat, 30 Apr 2022 17:47:31 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 63
 by: Ricky - Sat, 30 Apr 2022 17:47 UTC

On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
> On Sat, 30 Apr 2022 08:31:47 -0700 (PDT), Skybuck Flying
> <skybuc...@gmail.com> wrote:
>
> >When exception masks are all enabled to stop the processor from throwing floating point exceptions the following calculation produces a somewhat strange result:
> >
> >0.0 / 0.0 = -nan
> >
> >(At least in Delphi).
> >
> >For now I will assume this is the case in C/C++ as well and with that I mean on x86/x64 which should and seems to be following IEEE 754 floating-point format.
> >
> >I am a little bit surprised by this and I want/need to know more. Where is this defined that 0.0 / 0.0 should be -NAN ?!?
> >
> >Problem is with the code, example:
> >
> >T := 0;
> >D := 0.0 / 0.0;
> >P := T * D;
> >
> >This screws up P. instead of P being zero, P is now also -NAN ?!?
> >
> >I find this very strange but ok.
> >
> >I guess a simple solution could be to set D to 0 explicitly for this case, is there perhaps another solution ? Maybe some kind of mask or rounding mode so that additional branch is not necessary ???
> >
> >Bye for now,
> >Skybuck.
> I wrote an s32.32 saturating math package for the 68K that always did
> what was most reasonable.
>
> 0/0 = 0

I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.

If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?

That is exactly why anything divided by zero is NAN in a good math package. If you want to produce a result for 0/0, then that should be hard coded with clear documentation of what is being done and why it is acceptable.

The rationale that, "it works" means it works for the cases tested. Very sloppy indeed.

--

Rick C.

- Get 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209

Re: 0.0 / 0.0 = -NAN ?

<jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=95865&group=sci.electronics.design#95865

  copy link   Newsgroups: sci.electronics.design
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: leg...@nospam.magma.ca (legg)
Newsgroups: sci.electronics.design
Subject: Re: 0.0 / 0.0 = -NAN ?
Date: Sat, 30 Apr 2022 16:24:03 -0400
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com>
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com> <4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="be9f78f01cedfef5e32a102d5594b6e9";
logging-data="24978"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX190o9yyYo+CQrPLkNhtJGoE"
Cancel-Lock: sha1:qZEDDXUZ8kFva7rVdJ8d6+Yx/Ws=
X-Newsreader: Forte Agent 4.2/32.1118
 by: legg - Sat, 30 Apr 2022 20:24 UTC

On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
<gnuarm.deletethisbit@gmail.com> wrote:

>On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
>> On Sat, 30 Apr 2022 08:31:47 -0700 (PDT), Skybuck Flying
>> <skybuc...@gmail.com> wrote:
>>
>> >When exception masks are all enabled to stop the processor from throwing floating point exceptions the following calculation produces a somewhat strange result:
>> >
>> >0.0 / 0.0 = -nan
>> >
>> >(At least in Delphi).
>> >
>> >For now I will assume this is the case in C/C++ as well and with that I mean on x86/x64 which should and seems to be following IEEE 754 floating-point format.
>> >
>> >I am a little bit surprised by this and I want/need to know more. Where is this defined that 0.0 / 0.0 should be -NAN ?!?
>> >
>> >Problem is with the code, example:
>> >
>> >T := 0;
>> >D := 0.0 / 0.0;
>> >P := T * D;
>> >
>> >This screws up P. instead of P being zero, P is now also -NAN ?!?
>> >
>> >I find this very strange but ok.
>> >
>> >I guess a simple solution could be to set D to 0 explicitly for this case, is there perhaps another solution ? Maybe some kind of mask or rounding mode so that additional branch is not necessary ???
>> >
>> >Bye for now,
>> >Skybuck.
>> I wrote an s32.32 saturating math package for the 68K that always did
>> what was most reasonable.
>>
>> 0/0 = 0
>
>I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
>
>If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
>
>That is exactly why anything divided by zero is NAN in a good math package. If you want to produce a result for 0/0, then that should be hard coded with clear documentation of what is being done and why it is acceptable.
>
>The rationale that, "it works" means it works for the cases tested. Very sloppy indeed.

I would have expected 0/0=1 ie no rational difference.

RL

Re: 0.0 / 0.0 = -NAN ?

<t4lgop$1rc6$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=95919&group=sci.electronics.design#95919

  copy link   Newsgroups: sci.electronics.design
Path: i2pn2.org!i2pn.org!aioe.org!woWShB6DIQvlDBD7PkJe+g.user.46.165.242.75.POSTED!not-for-mail
From: '''newsp...@nonad.co.uk (Martin Brown)
Newsgroups: sci.electronics.design
Subject: Re: 0.0 / 0.0 = -NAN ?
Date: Sun, 1 May 2022 09:35:35 +0100
Organization: Aioe.org NNTP Server
Message-ID: <t4lgop$1rc6$1@gioia.aioe.org>
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com>
<4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com>
<9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com>
<jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="60806"; posting-host="woWShB6DIQvlDBD7PkJe+g.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: Martin Brown - Sun, 1 May 2022 08:35 UTC

On 30/04/2022 21:24, legg wrote:
> On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
> <gnuarm.deletethisbit@gmail.com> wrote:
>
>> On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
>>> On Sat, 30 Apr 2022 08:31:47 -0700 (PDT), Skybuck Flying
>>> <skybuc...@gmail.com> wrote:
>>>
>>>> When exception masks are all enabled to stop the processor from throwing floating point exceptions the following calculation produces a somewhat strange result:
>>>>
>>>> 0.0 / 0.0 = -nan
>>>>
>>>> (At least in Delphi).
>>>>
>>>> For now I will assume this is the case in C/C++ as well and with that I mean on x86/x64 which should and seems to be following IEEE 754 floating-point format.
>>>>
>>>> I am a little bit surprised by this and I want/need to know more. Where is this defined that 0.0 / 0.0 should be -NAN ?!?
>>>>
>>>> Problem is with the code, example:
>>>>
>>>> T := 0;
>>>> D := 0.0 / 0.0;
>>>> P := T * D;

TBH I'm surprised that this code will even compile!

Most Compilers these days will spot /0.0 a mile off at compile time.

Delphi might be sufficiently prehistoric not to. JPI M2 which underpins
it was quite a good compiler in its day but that was over 4 decades ago.

XDS M2 intended as a teaching compiler spots it but by default will
generate code that executes a hard division by zero trap at runtime. It
can be persuaded to warn on fatal errors that are detected at compile
time but the default is to let students suffer until they learn to RTFM.
It also does the same for using uninitialised variables.

>>>> This screws up P. instead of P being zero, P is now also -NAN ?!?
>>>>
>>>> I find this very strange but ok.
>>>>
>>>> I guess a simple solution could be to set D to 0 explicitly for this case, is there perhaps another solution ? Maybe some kind of mask or rounding mode so that additional branch is not necessary ???

You should always code defensively so that you get exactly the behaviour
that you want with edge cases. Dividing anything by zero is never good.
(and on modern architectures the first comparison test is almost free)
Speculative execution has changed the game somewhat.

You need to know exactly how the thing goes wrong when x=+0.

0/x is a qNaN
x/x is a qNaN
1/x is +infinity

Arguably what IEEE754 FP could have permitted is

0*qNaN = 0

That is usually true. Provided that you keep 0*Inf = Inf

>>> I wrote an s32.32 saturating math package for the 68K that always did
>>> what was most reasonable.
>>>
>>> 0/0 = 0

That isn't particularly reasonable.

>> I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
>>

0/0 = qNaN

Unless you know by other analytical means that it doesn't. eg

sinc(x) = sin(x)/x = 1 when x = 0

Is perfectly well defined analytically but not in IEEE754 FP math.

>> If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
>>
>> That is exactly why anything divided by zero is NAN in a good math package. If you want to produce a result for 0/0, then that should be hard coded with clear documentation of what is being done and why it is acceptable.
>>
>> The rationale that, "it works" means it works for the cases tested. Very sloppy indeed.
>
> I would have expected 0/0=1 ie no rational difference.

Still a bad idea although likely to work better than 0/0 = 0.

0/0 = qNaN

0*qNaN = 0

0*Inf = Inf

Incidentally I have noticed in some of my regression tests on compilers
that with even functions and all go faster stripes enabled +0.0 != -0.0

+0.0 is a true zero

But some compilers negate +0.0 to the smallest possible negative denorm.

I suspect someone at Mickeysoft doesn't understand twos compliment
numbers properly. It only shows up for me on a handful of test cases.

--
Regards,
Martin Brown

Re: 0.0 / 0.0 = -NAN ?

<196t6h9j8ejfg6dma4e3r78fv59pnl67vn@4ax.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=95935&group=sci.electronics.design#95935

  copy link   Newsgroups: sci.electronics.design
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 01 May 2022 09:29:32 -0500
From: jlar...@highlandsniptechnology.com
Newsgroups: sci.electronics.design
Subject: Re: 0.0 / 0.0 = -NAN ?
Date: Sun, 01 May 2022 07:29:30 -0700
Message-ID: <196t6h9j8ejfg6dma4e3r78fv59pnl67vn@4ax.com>
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com> <4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com> <jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com>
X-Newsreader: Forte Agent 3.1/32.783
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 60
X-Trace: sv3-DKQ7RnBNLqf0HGC3OGJxppDG7jDF23zK929TvQT/gBxJPN2Nn98WrObln7p7uV2Hzb+ONkYY8qMjiC8!h3gwyWpyciUOCq6s8RIK9sXtkB8PSCzAfhWjKWLSv+tiLMQhGYITxq/jgJAgWTnoFGsrCjoKTy2i!bTUO5Q==
X-Complaints-To: www.supernews.com/docs/abuse.html
X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 3678
 by: jlar...@highlandsniptechnology.com - Sun, 1 May 2022 14:29 UTC

On Sat, 30 Apr 2022 16:24:03 -0400, legg <legg@nospam.magma.ca> wrote:

>On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
><gnuarm.deletethisbit@gmail.com> wrote:
>
>>On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
>>> On Sat, 30 Apr 2022 08:31:47 -0700 (PDT), Skybuck Flying
>>> <skybuc...@gmail.com> wrote:
>>>
>>> >When exception masks are all enabled to stop the processor from throwing floating point exceptions the following calculation produces a somewhat strange result:
>>> >
>>> >0.0 / 0.0 = -nan
>>> >
>>> >(At least in Delphi).
>>> >
>>> >For now I will assume this is the case in C/C++ as well and with that I mean on x86/x64 which should and seems to be following IEEE 754 floating-point format.
>>> >
>>> >I am a little bit surprised by this and I want/need to know more. Where is this defined that 0.0 / 0.0 should be -NAN ?!?
>>> >
>>> >Problem is with the code, example:
>>> >
>>> >T := 0;
>>> >D := 0.0 / 0.0;
>>> >P := T * D;
>>> >
>>> >This screws up P. instead of P being zero, P is now also -NAN ?!?
>>> >
>>> >I find this very strange but ok.
>>> >
>>> >I guess a simple solution could be to set D to 0 explicitly for this case, is there perhaps another solution ? Maybe some kind of mask or rounding mode so that additional branch is not necessary ???
>>> >
>>> >Bye for now,
>>> >Skybuck.
>>> I wrote an s32.32 saturating math package for the 68K that always did
>>> what was most reasonable.
>>>
>>> 0/0 = 0
>>
>>I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
>>
>>If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
>>
>>That is exactly why anything divided by zero is NAN in a good math package. If you want to produce a result for 0/0, then that should be hard coded with clear documentation of what is being done and why it is acceptable.
>>
>>The rationale that, "it works" means it works for the cases tested. Very sloppy indeed.
>
>I would have expected 0/0=1 ie no rational difference.
>
>RL

0 is the safest heater power.

--

Anybody can count to one.

- Robert Widlar

Re: 0.0 / 0.0 = -NAN ?

<e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=95960&group=sci.electronics.design#95960

  copy link   Newsgroups: sci.electronics.design
X-Received: by 2002:a05:620a:2683:b0:69c:8c9c:5f80 with SMTP id c3-20020a05620a268300b0069c8c9c5f80mr7289773qkp.367.1651462053867;
Sun, 01 May 2022 20:27:33 -0700 (PDT)
X-Received: by 2002:a25:35c5:0:b0:641:dab1:5ef9 with SMTP id
c188-20020a2535c5000000b00641dab15ef9mr9219864yba.396.1651462053671; Sun, 01
May 2022 20:27:33 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: sci.electronics.design
Date: Sun, 1 May 2022 20:27:33 -0700 (PDT)
In-Reply-To: <jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com>
Injection-Info: google-groups.googlegroups.com; posting-host=209.221.140.126; posting-account=vKQm_QoAAADOaDCYsqOFDAW8NJ8sFHoE
NNTP-Posting-Host: 209.221.140.126
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com>
<4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com>
<jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com>
Subject: Re: 0.0 / 0.0 = -NAN ?
From: whit...@gmail.com (whit3rd)
Injection-Date: Mon, 02 May 2022 03:27:33 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 27
 by: whit3rd - Mon, 2 May 2022 03:27 UTC

On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:
> On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
> <gnuarm.del...@gmail.com> wrote:
>
> >On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:

> >> I wrote an s32.32 saturating math package for the 68K that always did
> >> what was most reasonable.
> >>
> >> 0/0 = 0
> >
> >I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
> >
> >If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?

> I would have expected 0/0=1 ie no rational difference.

That's the case if you consider lim x/x as x approaches zero. But,
what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
best way to get a thinking human to understanding what the computer
is trying to express.

Re: 0.0 / 0.0 = -NAN ?

<lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96004&group=sci.electronics.design#96004

  copy link   Newsgroups: sci.electronics.design
Path: i2pn2.org!rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 02 May 2022 09:10:37 -0500
From: jlar...@highlandsniptechnology.com
Newsgroups: sci.electronics.design
Subject: Re: 0.0 / 0.0 = -NAN ?
Date: Mon, 02 May 2022 07:10:34 -0700
Message-ID: <lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com>
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com> <4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com> <jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com> <e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com>
X-Newsreader: Forte Agent 3.1/32.783
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 36
X-Trace: sv3-UZcf5GUmSdu5fmvF7OeSbzVRWCEYtgyUBLn6B4+F75dCzEq2ffysol2GT6wA+SjFSam3gQiPIY/HlDV!quVtcvuJpLq3nF3kkul56trHG8IUAZoAsIOI4UvkjjDUp+Kp5SbKs/oVdeVvsWP+LOeTIG25qJx8!29tFLA==
X-Complaints-To: www.supernews.com/docs/abuse.html
X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2626
 by: jlar...@highlandsniptechnology.com - Mon, 2 May 2022 14:10 UTC

On Sun, 1 May 2022 20:27:33 -0700 (PDT), whit3rd <whit3rd@gmail.com>
wrote:

>On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:
>> On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
>> <gnuarm.del...@gmail.com> wrote:
>>
>> >On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
>
>> >> I wrote an s32.32 saturating math package for the 68K that always did
>> >> what was most reasonable.
>> >>
>> >> 0/0 = 0
>> >
>> >I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
>> >
>> >If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
>
>> I would have expected 0/0=1 ie no rational difference.
>
>That's the case if you consider lim x/x as x approaches zero. But,
>what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
>best way to get a thinking human to understanding what the computer
>is trying to express.

What does a control system do when the heater voltage is computed to
be NAN?

--

Anybody can count to one.

- Robert Widlar

Re: 0.0 / 0.0 = -NAN ?

<t4opqv$1fvg$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96005&group=sci.electronics.design#96005

  copy link   Newsgroups: sci.electronics.design
Path: i2pn2.org!rocksolid2!i2pn.org!aioe.org!woWShB6DIQvlDBD7PkJe+g.user.46.165.242.75.POSTED!not-for-mail
From: '''newsp...@nonad.co.uk (Martin Brown)
Newsgroups: sci.electronics.design
Subject: Re: 0.0 / 0.0 = -NAN ?
Date: Mon, 2 May 2022 15:28:46 +0100
Organization: Aioe.org NNTP Server
Message-ID: <t4opqv$1fvg$1@gioia.aioe.org>
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com>
<4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com>
<9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com>
<jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com>
<e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com>
<lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="49136"; posting-host="woWShB6DIQvlDBD7PkJe+g.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: Martin Brown - Mon, 2 May 2022 14:28 UTC

On 02/05/2022 15:10, jlarkin@highlandsniptechnology.com wrote:
> On Sun, 1 May 2022 20:27:33 -0700 (PDT), whit3rd <whit3rd@gmail.com>
> wrote:
>
>> On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:
>>> On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
>>> <gnuarm.del...@gmail.com> wrote:
>>>
>>>> On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
>>
>>>>> I wrote an s32.32 saturating math package for the 68K that always did
>>>>> what was most reasonable.
>>>>>
>>>>> 0/0 = 0
>>>>
>>>> I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
>>>>
>>>> If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
>>
>>> I would have expected 0/0=1 ie no rational difference.
>>
>> That's the case if you consider lim x/x as x approaches zero. But,
>> what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
>> best way to get a thinking human to understanding what the computer
>> is trying to express.
>
> What does a control system do when the heater voltage is computed to
> be NAN?

Shut down. The situation should never arise if you have scaled the
problem correctly and you should never be dividing by zero anyway.

If the denominator of a division is zero then you haven't thought out
the representation of your problem correctly. Testing for zero is
usually quick (and often implicitly available in integer arithmetic).

--
Regards,
Martin Brown

Re: 0.0 / 0.0 = -NAN ?

<ovsv6hl5r8d08uieiqkltbggvc95574c2a@4ax.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96006&group=sci.electronics.design#96006

  copy link   Newsgroups: sci.electronics.design
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 02 May 2022 10:14:37 -0500
From: jlar...@highlandsniptechnology.com
Newsgroups: sci.electronics.design
Subject: Re: 0.0 / 0.0 = -NAN ?
Date: Mon, 02 May 2022 08:14:35 -0700
Message-ID: <ovsv6hl5r8d08uieiqkltbggvc95574c2a@4ax.com>
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com> <4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com> <jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com> <e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com> <lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com> <t4opqv$1fvg$1@gioia.aioe.org>
X-Newsreader: Forte Agent 3.1/32.783
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 58
X-Trace: sv3-GyBEF6oXSRnZneIdBSddx3/3Q/VYUJ5nItVUAhEtMYaH7Pobu7qtYqWgk3IO2uSCQMKh11qcOOr5Inz!jY/qRmBbCLtBg6MO+jwfe5QjukK0VNIeS9b/inI2KbljHLWJ8WNY7CJHs6E7HRkvo2goXkK+Vi04!U+FZug==
X-Complaints-To: www.supernews.com/docs/abuse.html
X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 3688
 by: jlar...@highlandsniptechnology.com - Mon, 2 May 2022 15:14 UTC

On Mon, 2 May 2022 15:28:46 +0100, Martin Brown
<'''newspam'''@nonad.co.uk> wrote:

>On 02/05/2022 15:10, jlarkin@highlandsniptechnology.com wrote:
>> On Sun, 1 May 2022 20:27:33 -0700 (PDT), whit3rd <whit3rd@gmail.com>
>> wrote:
>>
>>> On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:
>>>> On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
>>>> <gnuarm.del...@gmail.com> wrote:
>>>>
>>>>> On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
>>>
>>>>>> I wrote an s32.32 saturating math package for the 68K that always did
>>>>>> what was most reasonable.
>>>>>>
>>>>>> 0/0 = 0
>>>>>
>>>>> I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
>>>>>
>>>>> If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
>>>
>>>> I would have expected 0/0=1 ie no rational difference.
>>>
>>> That's the case if you consider lim x/x as x approaches zero. But,
>>> what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
>>> best way to get a thinking human to understanding what the computer
>>> is trying to express.
>>
>> What does a control system do when the heater voltage is computed to
>> be NAN?
>
>Shut down. The situation should never arise if you have scaled the
>problem correctly and you should never be dividing by zero anyway.

Most ADCs can output zero. It's convenient to have a math package that
usually outputs a reasonable number, which reduces the number of tests
that you have to do.

My NMR temperature controllers drove the heaters PWM from rectified
unregulated DC. I measured the DC supply voltage and computed the PWM
such as to correct for line voltage fluctuations. An exception-free
math package helped.

Opamps never output NAV!

>
>If the denominator of a division is zero then you haven't thought out
>the representation of your problem correctly. Testing for zero is
>usually quick (and often implicitly available in integer arithmetic).

--

Anybody can count to one.

- Robert Widlar

Re: 0.0 / 0.0 = -NAN ?

<m7uv6ht5llvjffrcmfk5pau8erlnnrenaf@4ax.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96008&group=sci.electronics.design#96008

  copy link   Newsgroups: sci.electronics.design
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 02 May 2022 10:54:41 -0500
From: joegw...@comcast.net (Joe Gwinn)
Newsgroups: sci.electronics.design
Subject: Re: 0.0 / 0.0 = -NAN ?
Date: Mon, 02 May 2022 11:54:32 -0400
Message-ID: <m7uv6ht5llvjffrcmfk5pau8erlnnrenaf@4ax.com>
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com> <4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com> <jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com> <e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com> <lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com> <t4opqv$1fvg$1@gioia.aioe.org>
User-Agent: ForteAgent/8.00.32.1272
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 66
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-npP9LD2oAhIQjdZ/Hipb7oHLzRjyomJUw+Hx7jOhYMgeoP0MHBGSex94ZtQhOEmwAScELjfbF33JqoX!CAlx4l6nrX7knJzlD7DZZz/Y3npJjjiG/d/BtZH/tQipWcski3AS/TjEfdORmGdQWTY4aGI=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 4476
 by: Joe Gwinn - Mon, 2 May 2022 15:54 UTC

On Mon, 2 May 2022 15:28:46 +0100, Martin Brown
<'''newspam'''@nonad.co.uk> wrote:

>On 02/05/2022 15:10, jlarkin@highlandsniptechnology.com wrote:
>> On Sun, 1 May 2022 20:27:33 -0700 (PDT), whit3rd <whit3rd@gmail.com>
>> wrote:
>>
>>> On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:
>>>> On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
>>>> <gnuarm.del...@gmail.com> wrote:
>>>>
>>>>> On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
>>>
>>>>>> I wrote an s32.32 saturating math package for the 68K that always did
>>>>>> what was most reasonable.
>>>>>>
>>>>>> 0/0 = 0
>>>>>
>>>>> I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
>>>>>
>>>>> If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
>>>
>>>> I would have expected 0/0=1 ie no rational difference.
>>>
>>> That's the case if you consider lim x/x as x approaches zero. But,
>>> what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
>>> best way to get a thinking human to understanding what the computer
>>> is trying to express.
>>
>> What does a control system do when the heater voltage is computed to
>> be NAN?
>
>Shut down. The situation should never arise if you have scaled the
>problem correctly and you should never be dividing by zero anyway.
>
>If the denominator of a division is zero then you haven't thought out
>the representation of your problem correctly. Testing for zero is
>usually quick (and often implicitly available in integer arithmetic).

Umm. Testing for zero doesn't necessarily change anything.

I have a war story here. Many decades ago, I was the software
architect for the mission software of a ship self defense system that
shoots incoming cruise missiles down, if it can. From detection at
the horizon to impact on ownship is maybe twenty seconds.

One fine day, a mob of software engineers turned up, locked in
argument about what to do if the engageability calculation suffered a
divide-by-zero exception.

This is not a coding error per se, it's a mathematical singularity in
the equations - some engagement geometries will hit the singularity,
and the embedded realtime computers of that day could not handle the
more complicated math needed to avoid such things fast enough to
matter.

There were two schools: Just provide a very large number and proceed,
praying. Stop and print out a bunch of diagnostic information.

Hmm. So the user, an ordinary sailor operating the self-defense
system is in the middle of an engagement with an incoming cruise
missile, and is suddenly handed a bunch or error messages, with less
than twenty seconds to live ... Really??? No! Just silently return
the best answer possible given the situation and press on, praying.

Joe Gwinn

Re: 0.0 / 0.0 = -NAN ?

<0aae20de-b6d1-497f-98c2-3136ec6113bfn@googlegroups.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96009&group=sci.electronics.design#96009

  copy link   Newsgroups: sci.electronics.design
X-Received: by 2002:a05:620a:461f:b0:69f:6a78:f1fd with SMTP id br31-20020a05620a461f00b0069f6a78f1fdmr8994448qkb.53.1651507537702;
Mon, 02 May 2022 09:05:37 -0700 (PDT)
X-Received: by 2002:a81:1051:0:b0:2f7:e466:fcd0 with SMTP id
78-20020a811051000000b002f7e466fcd0mr11487872ywq.294.1651507537532; Mon, 02
May 2022 09:05:37 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: sci.electronics.design
Date: Mon, 2 May 2022 09:05:37 -0700 (PDT)
In-Reply-To: <m7uv6ht5llvjffrcmfk5pau8erlnnrenaf@4ax.com>
Injection-Info: google-groups.googlegroups.com; posting-host=94.145.246.173; posting-account=mW5JKwkAAAAMyuWOVeLp8yffyAkVx0g7
NNTP-Posting-Host: 94.145.246.173
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com>
<4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com>
<jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com> <e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com>
<lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com> <t4opqv$1fvg$1@gioia.aioe.org> <m7uv6ht5llvjffrcmfk5pau8erlnnrenaf@4ax.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0aae20de-b6d1-497f-98c2-3136ec6113bfn@googlegroups.com>
Subject: Re: 0.0 / 0.0 = -NAN ?
From: langw...@fonz.dk (Lasse Langwadt Christensen)
Injection-Date: Mon, 02 May 2022 16:05:37 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 75
 by: Lasse Langwadt Chris - Mon, 2 May 2022 16:05 UTC

mandag den 2. maj 2022 kl. 17.54.53 UTC+2 skrev Joe Gwinn:
> On Mon, 2 May 2022 15:28:46 +0100, Martin Brown
> <'''newspam'''@nonad.co.uk> wrote:
> >On 02/05/2022 15:10, jla...@highlandsniptechnology.com wrote:
> >> On Sun, 1 May 2022 20:27:33 -0700 (PDT), whit3rd <whi...@gmail.com>
> >> wrote:
> >>
> >>> On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:
> >>>> On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
> >>>> <gnuarm.del...@gmail.com> wrote:
> >>>>
> >>>>> On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
> >>>
> >>>>>> I wrote an s32.32 saturating math package for the 68K that always did
> >>>>>> what was most reasonable.
> >>>>>>
> >>>>>> 0/0 = 0
> >>>>>
> >>>>> I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
> >>>>>
> >>>>> If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
> >>>
> >>>> I would have expected 0/0=1 ie no rational difference.
> >>>
> >>> That's the case if you consider lim x/x as x approaches zero. But,
> >>> what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
> >>> best way to get a thinking human to understanding what the computer
> >>> is trying to express.
> >>
> >> What does a control system do when the heater voltage is computed to
> >> be NAN?
> >
> >Shut down. The situation should never arise if you have scaled the
> >problem correctly and you should never be dividing by zero anyway.
> >
> >If the denominator of a division is zero then you haven't thought out
> >the representation of your problem correctly. Testing for zero is
> >usually quick (and often implicitly available in integer arithmetic).
> Umm. Testing for zero doesn't necessarily change anything.
>
> I have a war story here. Many decades ago, I was the software
> architect for the mission software of a ship self defense system that
> shoots incoming cruise missiles down, if it can. From detection at
> the horizon to impact on ownship is maybe twenty seconds.
>
> One fine day, a mob of software engineers turned up, locked in
> argument about what to do if the engageability calculation suffered a
> divide-by-zero exception.
>
> This is not a coding error per se, it's a mathematical singularity in
> the equations - some engagement geometries will hit the singularity,
> and the embedded realtime computers of that day could not handle the
> more complicated math needed to avoid such things fast enough to
> matter.
>
> There were two schools: Just provide a very large number and proceed,
> praying. Stop and print out a bunch of diagnostic information.
>
> Hmm. So the user, an ordinary sailor operating the self-defense
> system is in the middle of an engagement with an incoming cruise
> missile, and is suddenly handed a bunch or error messages, with less
> than twenty seconds to live ... Really??? No! Just silently return
> the best answer possible given the situation and press on, praying.

sorta like: https://en.wikipedia.org/wiki/Battleshort

Re: 0.0 / 0.0 = -NAN ?

<2n307hpqm249t01v5akn18r70rh8q6m6km@4ax.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96018&group=sci.electronics.design#96018

  copy link   Newsgroups: sci.electronics.design
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 02 May 2022 12:04:22 -0500
From: jlar...@highland_atwork_technology.com (John Larkin)
Newsgroups: sci.electronics.design
Subject: Re: 0.0 / 0.0 = -NAN ?
Date: Mon, 02 May 2022 10:04:21 -0700
Organization: Highland Tech
Reply-To: xx@yy.com
Message-ID: <2n307hpqm249t01v5akn18r70rh8q6m6km@4ax.com>
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com> <4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com> <jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com> <e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com> <lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com> <t4opqv$1fvg$1@gioia.aioe.org> <m7uv6ht5llvjffrcmfk5pau8erlnnrenaf@4ax.com>
X-Newsreader: Forte Agent 3.1/32.783
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 77
X-Trace: sv3-8CTuWV/sky+E9YoHkLe5jxM1BEc6DCfziBRRBeLY9hE/JJ2sc4ce0hxGTVwZfQta+G2TUhXjlJf3QTi!U1IL/Llt+lD+X5yndru69JW8iVd9D+XqtPanuC8AfMpmrce/rot84dMihOQl/OnW4yjl2qjgNyAW!eF+siA==
X-Complaints-To: www.supernews.com/docs/abuse.html
X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 4970
 by: John Larkin - Mon, 2 May 2022 17:04 UTC

On Mon, 02 May 2022 11:54:32 -0400, Joe Gwinn <joegwinn@comcast.net>
wrote:

>On Mon, 2 May 2022 15:28:46 +0100, Martin Brown
><'''newspam'''@nonad.co.uk> wrote:
>
>>On 02/05/2022 15:10, jlarkin@highlandsniptechnology.com wrote:
>>> On Sun, 1 May 2022 20:27:33 -0700 (PDT), whit3rd <whit3rd@gmail.com>
>>> wrote:
>>>
>>>> On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:
>>>>> On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
>>>>> <gnuarm.del...@gmail.com> wrote:
>>>>>
>>>>>> On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
>>>>
>>>>>>> I wrote an s32.32 saturating math package for the 68K that always did
>>>>>>> what was most reasonable.
>>>>>>>
>>>>>>> 0/0 = 0
>>>>>>
>>>>>> I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
>>>>>>
>>>>>> If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
>>>>
>>>>> I would have expected 0/0=1 ie no rational difference.
>>>>
>>>> That's the case if you consider lim x/x as x approaches zero. But,
>>>> what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
>>>> best way to get a thinking human to understanding what the computer
>>>> is trying to express.
>>>
>>> What does a control system do when the heater voltage is computed to
>>> be NAN?
>>
>>Shut down. The situation should never arise if you have scaled the
>>problem correctly and you should never be dividing by zero anyway.
>>
>>If the denominator of a division is zero then you haven't thought out
>>the representation of your problem correctly. Testing for zero is
>>usually quick (and often implicitly available in integer arithmetic).
>
>Umm. Testing for zero doesn't necessarily change anything.
>
>I have a war story here. Many decades ago, I was the software
>architect for the mission software of a ship self defense system that
>shoots incoming cruise missiles down, if it can. From detection at
>the horizon to impact on ownship is maybe twenty seconds.
>
>One fine day, a mob of software engineers turned up, locked in
>argument about what to do if the engageability calculation suffered a
>divide-by-zero exception.
>
>This is not a coding error per se, it's a mathematical singularity in
>the equations - some engagement geometries will hit the singularity,
>and the embedded realtime computers of that day could not handle the
>more complicated math needed to avoid such things fast enough to
>matter.
>
>There were two schools: Just provide a very large number and proceed,
>praying. Stop and print out a bunch of diagnostic information.
>
>Hmm. So the user, an ordinary sailor operating the self-defense
>system is in the middle of an engagement with an incoming cruise
>missile, and is suddenly handed a bunch or error messages, with less
>than twenty seconds to live ... Really??? No! Just silently return
>the best answer possible given the situation and press on, praying.
>
>Joe Gwinn

Yes. A best guess is better than an exception trap. Or a crash.

--

If a man will begin with certainties, he shall end with doubts,
but if he will be content to begin with doubts he shall end in certainties.
Francis Bacon

Re: 0.0 / 0.0 = -NAN ?

<gp307hpk20vuoveqa7mjphn1mv26vcthcc@4ax.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96019&group=sci.electronics.design#96019

  copy link   Newsgroups: sci.electronics.design
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 02 May 2022 12:06:57 -0500
From: joegw...@comcast.net (Joe Gwinn)
Newsgroups: sci.electronics.design
Subject: Re: 0.0 / 0.0 = -NAN ?
Date: Mon, 02 May 2022 13:06:57 -0400
Message-ID: <gp307hpk20vuoveqa7mjphn1mv26vcthcc@4ax.com>
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com> <4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com> <jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com> <e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com> <lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com> <t4opqv$1fvg$1@gioia.aioe.org> <m7uv6ht5llvjffrcmfk5pau8erlnnrenaf@4ax.com> <0aae20de-b6d1-497f-98c2-3136ec6113bfn@googlegroups.com>
User-Agent: ForteAgent/8.00.32.1272
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 75
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-pxcrrJ1SG4H+KZTe8dGC0jjgfkQ49cjigdKiAYRm2jebP3PWMYQ8KqcQb4zugr9BVI3MiS8AI4PMt3K!D/c2qcfp7LYYKS23WcBzopd1jR7rnXL3qQ+VZilh8YHgc8UbwNRlfYZVvELosU8MMdF2MqI=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 5158
 by: Joe Gwinn - Mon, 2 May 2022 17:06 UTC

On Mon, 2 May 2022 09:05:37 -0700 (PDT), Lasse Langwadt Christensen
<langwadt@fonz.dk> wrote:

>mandag den 2. maj 2022 kl. 17.54.53 UTC+2 skrev Joe Gwinn:
>> On Mon, 2 May 2022 15:28:46 +0100, Martin Brown
>> <'''newspam'''@nonad.co.uk> wrote:
>> >On 02/05/2022 15:10, jla...@highlandsniptechnology.com wrote:
>> >> On Sun, 1 May 2022 20:27:33 -0700 (PDT), whit3rd <whi...@gmail.com>
>> >> wrote:
>> >>
>> >>> On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:
>> >>>> On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
>> >>>> <gnuarm.del...@gmail.com> wrote:
>> >>>>
>> >>>>> On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
>> >>>
>> >>>>>> I wrote an s32.32 saturating math package for the 68K that always did
>> >>>>>> what was most reasonable.
>> >>>>>>
>> >>>>>> 0/0 = 0
>> >>>>>
>> >>>>> I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
>> >>>>>
>> >>>>> If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
>> >>>
>> >>>> I would have expected 0/0=1 ie no rational difference.
>> >>>
>> >>> That's the case if you consider lim x/x as x approaches zero. But,
>> >>> what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
>> >>> best way to get a thinking human to understanding what the computer
>> >>> is trying to express.
>> >>
>> >> What does a control system do when the heater voltage is computed to
>> >> be NAN?
>> >
>> >Shut down. The situation should never arise if you have scaled the
>> >problem correctly and you should never be dividing by zero anyway.
>> >
>> >If the denominator of a division is zero then you haven't thought out
>> >the representation of your problem correctly. Testing for zero is
>> >usually quick (and often implicitly available in integer arithmetic).
>> Umm. Testing for zero doesn't necessarily change anything.
>>
>> I have a war story here. Many decades ago, I was the software
>> architect for the mission software of a ship self defense system that
>> shoots incoming cruise missiles down, if it can. From detection at
>> the horizon to impact on ownship is maybe twenty seconds.
>>
>> One fine day, a mob of software engineers turned up, locked in
>> argument about what to do if the engageability calculation suffered a
>> divide-by-zero exception.
>>
>> This is not a coding error per se, it's a mathematical singularity in
>> the equations - some engagement geometries will hit the singularity,
>> and the embedded realtime computers of that day could not handle the
>> more complicated math needed to avoid such things fast enough to
>> matter.
>>
>> There were two schools: Just provide a very large number and proceed,
>> praying. Stop and print out a bunch of diagnostic information.
>>
>> Hmm. So the user, an ordinary sailor operating the self-defense
>> system is in the middle of an engagement with an incoming cruise
>> missile, and is suddenly handed a bunch or error messages, with less
>> than twenty seconds to live ... Really??? No! Just silently return
>> the best answer possible given the situation and press on, praying.
>
>sorta like: <https://en.wikipedia.org/wiki/Battleshort>

Yes, same kind of thinking.

With software taking the world over battleshort is often an operating
mode, not necessarily a bit of hardware.

Joe Gwinn

Re: 0.0 / 0.0 = -NAN ?

<69bc07a9-7ea3-4478-b704-6a7d66773939n@googlegroups.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96026&group=sci.electronics.design#96026

  copy link   Newsgroups: sci.electronics.design
X-Received: by 2002:a0c:d7cb:0:b0:444:2b27:80d3 with SMTP id g11-20020a0cd7cb000000b004442b2780d3mr10607669qvj.57.1651519258182;
Mon, 02 May 2022 12:20:58 -0700 (PDT)
X-Received: by 2002:a81:802:0:b0:2f7:cd12:9d53 with SMTP id
2-20020a810802000000b002f7cd129d53mr12014620ywi.197.1651519257996; Mon, 02
May 2022 12:20:57 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: sci.electronics.design
Date: Mon, 2 May 2022 12:20:57 -0700 (PDT)
In-Reply-To: <lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com>
Injection-Info: google-groups.googlegroups.com; posting-host=209.221.140.126; posting-account=vKQm_QoAAADOaDCYsqOFDAW8NJ8sFHoE
NNTP-Posting-Host: 209.221.140.126
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com>
<4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com>
<jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com> <e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com>
<lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <69bc07a9-7ea3-4478-b704-6a7d66773939n@googlegroups.com>
Subject: Re: 0.0 / 0.0 = -NAN ?
From: whit...@gmail.com (whit3rd)
Injection-Date: Mon, 02 May 2022 19:20:58 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 24
 by: whit3rd - Mon, 2 May 2022 19:20 UTC

On Monday, May 2, 2022 at 7:10:49 AM UTC-7, jla...@highlandsniptechnology.com wrote:
> On Sun, 1 May 2022 20:27:33 -0700 (PDT), whit3rd <whi...@gmail.com>
> wrote:
>
> >On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:

> >> I would have expected 0/0=1 ie no rational difference.
> >
> >That's the case if you consider lim x/x as x approaches zero. But,
> >what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
> >best way to get a thinking human to understanding what the computer
> >is trying to express.

> What does a control system do when the heater voltage is computed to
> be NAN?

The program writer decides. In general, switch from plan A computation of
intended heater voltage, to plan B.

The program ought to handle these cases in a way that is appropriate,
even if it is exceptional.

For a gas flame heater, you call the repairman when no amount of
ignition power is enough. For a car, you see an 'engine' light come on,
and drive (or tow) to a repair shop.

Re: 0.0 / 0.0 = -NAN ?

<4kd07hdb036slsf5o7ok6lnvpa2ngvllbs@4ax.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96029&group=sci.electronics.design#96029

  copy link   Newsgroups: sci.electronics.design
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 02 May 2022 14:53:47 -0500
From: jlar...@highland_atwork_technology.com (John Larkin)
Newsgroups: sci.electronics.design
Subject: Re: 0.0 / 0.0 = -NAN ?
Date: Mon, 02 May 2022 12:53:47 -0700
Organization: Highland Tech
Reply-To: xx@yy.com
Message-ID: <4kd07hdb036slsf5o7ok6lnvpa2ngvllbs@4ax.com>
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com> <4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com> <jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com> <e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com> <lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com> <69bc07a9-7ea3-4478-b704-6a7d66773939n@googlegroups.com>
X-Newsreader: Forte Agent 3.1/32.783
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 37
X-Trace: sv3-ysBrJ+6jeJvx4QbKYHZg5XRzsVf/GrsuDiAEng64AVEpbmgHz5Cl5ms9zNbognnE6CUQW74ZhDkb09v!5xMPbnHrH9/FNcMpFMKWU9kxXYA4p/c/dSy2Ipp7XI1x9PvB+v70LVipIOYX275iavWfxJpIblxO!PCOeUg==
X-Complaints-To: www.supernews.com/docs/abuse.html
X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2809
 by: John Larkin - Mon, 2 May 2022 19:53 UTC

On Mon, 2 May 2022 12:20:57 -0700 (PDT), whit3rd <whit3rd@gmail.com>
wrote:

>On Monday, May 2, 2022 at 7:10:49 AM UTC-7, jla...@highlandsniptechnology.com wrote:
>> On Sun, 1 May 2022 20:27:33 -0700 (PDT), whit3rd <whi...@gmail.com>
>> wrote:
>>
>> >On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:
>
>> >> I would have expected 0/0=1 ie no rational difference.
>> >
>> >That's the case if you consider lim x/x as x approaches zero. But,
>> >what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
>> >best way to get a thinking human to understanding what the computer
>> >is trying to express.
>
>> What does a control system do when the heater voltage is computed to
>> be NAN?
>
>The program writer decides. In general, switch from plan A computation of
>intended heater voltage, to plan B.
>
>The program ought to handle these cases in a way that is appropriate,
>even if it is exceptional.
>
>For a gas flame heater, you call the repairman when no amount of
>ignition power is enough. For a car, you see an 'engine' light come on,
>and drive (or tow) to a repair shop.

For NMR, you don't want to damage a $100K probe or a million dollar
magnet.

--

If a man will begin with certainties, he shall end with doubts,
but if he will be content to begin with doubts he shall end in certainties.
Francis Bacon

Re: 0.0 / 0.0 = -NAN ?

<90fb097e-85f0-4ca6-be35-b471d6498b32n@googlegroups.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96032&group=sci.electronics.design#96032

  copy link   Newsgroups: sci.electronics.design
X-Received: by 2002:a05:622a:134d:b0:2f3:ac46:28c with SMTP id w13-20020a05622a134d00b002f3ac46028cmr2519734qtk.342.1651524113113;
Mon, 02 May 2022 13:41:53 -0700 (PDT)
X-Received: by 2002:a25:d4c2:0:b0:649:5630:5fef with SMTP id
m185-20020a25d4c2000000b0064956305fefmr9170043ybf.631.1651524112691; Mon, 02
May 2022 13:41:52 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: sci.electronics.design
Date: Mon, 2 May 2022 13:41:52 -0700 (PDT)
In-Reply-To: <m7uv6ht5llvjffrcmfk5pau8erlnnrenaf@4ax.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.138.223.107; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 24.138.223.107
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com>
<4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com>
<jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com> <e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com>
<lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com> <t4opqv$1fvg$1@gioia.aioe.org> <m7uv6ht5llvjffrcmfk5pau8erlnnrenaf@4ax.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <90fb097e-85f0-4ca6-be35-b471d6498b32n@googlegroups.com>
Subject: Re: 0.0 / 0.0 = -NAN ?
From: gnuarm.d...@gmail.com (Ricky)
Injection-Date: Mon, 02 May 2022 20:41:53 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 84
 by: Ricky - Mon, 2 May 2022 20:41 UTC

On Monday, May 2, 2022 at 11:54:53 AM UTC-4, Joe Gwinn wrote:
> On Mon, 2 May 2022 15:28:46 +0100, Martin Brown
> <'''newspam'''@nonad.co.uk> wrote:
> >On 02/05/2022 15:10, jla...@highlandsniptechnology.com wrote:
> >> On Sun, 1 May 2022 20:27:33 -0700 (PDT), whit3rd <whi...@gmail.com>
> >> wrote:
> >>
> >>> On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:
> >>>> On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
> >>>> <gnuarm.del...@gmail.com> wrote:
> >>>>
> >>>>> On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
> >>>
> >>>>>> I wrote an s32.32 saturating math package for the 68K that always did
> >>>>>> what was most reasonable.
> >>>>>>
> >>>>>> 0/0 = 0
> >>>>>
> >>>>> I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
> >>>>>
> >>>>> If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
> >>>
> >>>> I would have expected 0/0=1 ie no rational difference.
> >>>
> >>> That's the case if you consider lim x/x as x approaches zero. But,
> >>> what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
> >>> best way to get a thinking human to understanding what the computer
> >>> is trying to express.
> >>
> >> What does a control system do when the heater voltage is computed to
> >> be NAN?
> >
> >Shut down. The situation should never arise if you have scaled the
> >problem correctly and you should never be dividing by zero anyway.
> >
> >If the denominator of a division is zero then you haven't thought out
> >the representation of your problem correctly. Testing for zero is
> >usually quick (and often implicitly available in integer arithmetic).
> Umm. Testing for zero doesn't necessarily change anything.
>
> I have a war story here. Many decades ago, I was the software
> architect for the mission software of a ship self defense system that
> shoots incoming cruise missiles down, if it can. From detection at
> the horizon to impact on ownship is maybe twenty seconds.
>
> One fine day, a mob of software engineers turned up, locked in
> argument about what to do if the engageability calculation suffered a
> divide-by-zero exception.
>
> This is not a coding error per se, it's a mathematical singularity in
> the equations - some engagement geometries will hit the singularity,
> and the embedded realtime computers of that day could not handle the
> more complicated math needed to avoid such things fast enough to
> matter.
>
> There were two schools: Just provide a very large number and proceed,
> praying. Stop and print out a bunch of diagnostic information.
>
> Hmm. So the user, an ordinary sailor operating the self-defense
> system is in the middle of an engagement with an incoming cruise
> missile, and is suddenly handed a bunch or error messages, with less
> than twenty seconds to live ... Really??? No! Just silently return
> the best answer possible given the situation and press on, praying.

Was this because they could not use quaternions? I've heard of 3D calculations that are problematic because of issues in the math. They solve that in 3 dimensional control by adding a forth coordinate, quaternions, but obviously more calculations.

--

Rick C.

+ Get 1,000 miles of free Supercharging
+ Tesla referral code - https://ts.la/richard11209

Re: 0.0 / 0.0 = -NAN ?

<7ee7fa19-4853-4d9d-9577-324a54b0daabn@googlegroups.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96033&group=sci.electronics.design#96033

  copy link   Newsgroups: sci.electronics.design
X-Received: by 2002:a37:7c8:0:b0:69f:c5f8:85a2 with SMTP id 191-20020a3707c8000000b0069fc5f885a2mr8585688qkh.662.1651524133359;
Mon, 02 May 2022 13:42:13 -0700 (PDT)
X-Received: by 2002:a05:6902:13c1:b0:613:74e6:a7a6 with SMTP id
y1-20020a05690213c100b0061374e6a7a6mr11201880ybu.141.1651524133172; Mon, 02
May 2022 13:42:13 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: sci.electronics.design
Date: Mon, 2 May 2022 13:42:12 -0700 (PDT)
In-Reply-To: <2n307hpqm249t01v5akn18r70rh8q6m6km@4ax.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.138.223.107; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 24.138.223.107
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com>
<4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com>
<jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com> <e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com>
<lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com> <t4opqv$1fvg$1@gioia.aioe.org>
<m7uv6ht5llvjffrcmfk5pau8erlnnrenaf@4ax.com> <2n307hpqm249t01v5akn18r70rh8q6m6km@4ax.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7ee7fa19-4853-4d9d-9577-324a54b0daabn@googlegroups.com>
Subject: Re: 0.0 / 0.0 = -NAN ?
From: gnuarm.d...@gmail.com (Ricky)
Injection-Date: Mon, 02 May 2022 20:42:13 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 99
 by: Ricky - Mon, 2 May 2022 20:42 UTC

On Monday, May 2, 2022 at 1:04:34 PM UTC-4, John Larkin wrote:
> On Mon, 02 May 2022 11:54:32 -0400, Joe Gwinn <joeg...@comcast.net>
> wrote:
> >On Mon, 2 May 2022 15:28:46 +0100, Martin Brown
> ><'''newspam'''@nonad.co.uk> wrote:
> >
> >>On 02/05/2022 15:10, jla...@highlandsniptechnology.com wrote:
> >>> On Sun, 1 May 2022 20:27:33 -0700 (PDT), whit3rd <whi...@gmail.com>
> >>> wrote:
> >>>
> >>>> On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:
> >>>>> On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
> >>>>> <gnuarm.del...@gmail.com> wrote:
> >>>>>
> >>>>>> On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
> >>>>
> >>>>>>> I wrote an s32.32 saturating math package for the 68K that always did
> >>>>>>> what was most reasonable.
> >>>>>>>
> >>>>>>> 0/0 = 0
> >>>>>>
> >>>>>> I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
> >>>>>>
> >>>>>> If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
> >>>>
> >>>>> I would have expected 0/0=1 ie no rational difference.
> >>>>
> >>>> That's the case if you consider lim x/x as x approaches zero. But,
> >>>> what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
> >>>> best way to get a thinking human to understanding what the computer
> >>>> is trying to express.
> >>>
> >>> What does a control system do when the heater voltage is computed to
> >>> be NAN?
> >>
> >>Shut down. The situation should never arise if you have scaled the
> >>problem correctly and you should never be dividing by zero anyway.
> >>
> >>If the denominator of a division is zero then you haven't thought out
> >>the representation of your problem correctly. Testing for zero is
> >>usually quick (and often implicitly available in integer arithmetic).
> >
> >Umm. Testing for zero doesn't necessarily change anything.
> >
> >I have a war story here. Many decades ago, I was the software
> >architect for the mission software of a ship self defense system that
> >shoots incoming cruise missiles down, if it can. From detection at
> >the horizon to impact on ownship is maybe twenty seconds.
> >
> >One fine day, a mob of software engineers turned up, locked in
> >argument about what to do if the engageability calculation suffered a
> >divide-by-zero exception.
> >
> >This is not a coding error per se, it's a mathematical singularity in
> >the equations - some engagement geometries will hit the singularity,
> >and the embedded realtime computers of that day could not handle the
> >more complicated math needed to avoid such things fast enough to
> >matter.
> >
> >There were two schools: Just provide a very large number and proceed,
> >praying. Stop and print out a bunch of diagnostic information.
> >
> >Hmm. So the user, an ordinary sailor operating the self-defense
> >system is in the middle of an engagement with an incoming cruise
> >missile, and is suddenly handed a bunch or error messages, with less
> >than twenty seconds to live ... Really??? No! Just silently return
> >the best answer possible given the situation and press on, praying.
> >
> >Joe Gwinn
> Yes. A best guess is better than an exception trap. Or a crash.

Or, you can code to handle such cases in a way that is logical, such as not dividing by zero in the first place. A "trap" is just the detection of the condition and implies nothing about how it is handled. So it is not inherently bad.

The crash is the sort of behavior that happens when the situation is ignored or handled poorly. Yeah, it's always better to not crash. That's a bit of a "Duh!"

--

Rick C.

-- Get 1,000 miles of free Supercharging
-- Tesla referral code - https://ts.la/richard11209

Re: 0.0 / 0.0 = -NAN ?

<31cd75e7-2c72-6923-1c33-dde5e74f13e7@electrooptical.net>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96036&group=sci.electronics.design#96036

  copy link   Newsgroups: sci.electronics.design
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 02 May 2022 15:52:35 -0500
Subject: Re: 0.0 / 0.0 = -NAN ?
Newsgroups: sci.electronics.design
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com>
<4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com>
<9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com>
<jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com>
<e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com>
<lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com>
From: pcdhSpam...@electrooptical.net (Phil Hobbs)
Message-ID: <31cd75e7-2c72-6923-1c33-dde5e74f13e7@electrooptical.net>
Date: Mon, 2 May 2022 16:52:35 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.0
MIME-Version: 1.0
In-Reply-To: <lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 45
X-Trace: sv3-I0tcJk0b+zJWQevrfxZEjmnEcnUopRWNxUS32rd1F58dr0cFJAjU2dKnVxmVijGSXjUl5fO6wZROuyM!x6M4Vihwta8+rmiUhimx5wHHZI0k0Z7tB9J0kPq1Fn8RhrcKQIJ4c84DLWc2aPME9nGWxKhiplBc!WHTo0l+FzHC9/eOGiwlGxQ==
X-Complaints-To: www.supernews.com/docs/abuse.html
X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 3175
 by: Phil Hobbs - Mon, 2 May 2022 20:52 UTC

jlarkin@highlandsniptechnology.com wrote:
> On Sun, 1 May 2022 20:27:33 -0700 (PDT), whit3rd <whit3rd@gmail.com>
> wrote:
>
>> On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:
>>> On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
>>> <gnuarm.del...@gmail.com> wrote:
>>>
>>>> On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
>>
>>>>> I wrote an s32.32 saturating math package for the 68K that always did
>>>>> what was most reasonable.
>>>>>
>>>>> 0/0 = 0
>>>>
>>>> I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
>>>>
>>>> If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
>>
>>> I would have expected 0/0=1 ie no rational difference.
>>
>> That's the case if you consider lim x/x as x approaches zero. But,
>> what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
>> best way to get a thinking human to understanding what the computer
>> is trying to express.
>
> What does a control system do when the heater voltage is computed to
> be NAN?

Log it, skip the update, and press on to the next measurement.

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs
Principal Consultant
ElectroOptical Innovations LLC / Hobbs ElectroOptics
Optics, Electro-optics, Photonics, Analog Electronics
Briarcliff Manor NY 10510

http://electrooptical.net
http://hobbs-eo.com

Re: 0.0 / 0.0 = -NAN ?

<be9971b0-243c-44bf-8cc9-a50d19905af8n@googlegroups.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96037&group=sci.electronics.design#96037

  copy link   Newsgroups: sci.electronics.design
X-Received: by 2002:a05:620a:2a14:b0:69f:fc99:48de with SMTP id o20-20020a05620a2a1400b0069ffc9948demr1071234qkp.604.1651525338275;
Mon, 02 May 2022 14:02:18 -0700 (PDT)
X-Received: by 2002:a81:6d14:0:b0:2f7:c9d2:d596 with SMTP id
i20-20020a816d14000000b002f7c9d2d596mr12630994ywc.240.1651525338062; Mon, 02
May 2022 14:02:18 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: sci.electronics.design
Date: Mon, 2 May 2022 14:02:17 -0700 (PDT)
In-Reply-To: <31cd75e7-2c72-6923-1c33-dde5e74f13e7@electrooptical.net>
Injection-Info: google-groups.googlegroups.com; posting-host=94.145.246.173; posting-account=mW5JKwkAAAAMyuWOVeLp8yffyAkVx0g7
NNTP-Posting-Host: 94.145.246.173
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com>
<4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com>
<jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com> <e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com>
<lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com> <31cd75e7-2c72-6923-1c33-dde5e74f13e7@electrooptical.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <be9971b0-243c-44bf-8cc9-a50d19905af8n@googlegroups.com>
Subject: Re: 0.0 / 0.0 = -NAN ?
From: langw...@fonz.dk (Lasse Langwadt Christensen)
Injection-Date: Mon, 02 May 2022 21:02:18 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 39
 by: Lasse Langwadt Chris - Mon, 2 May 2022 21:02 UTC

mandag den 2. maj 2022 kl. 22.52.48 UTC+2 skrev Phil Hobbs:
> jla...@highlandsniptechnology.com wrote:
> > On Sun, 1 May 2022 20:27:33 -0700 (PDT), whit3rd <whi...@gmail.com>
> > wrote:
> >
> >> On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:
> >>> On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
> >>> <gnuarm.del...@gmail.com> wrote:
> >>>
> >>>> On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
> >>
> >>>>> I wrote an s32.32 saturating math package for the 68K that always did
> >>>>> what was most reasonable.
> >>>>>
> >>>>> 0/0 = 0
> >>>>
> >>>> I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
> >>>>
> >>>> If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
> >>
> >>> I would have expected 0/0=1 ie no rational difference.
> >>
> >> That's the case if you consider lim x/x as x approaches zero. But,
> >> what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
> >> best way to get a thinking human to understanding what the computer
> >> is trying to express.
> >
> > What does a control system do when the heater voltage is computed to
> > be NAN?
> Log it, skip the update, and press on to the next measurement.

hoping that that doesn't slow the system down to much

Re: 0.0 / 0.0 = -NAN ?

<0e8e2eec-65b8-45d6-a847-62b6e6db87c9n@googlegroups.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96039&group=sci.electronics.design#96039

  copy link   Newsgroups: sci.electronics.design
X-Received: by 2002:a05:620a:454e:b0:69f:b9fd:f05d with SMTP id u14-20020a05620a454e00b0069fb9fdf05dmr10067029qkp.633.1651526798497;
Mon, 02 May 2022 14:26:38 -0700 (PDT)
X-Received: by 2002:a5b:8c5:0:b0:648:d88b:3dd5 with SMTP id
w5-20020a5b08c5000000b00648d88b3dd5mr11658165ybq.267.1651526798285; Mon, 02
May 2022 14:26:38 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: sci.electronics.design
Date: Mon, 2 May 2022 14:26:38 -0700 (PDT)
In-Reply-To: <be9971b0-243c-44bf-8cc9-a50d19905af8n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.138.223.107; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 24.138.223.107
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com>
<4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com>
<jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com> <e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com>
<lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com> <31cd75e7-2c72-6923-1c33-dde5e74f13e7@electrooptical.net>
<be9971b0-243c-44bf-8cc9-a50d19905af8n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0e8e2eec-65b8-45d6-a847-62b6e6db87c9n@googlegroups.com>
Subject: Re: 0.0 / 0.0 = -NAN ?
From: gnuarm.d...@gmail.com (Ricky)
Injection-Date: Mon, 02 May 2022 21:26:38 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 59
 by: Ricky - Mon, 2 May 2022 21:26 UTC

On Monday, May 2, 2022 at 5:02:22 PM UTC-4, lang...@fonz.dk wrote:
> mandag den 2. maj 2022 kl. 22.52.48 UTC+2 skrev Phil Hobbs:
> > jla...@highlandsniptechnology.com wrote:
> > > On Sun, 1 May 2022 20:27:33 -0700 (PDT), whit3rd <whi...@gmail.com>
> > > wrote:
> > >
> > >> On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:
> > >>> On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
> > >>> <gnuarm.del...@gmail.com> wrote:
> > >>>
> > >>>> On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
> > >>
> > >>>>> I wrote an s32.32 saturating math package for the 68K that always did
> > >>>>> what was most reasonable.
> > >>>>>
> > >>>>> 0/0 = 0
> > >>>>
> > >>>> I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
> > >>>>
> > >>>> If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
> > >>
> > >>> I would have expected 0/0=1 ie no rational difference.
> > >>
> > >> That's the case if you consider lim x/x as x approaches zero. But,
> > >> what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
> > >> best way to get a thinking human to understanding what the computer
> > >> is trying to express.
> > >
> > > What does a control system do when the heater voltage is computed to
> > > be NAN?
> > Log it, skip the update, and press on to the next measurement.
> hoping that that doesn't slow the system down to much

If it does, it is a crappy system. That's what almost killed the first moon landing. You can test until you are blue in the face and you have not proven anything. You have to deal with these sorts of issues up front in the design requirements stage. Screw that up and you will have a system that does what you asked for, but not what you want.

Thinking 0/0 is an ok thing to approximate is not a way to design critical systems.

--

Rick C.

-+ Get 1,000 miles of free Supercharging
-+ Tesla referral code - https://ts.la/richard11209

Re: 0.0 / 0.0 = -NAN ?

<ae504548-ac0e-4ad7-9aad-0be3351c57b5n@googlegroups.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96040&group=sci.electronics.design#96040

  copy link   Newsgroups: sci.electronics.design
X-Received: by 2002:ac8:6ce:0:b0:2f0:29dd:bbc5 with SMTP id j14-20020ac806ce000000b002f029ddbbc5mr12368351qth.216.1651527025003;
Mon, 02 May 2022 14:30:25 -0700 (PDT)
X-Received: by 2002:a25:35c5:0:b0:641:dab1:5ef9 with SMTP id
c188-20020a2535c5000000b00641dab15ef9mr12014685yba.396.1651527024823; Mon, 02
May 2022 14:30:24 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: sci.electronics.design
Date: Mon, 2 May 2022 14:30:24 -0700 (PDT)
In-Reply-To: <0e8e2eec-65b8-45d6-a847-62b6e6db87c9n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=94.145.246.173; posting-account=mW5JKwkAAAAMyuWOVeLp8yffyAkVx0g7
NNTP-Posting-Host: 94.145.246.173
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com>
<4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com>
<jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com> <e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com>
<lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com> <31cd75e7-2c72-6923-1c33-dde5e74f13e7@electrooptical.net>
<be9971b0-243c-44bf-8cc9-a50d19905af8n@googlegroups.com> <0e8e2eec-65b8-45d6-a847-62b6e6db87c9n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ae504548-ac0e-4ad7-9aad-0be3351c57b5n@googlegroups.com>
Subject: Re: 0.0 / 0.0 = -NAN ?
From: langw...@fonz.dk (Lasse Langwadt Christensen)
Injection-Date: Mon, 02 May 2022 21:30:24 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 55
 by: Lasse Langwadt Chris - Mon, 2 May 2022 21:30 UTC

mandag den 2. maj 2022 kl. 23.26.42 UTC+2 skrev Ricky:
> On Monday, May 2, 2022 at 5:02:22 PM UTC-4, lang...@fonz.dk wrote:
> > mandag den 2. maj 2022 kl. 22.52.48 UTC+2 skrev Phil Hobbs:
> > > jla...@highlandsniptechnology.com wrote:
> > > > On Sun, 1 May 2022 20:27:33 -0700 (PDT), whit3rd <whi...@gmail.com>
> > > > wrote:
> > > >
> > > >> On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:
> > > >>> On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
> > > >>> <gnuarm.del...@gmail.com> wrote:
> > > >>>
> > > >>>> On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
> > > >>
> > > >>>>> I wrote an s32.32 saturating math package for the 68K that always did
> > > >>>>> what was most reasonable.
> > > >>>>>
> > > >>>>> 0/0 = 0
> > > >>>>
> > > >>>> I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
> > > >>>>
> > > >>>> If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
> > > >>
> > > >>> I would have expected 0/0=1 ie no rational difference.
> > > >>
> > > >> That's the case if you consider lim x/x as x approaches zero. But,
> > > >> what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
> > > >> best way to get a thinking human to understanding what the computer
> > > >> is trying to express.
> > > >
> > > > What does a control system do when the heater voltage is computed to
> > > > be NAN?
> > > Log it, skip the update, and press on to the next measurement.
> > hoping that that doesn't slow the system down to much
> If it does, it is a crappy system. That's what almost killed the first moon landing. You can test until you are blue in the face and you have not proven anything. You have to deal with these sorts of issues up front in the design requirements stage. Screw that up and you will have a system that does what you asked for, but not what you want.
>
> Thinking 0/0 is an ok thing to approximate is not a way to design critical systems.

if it is the safe choice that keeps the system running with no ill effects why not?

Re: 0.0 / 0.0 = -NAN ?

<4am07hhrr4bq9lvfugn58jr2cpoa626fec@4ax.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96043&group=sci.electronics.design#96043

  copy link   Newsgroups: sci.electronics.design
Path: i2pn2.org!i2pn.org!paganini.bofh.team!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: leg...@nospam.magma.ca (legg)
Newsgroups: sci.electronics.design
Subject: Re: 0.0 / 0.0 = -NAN ?
Date: Mon, 02 May 2022 18:23:38 -0400
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <4am07hhrr4bq9lvfugn58jr2cpoa626fec@4ax.com>
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com> <4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com> <jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com> <196t6h9j8ejfg6dma4e3r78fv59pnl67vn@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="88887e7d4a27f30ad5b921f03eec3c69";
logging-data="7100"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+mLTkCbDF6LPsDsl4JvopG"
Cancel-Lock: sha1:R8B5ZedXVG8/DsEL1ftJ+6biTJ8=
X-Newsreader: Forte Agent 4.2/32.1118
 by: legg - Mon, 2 May 2022 22:23 UTC

On Sun, 01 May 2022 07:29:30 -0700, jlarkin@highlandsniptechnology.com
wrote:

>On Sat, 30 Apr 2022 16:24:03 -0400, legg <legg@nospam.magma.ca> wrote:
>
>>On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
>><gnuarm.deletethisbit@gmail.com> wrote:
>>
>>>On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
>>>> On Sat, 30 Apr 2022 08:31:47 -0700 (PDT), Skybuck Flying
>>>> <skybuc...@gmail.com> wrote:
>>>>
>>>> >When exception masks are all enabled to stop the processor from throwing floating point exceptions the following calculation produces a somewhat strange result:
>>>> >
>>>> >0.0 / 0.0 = -nan
>>>> >
>>>> >(At least in Delphi).
>>>> >
>>>> >For now I will assume this is the case in C/C++ as well and with that I mean on x86/x64 which should and seems to be following IEEE 754 floating-point format.
>>>> >
>>>> >I am a little bit surprised by this and I want/need to know more. Where is this defined that 0.0 / 0.0 should be -NAN ?!?
>>>> >
>>>> >Problem is with the code, example:
>>>> >
>>>> >T := 0;
>>>> >D := 0.0 / 0.0;
>>>> >P := T * D;
>>>> >
>>>> >This screws up P. instead of P being zero, P is now also -NAN ?!?
>>>> >
>>>> >I find this very strange but ok.
>>>> >
>>>> >I guess a simple solution could be to set D to 0 explicitly for this case, is there perhaps another solution ? Maybe some kind of mask or rounding mode so that additional branch is not necessary ???
>>>> >
>>>> >Bye for now,
>>>> >Skybuck.
>>>> I wrote an s32.32 saturating math package for the 68K that always did
>>>> what was most reasonable.
>>>>
>>>> 0/0 = 0
>>>
>>>I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
>>>
>>>If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
>>>
>>>That is exactly why anything divided by zero is NAN in a good math package. If you want to produce a result for 0/0, then that should be hard coded with clear documentation of what is being done and why it is acceptable.
>>>
>>>The rationale that, "it works" means it works for the cases tested. Very sloppy indeed.
>>
>>I would have expected 0/0=1 ie no rational difference.
>>
>>RL
>
>0 is the safest heater power.

Is that possible, if it's ON ?

If it's OFF and cooling, values should still look positive, as
it's not the power application that is immediately responsible
for heat transfer.

RL

Re: 0.0 / 0.0 = -NAN ?

<p1p07h9s44fd5h99celjsba2lam1lgas6r@4ax.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96047&group=sci.electronics.design#96047

  copy link   Newsgroups: sci.electronics.design
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 02 May 2022 18:14:30 -0500
From: joegw...@comcast.net (Joe Gwinn)
Newsgroups: sci.electronics.design
Subject: Re: 0.0 / 0.0 = -NAN ?
Date: Mon, 02 May 2022 19:14:29 -0400
Message-ID: <p1p07h9s44fd5h99celjsba2lam1lgas6r@4ax.com>
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com> <4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com> <jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com> <e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com> <lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com> <t4opqv$1fvg$1@gioia.aioe.org> <m7uv6ht5llvjffrcmfk5pau8erlnnrenaf@4ax.com> <90fb097e-85f0-4ca6-be35-b471d6498b32n@googlegroups.com>
User-Agent: ForteAgent/8.00.32.1272
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 81
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-462aGlWVySA5VBJv+NTWG4O2ZKNodr4ZC6fQPEPxFNaFiQRNxtXiBw7XHRaY6VDDBvq3JX/yW7uefQC!+5MOhMW745PTMJxlxzKxLEL4aSI4gDrZz2R1h4/vunAP/nsP+TxqbE4eY6oUuhkOlYmKhjw=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 5637
 by: Joe Gwinn - Mon, 2 May 2022 23:14 UTC

On Mon, 2 May 2022 13:41:52 -0700 (PDT), Ricky
<gnuarm.deletethisbit@gmail.com> wrote:

>On Monday, May 2, 2022 at 11:54:53 AM UTC-4, Joe Gwinn wrote:
>> On Mon, 2 May 2022 15:28:46 +0100, Martin Brown
>> <'''newspam'''@nonad.co.uk> wrote:
>> >On 02/05/2022 15:10, jla...@highlandsniptechnology.com wrote:
>> >> On Sun, 1 May 2022 20:27:33 -0700 (PDT), whit3rd <whi...@gmail.com>
>> >> wrote:
>> >>
>> >>> On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:
>> >>>> On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
>> >>>> <gnuarm.del...@gmail.com> wrote:
>> >>>>
>> >>>>> On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
>> >>>
>> >>>>>> I wrote an s32.32 saturating math package for the 68K that always did
>> >>>>>> what was most reasonable.
>> >>>>>>
>> >>>>>> 0/0 = 0
>> >>>>>
>> >>>>> I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
>> >>>>>
>> >>>>> If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
>> >>>
>> >>>> I would have expected 0/0=1 ie no rational difference.
>> >>>
>> >>> That's the case if you consider lim x/x as x approaches zero. But,
>> >>> what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
>> >>> best way to get a thinking human to understanding what the computer
>> >>> is trying to express.
>> >>
>> >> What does a control system do when the heater voltage is computed to
>> >> be NAN?
>> >
>> >Shut down. The situation should never arise if you have scaled the
>> >problem correctly and you should never be dividing by zero anyway.
>> >
>> >If the denominator of a division is zero then you haven't thought out
>> >the representation of your problem correctly. Testing for zero is
>> >usually quick (and often implicitly available in integer arithmetic).
>> Umm. Testing for zero doesn't necessarily change anything.
>>
>> I have a war story here. Many decades ago, I was the software
>> architect for the mission software of a ship self defense system that
>> shoots incoming cruise missiles down, if it can. From detection at
>> the horizon to impact on ownship is maybe twenty seconds.
>>
>> One fine day, a mob of software engineers turned up, locked in
>> argument about what to do if the engageability calculation suffered a
>> divide-by-zero exception.
>>
>> This is not a coding error per se, it's a mathematical singularity in
>> the equations - some engagement geometries will hit the singularity,
>> and the embedded realtime computers of that day could not handle the
>> more complicated math needed to avoid such things fast enough to
>> matter.
>>
>> There were two schools: Just provide a very large number and proceed,
>> praying. Stop and print out a bunch of diagnostic information.
>>
>> Hmm. So the user, an ordinary sailor operating the self-defense
>> system is in the middle of an engagement with an incoming cruise
>> missile, and is suddenly handed a bunch or error messages, with less
>> than twenty seconds to live ... Really??? No! Just silently return
>> the best answer possible given the situation and press on, praying.
>
>Was this because they could not use quaternions? I've heard of 3D calculations that are problematic because of issues in the math. They solve that in 3 dimensional control by adding a forth coordinate, quaternions, but obviously more calculations.

The problem was the extremely limited computer power available then.
Later missiles do use quaternions in their autopilots for just that
reason. Quaternions have their own oddities to be managed.

Nor is it clear that quaternions would have solved a singularity in
engagement math, which is not a form of gimbal lock. I don't know
what is done these days, but I have run into essential singularities
in modern stuff.

Joe Gwinn

Re: 0.0 / 0.0 = -NAN ?

<nnp07h98t97n4dd90kl58kie3ompm15d4g@4ax.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96048&group=sci.electronics.design#96048

  copy link   Newsgroups: sci.electronics.design
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 02 May 2022 18:34:38 -0500
From: jlar...@highland_atwork_technology.com (John Larkin)
Newsgroups: sci.electronics.design
Subject: Re: 0.0 / 0.0 = -NAN ?
Date: Mon, 02 May 2022 16:34:38 -0700
Organization: Highland Tech
Reply-To: xx@yy.com
Message-ID: <nnp07h98t97n4dd90kl58kie3ompm15d4g@4ax.com>
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com> <4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com> <jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com> <e7d06869-d567-4145-ad01-f222a028033cn@googlegroups.com> <lgpv6hdhqkl6071e651cb4dd1qkf94aa48@4ax.com> <31cd75e7-2c72-6923-1c33-dde5e74f13e7@electrooptical.net>
X-Newsreader: Forte Agent 3.1/32.783
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 58
X-Trace: sv3-fEzVFOMVzfruNr2fDr1eg7Glf3jkKfMWTSDziVJGEp1GDxGXcf6y5RXg9FOIPJcJ5VdgHobPNmh8Gt0!xoXsK4PXBxRq1DHYQRIrzOdyZvvk/6frgnClvMqK2LSGYx5Gia59t1Ep2+a3a7N8Fgk2QFssnsF6!764Grg==
X-Complaints-To: www.supernews.com/docs/abuse.html
X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 3725
 by: John Larkin - Mon, 2 May 2022 23:34 UTC

On Mon, 2 May 2022 16:52:35 -0400, Phil Hobbs
<pcdhSpamMeSenseless@electrooptical.net> wrote:

>jlarkin@highlandsniptechnology.com wrote:
>> On Sun, 1 May 2022 20:27:33 -0700 (PDT), whit3rd <whit3rd@gmail.com>
>> wrote:
>>
>>> On Saturday, April 30, 2022 at 1:23:21 PM UTC-7, legg wrote:
>>>> On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
>>>> <gnuarm.del...@gmail.com> wrote:
>>>>
>>>>> On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
>>>
>>>>>> I wrote an s32.32 saturating math package for the 68K that always did
>>>>>> what was most reasonable.
>>>>>>
>>>>>> 0/0 = 0
>>>>>
>>>>> I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
>>>>>
>>>>> If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
>>>
>>>> I would have expected 0/0=1 ie no rational difference.
>>>
>>> That's the case if you consider lim x/x as x approaches zero. But,
>>> what of the limit of 2x/x, or -x/x, as x approaches zero? NAN is the
>>> best way to get a thinking human to understanding what the computer
>>> is trying to express.
>>
>> What does a control system do when the heater voltage is computed to
>> be NAN?
>
>Log it, skip the update, and press on to the next measurement.
>
>Cheers
>
>Phil Hobbs

Fine as long as I don't fry a few hundred kilobucks of gear.

These systems didn't have anywhere to log errors. If things got scary,
I'd shut down and light a red LED.

NAN wouldn't be useful. A saturating math package let me make range
checks when prudent, but not every step of every expression. No traps
to handle.

The s32.32 saturating math package was fun to write, in 68332
assembly. It was fast because it didn't need any normalizing. Well,
divide was a nuisance.

Integer in/out conversions were fast. As in zero.

--

If a man will begin with certainties, he shall end with doubts,
but if he will be content to begin with doubts he shall end in certainties.
Francis Bacon

Re: 0.0 / 0.0 = -NAN ?

<nvr07hp4hb7fpjjbo6klmcqd5eok6k69ru@4ax.com>

  copy mid

https://www.novabbs.com/tech/article-flat.php?id=96054&group=sci.electronics.design#96054

  copy link   Newsgroups: sci.electronics.design
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 02 May 2022 19:01:35 -0500
From: jlar...@highland_atwork_technology.com (John Larkin)
Newsgroups: sci.electronics.design
Subject: Re: 0.0 / 0.0 = -NAN ?
Date: Mon, 02 May 2022 17:01:35 -0700
Organization: Highland Tech
Reply-To: xx@yy.com
Message-ID: <nvr07hp4hb7fpjjbo6klmcqd5eok6k69ru@4ax.com>
References: <85f22bc1-17c7-46d9-b933-4c6238863740n@googlegroups.com> <4knq6h5avvjpbkd2c4mgblr3o0ns4q1tpg@4ax.com> <9607d68a-ec3b-473c-a30d-856beac3233bn@googlegroups.com> <jl6r6htkcvjsfcu27ai1ag1mp7ad2goij7@4ax.com> <196t6h9j8ejfg6dma4e3r78fv59pnl67vn@4ax.com> <4am07hhrr4bq9lvfugn58jr2cpoa626fec@4ax.com>
X-Newsreader: Forte Agent 3.1/32.783
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 79
X-Trace: sv3-QAbIyi2Jse25WdwsP2t9QU2RT8yqLYeh1JtybKMEW3WtNuhL0gt6g95yA6rCH9//CcQDIXzA59hbxY7!UDUPXwwibR0k7dDobGW9flgLdHI8xz9BxdyKTmZ+/LiFnxM7OjY1KBJAXH6vKV402eifNyuqwbcU!NBRAtg==
X-Complaints-To: www.supernews.com/docs/abuse.html
X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 4671
 by: John Larkin - Tue, 3 May 2022 00:01 UTC

On Mon, 02 May 2022 18:23:38 -0400, legg <legg@nospam.magma.ca> wrote:

>On Sun, 01 May 2022 07:29:30 -0700, jlarkin@highlandsniptechnology.com
>wrote:
>
>>On Sat, 30 Apr 2022 16:24:03 -0400, legg <legg@nospam.magma.ca> wrote:
>>
>>>On Sat, 30 Apr 2022 10:47:30 -0700 (PDT), Ricky
>>><gnuarm.deletethisbit@gmail.com> wrote:
>>>
>>>>On Saturday, April 30, 2022 at 12:11:41 PM UTC-4, jla...@highlandsniptechnology.com wrote:
>>>>> On Sat, 30 Apr 2022 08:31:47 -0700 (PDT), Skybuck Flying
>>>>> <skybuc...@gmail.com> wrote:
>>>>>
>>>>> >When exception masks are all enabled to stop the processor from throwing floating point exceptions the following calculation produces a somewhat strange result:
>>>>> >
>>>>> >0.0 / 0.0 = -nan
>>>>> >
>>>>> >(At least in Delphi).
>>>>> >
>>>>> >For now I will assume this is the case in C/C++ as well and with that I mean on x86/x64 which should and seems to be following IEEE 754 floating-point format.
>>>>> >
>>>>> >I am a little bit surprised by this and I want/need to know more. Where is this defined that 0.0 / 0.0 should be -NAN ?!?
>>>>> >
>>>>> >Problem is with the code, example:
>>>>> >
>>>>> >T := 0;
>>>>> >D := 0.0 / 0.0;
>>>>> >P := T * D;
>>>>> >
>>>>> >This screws up P. instead of P being zero, P is now also -NAN ?!?
>>>>> >
>>>>> >I find this very strange but ok.
>>>>> >
>>>>> >I guess a simple solution could be to set D to 0 explicitly for this case, is there perhaps another solution ? Maybe some kind of mask or rounding mode so that additional branch is not necessary ???
>>>>> >
>>>>> >Bye for now,
>>>>> >Skybuck.
>>>>> I wrote an s32.32 saturating math package for the 68K that always did
>>>>> what was most reasonable.
>>>>>
>>>>> 0/0 = 0
>>>>
>>>>I'm sure no one can explain why 0/0 = 0 makes sense. Zero does not represent just exactly zero. Just as 1 is the range from 1/2 to 1-1/2, zero is the range from -1/2 to +1/2.
>>>>
>>>>If the denominator is not zero, as the numerator approaches zero, yes, in the limit, the result approaches zero. But if the numerator is not zero, as the denominator approaches zero, in the limit, the result approaches infinity. So why would 0/0=0 make sense?
>>>>
>>>>That is exactly why anything divided by zero is NAN in a good math package. If you want to produce a result for 0/0, then that should be hard coded with clear documentation of what is being done and why it is acceptable.
>>>>
>>>>The rationale that, "it works" means it works for the cases tested. Very sloppy indeed.
>>>
>>>I would have expected 0/0=1 ie no rational difference.
>>>
>>>RL
>>
>>0 is the safest heater power.
>
>Is that possible, if it's ON ?

If we have a broken thermocouple, or some cable disconnected, or a
shorted mosfet, we want to kill heater power.

In same cases, hundreds of rabbits died to make enough of some enzyme
to analyze. We didn't want to poach the samples. Or toast an NMR
probe.

>
>If it's OFF and cooling, values should still look positive, as
>it's not the power application that is immediately responsible
>for heat transfer.
>
>RL
--

If a man will begin with certainties, he shall end with doubts,
but if he will be content to begin with doubts he shall end in certainties.
Francis Bacon

Pages:123
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor