Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  nodelist  faq  login

A rolling disk gathers no MOS.


programming / alt.lang.asm / Re: 0.0 / 0.0 = -NAN ?

SubjectAuthor
o Re: 0.0 / 0.0 = -NAN ?Herbert Kleebauer

1
Subject: Re: 0.0 / 0.0 = -NAN ?
From: Herbert Kleebauer
Newsgroups: alt.lang.asm
Organization: Aioe.org NNTP Server
Date: Sat, 30 Apr 2022 19:02 UTC
References: 1
Path: i2pn2.org!i2pn.org!aioe.org!OCvBNKJfuOE1OudEfPJ7lg.user.46.165.242.91.POSTED!not-for-mail
From: kle...@unibwm.de (Herbert Kleebauer)
Newsgroups: alt.lang.asm
Subject: Re: 0.0 / 0.0 = -NAN ?
Date: Sat, 30 Apr 2022 21:02:10 +0200
Organization: Aioe.org NNTP Server
Message-ID: <t4k13i$1jpr$1@gioia.aioe.org>
References: <cca0e7f8-c99d-4f83-9a98-edb26f1509fcn@googlegroups.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="53051"; posting-host="OCvBNKJfuOE1OudEfPJ7lg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.1
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
View all headers
On 30.04.2022 17:31, Skybuck Flying 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

Why is this strange? 0/0 is undefined and therefore "Not A Number"


  > Problem is with the code, example:

T := 0;
D := 0.0 / 0.0;
P := T * D;


Why should P be zero? Suppose T=x and D=x/x^2
For x=0 you get T=0, D=0/0 and you say P should be 0,
but P=T*D = x*x/x^2 = 1


 > This screws up P. instead of P being zero, P is now also -NAN ?!?

"Something" multiplied with "NotANumber" is also "NotANumber" even if the
"something" is zero.



1
rocksolid light 0.7.2
clearneti2ptor