Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Computers don't actually think. You just think they think. (We think.)


devel / comp.arch / Re: The value of floating-point exceptions?

SubjectAuthor
* The value of floating-point exceptions?Marcus
+* Re: The value of floating-point exceptions?Marcus
|`* Re: The value of floating-point exceptions?Stephen Fuld
| +- Re: The value of floating-point exceptions?Marcus
| `* Re: The value of floating-point exceptions?luke.l...@gmail.com
|  `- Re: The value of floating-point exceptions?BGB
+* Re: The value of floating-point exceptions?John Dallman
|+* Re: The value of floating-point exceptions?Marcus
||`* Re: The value of floating-point exceptions?John Dallman
|| +- Re: The value of floating-point exceptions?MitchAlsup
|| `* Re: The value of floating-point exceptions?Quadibloc
||  `* Re: The value of floating-point exceptions?MitchAlsup
||   +* Re: The value of floating-point exceptions?Marcus
||   |+* Re: The value of floating-point exceptions?Ivan Godard
||   ||`* Re: The value of floating-point exceptions?Quadibloc
||   || +* Re: The value of floating-point exceptions?Ivan Godard
||   || |+* Re: The value of floating-point exceptions?Anton Ertl
||   || ||`* Re: The value of floating-point exceptions?MitchAlsup
||   || || `- Re: The value of floating-point exceptions?Quadibloc
||   || |`- Re: The value of floating-point exceptions?Terje Mathisen
||   || `* Re: The value of floating-point exceptions?MitchAlsup
||   ||  +* Re: The value of floating-point exceptions?Quadibloc
||   ||  |+* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||+- Re: The value of floating-point exceptions?BGB
||   ||  ||`* Re: The value of floating-point exceptions?Terje Mathisen
||   ||  || `* Re: The value of floating-point exceptions?BGB
||   ||  ||  `* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||   +* Re: The value of floating-point exceptions?Ivan Godard
||   ||  ||   |+* Re: The value of floating-point exceptions?BGB
||   ||  ||   ||`* Re: The value of floating-point exceptions?Terje Mathisen
||   ||  ||   || `- Re: The value of floating-point exceptions?BGB
||   ||  ||   |+* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||   ||`* Re: The value of floating-point exceptions?Marcus
||   ||  ||   || `- Re: The value of floating-point exceptions?BGB
||   ||  ||   |`* Re: The value of floating-point exceptions?EricP
||   ||  ||   | `* Re: The value of floating-point exceptions?Ivan Godard
||   ||  ||   |  `* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||   |   +* Re: Configurable rounding modes (was The value of floating-pointMarcus
||   ||  ||   |   |+- Re: Configurable rounding modes (was The value of floating-pointTerje Mathisen
||   ||  ||   |   |`* Re: Configurable rounding modes (was The value of floating-point exceptions?)MitchAlsup
||   ||  ||   |   | +- Re: Configurable rounding modes (was The value of floating-pointStephen Fuld
||   ||  ||   |   | `- Re: Configurable rounding modes (was The value of floating-pointMarcus
||   ||  ||   |   `* Re: The value of floating-point exceptions?EricP
||   ||  ||   |    `* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||   |     `- Re: The value of floating-point exceptions?Quadibloc
||   ||  ||   +* Re: The value of floating-point exceptions?Quadibloc
||   ||  ||   |`* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||   | `- Re: The value of floating-point exceptions?Quadibloc
||   ||  ||   `* Re: The value of floating-point exceptions?Marcus
||   ||  ||    +* Re: The value of floating-point exceptions?Thomas Koenig
||   ||  ||    |`* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||    | `- Re: The value of floating-point exceptions?Thomas Koenig
||   ||  ||    +* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||    |+* Re: The value of floating-point exceptions?Ivan Godard
||   ||  ||    ||`- Re: The value of floating-point exceptions?BGB
||   ||  ||    |+* Re: The value of floating-point exceptions?Quadibloc
||   ||  ||    ||`* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||    || +* Re: The value of floating-point exceptions?Ivan Godard
||   ||  ||    || |`* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||    || | `* Re: The value of floating-point exceptions?Ivan Godard
||   ||  ||    || |  +* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||    || |  |`- Re: The value of floating-point exceptions?Ivan Godard
||   ||  ||    || |  `* Re: The value of floating-point exceptions?Marcus
||   ||  ||    || |   +- Re: The value of floating-point exceptions?Quadibloc
||   ||  ||    || |   +* Re: The value of floating-point exceptions?Anton Ertl
||   ||  ||    || |   |`* Re: The value of floating-point exceptions?Michael S
||   ||  ||    || |   | `* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||    || |   |  `- Re: The value of floating-point exceptions?Terje Mathisen
||   ||  ||    || |   `* Re: The value of floating-point exceptions?Quadibloc
||   ||  ||    || |    +- Re: The value of floating-point exceptions?Quadibloc
||   ||  ||    || |    `* Re: The value of floating-point exceptions?Marcus
||   ||  ||    || |     `* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||    || |      `* Re: The value of floating-point exceptions?Marcus
||   ||  ||    || |       `- Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||    || `- Re: Configurable rounding modes (was The value of floating-pointMarcus
||   ||  ||    |`* Re: Configurable rounding modes (was The value of floating-pointMarcus
||   ||  ||    | +* Re: Configurable rounding modes (was The value of floating-point exceptions?)MitchAlsup
||   ||  ||    | |`* Re: Configurable rounding modes (was The value of floating-pointIvan Godard
||   ||  ||    | | +* Re: Configurable rounding modes (was The value of floating-pointBGB
||   ||  ||    | | |`* Re: Configurable rounding modes (was The value of floating-pointMarcus
||   ||  ||    | | | `- Re: Configurable rounding modes (was The value of floating-pointBGB
||   ||  ||    | | +* Re: Configurable rounding modes (was The value of floating-point exceptions?)Quadibloc
||   ||  ||    | | |+- Re: Configurable rounding modes (was The value of floating-point exceptions?)Quadibloc
||   ||  ||    | | |`* Re: Configurable rounding modes (was The value of floating-pointIvan Godard
||   ||  ||    | | | `- Re: Configurable rounding modes (was The value of floating-point exceptions?)Quadibloc
||   ||  ||    | | `* Re: Configurable rounding modes (was The value of floating-point exceptions?)MitchAlsup
||   ||  ||    | |  `* Re: Configurable rounding modes (was The value of floating-pointIvan Godard
||   ||  ||    | |   `* Re: Configurable rounding modes (was The value of floating-point exceptions?)Quadibloc
||   ||  ||    | |    `* Re: Configurable rounding modes (was The value of floating-point exceptions?)Quadibloc
||   ||  ||    | |     +- Re: Configurable rounding modes (was The value of floating-point exceptions?)Quadibloc
||   ||  ||    | |     `- Re: Configurable rounding modes (was The value of floating-point exceptions?)Quadibloc
||   ||  ||    | `* Re: Configurable rounding modes (was The value of floating-pointBGB
||   ||  ||    |  `* Re: Configurable rounding modes (was The value of floating-point exceptions?)MitchAlsup
||   ||  ||    |   `- Re: Configurable rounding modes (was The value of floating-pointBGB
||   ||  ||    `* Re: The value of floating-point exceptions?antispam
||   ||  ||     +- Re: The value of floating-point exceptions?BGB
||   ||  ||     +* Re: The value of floating-point exceptions?Terje Mathisen
||   ||  ||     |+- Re: The value of floating-point exceptions?BGB
||   ||  ||     |`* Re: The value of floating-point exceptions?antispam
||   ||  ||     | `* Re: The value of floating-point exceptions?Quadibloc
||   ||  ||     |  +* Re: The value of floating-point exceptions?antispam
||   ||  ||     |  `* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||     `- Re: The value of floating-point exceptions?John Dallman
||   ||  |`* Re: The value of floating-point exceptions?John Dallman
||   ||  +* Re: The value of floating-point exceptions?Quadibloc
||   ||  `* Re: The value of floating-point exceptions?Thomas Koenig
||   |`* Re: The value of floating-point exceptions?Quadibloc
||   `- Re: The value of floating-point exceptions?Quadibloc
|`* Re: The value of floating-point exceptions?Marcus
+- Re: The value of floating-point exceptions?Terje Mathisen
+* Re: The value of floating-point exceptions?Ivan Godard
+- Re: The value of floating-point exceptions?BGB
+* Re: The value of floating-point exceptions?EricP
+* Re: The value of floating-point exceptions?Anton Ertl
+* Re: The value of floating-point exceptions?MitchAlsup
`- Re: The value of floating-point exceptions?antispam

Pages:12345678910
Re: The value of floating-point exceptions?

<sdtqs4$klj$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19300&group=comp.arch#19300

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!aioe.org!aoTW/Fm1++YcllHDt9jnUQ.user.46.165.242.91.POSTED!not-for-mail
From: terje.ma...@tmsw.no (Terje Mathisen)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Thu, 29 Jul 2021 11:02:59 +0200
Organization: Aioe.org NNTP Server
Message-ID: <sdtqs4$klj$1@gioia.aioe.org>
References: <sd9a9h$ro6$1@dont-email.me> <sdjghd$1i4a$1@gioia.aioe.org>
<sdk2kd$lu1$1@dont-email.me>
<476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com>
<sdlo5n$da3$1@dont-email.me>
<1f8827fe-a288-4f2e-8e4e-40cc343febbdn@googlegroups.com>
<48d7c07e-2684-4eb8-a480-a40664c48493n@googlegroups.com>
<922f7388-1131-45c1-a8ef-cb4e61fbc4f1n@googlegroups.com>
<sdog27$jc1$1@dont-email.me>
<f518be30-3b21-4d38-ad4f-42118055634cn@googlegroups.com>
<sdphtb$nkp$1@dont-email.me> <sdro37$re5$1@dont-email.me>
<2021Jul28.192134@mips.complang.tuwien.ac.at>
<747eaef9-87a0-4d0c-b59d-327ccd28f287n@googlegroups.com>
<d682d1da-b783-4758-8c08-ca2af2be4f05n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="21171"; posting-host="aoTW/Fm1++YcllHDt9jnUQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101
Firefox/60.0 SeaMonkey/2.53.8.1
X-Notice: Filtered by postfilter v. 0.9.2
 by: Terje Mathisen - Thu, 29 Jul 2021 09:02 UTC

MitchAlsup wrote:
> On Wednesday, July 28, 2021 at 2:32:16 PM UTC-5, Michael S wrote:
>> On Wednesday, July 28, 2021 at 8:45:42 PM UTC+3, Anton Ertl wrote:
>>> Marcus <m.de...@this.bitsnbites.eu> writes:
>>>> On 2021-07-27 20:05, Ivan Godard wrote:
>
>>>
>> Out of memory, another difference apart from mixed endianness is that exponent bias differs by one.
>> I don't remember which one is bigger.
> <
> 754 choose an exponent whereby the largest denormal binade does not
> cause overflow when reciprocated.

Right: For any 754 FP format the bias is 0b1111..., i.e. 127/1023 for
float/double, with 1 for the smallest normal number and 254/2046 for the
largest possible exponent before Inf. I.e. an identical exponent range
above and below 1.0

It still means that any sub-normal value can/will overflow to Inf if you
do a reciprocal:

y = 1/x

Terje

--
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

Re: The value of floating-point exceptions?

<sdua2r$avt$1@z-news.wcss.wroc.pl>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19303&group=comp.arch#19303

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!news-out.netnews.com!news.alt.net!fdc3.netnews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!newsfeed.pionier.net.pl!pwr.wroc.pl!news.wcss.wroc.pl!not-for-mail
From: antis...@math.uni.wroc.pl
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Thu, 29 Jul 2021 13:22:35 +0000 (UTC)
Organization: Politechnika Wroclawska
Lines: 69
Message-ID: <sdua2r$avt$1@z-news.wcss.wroc.pl>
References: <sd9a9h$ro6$1@dont-email.me> <sde6m7$kr1$1@dont-email.me> <sde74m$nio$1@dont-email.me> <7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com> <e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com> <fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com> <713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com> <sdjghd$1i4a$1@gioia.aioe.org> <sdk2kd$lu1$1@dont-email.me> <476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com> <sdlo5n$da3$1@dont-email.me>
NNTP-Posting-Host: hera.math.uni.wroc.pl
X-Trace: z-news.wcss.wroc.pl 1627564955 11261 156.17.86.1 (29 Jul 2021 13:22:35 GMT)
X-Complaints-To: abuse@news.pwr.wroc.pl
NNTP-Posting-Date: Thu, 29 Jul 2021 13:22:35 +0000 (UTC)
Cancel-Lock: sha1:t9YRok7xZtNAkeaqddDKOEbbxHU=
User-Agent: tin/2.4.3-20181224 ("Glen Mhor") (UNIX) (Linux/4.19.0-10-amd64 (x86_64))
X-Received-Bytes: 4770
 by: antis...@math.uni.wroc.pl - Thu, 29 Jul 2021 13:22 UTC

Marcus <m.delete@this.bitsnbites.eu> wrote:
> On 2021-07-25 19:22, MitchAlsup wrote:
> > On Sunday, July 25, 2021 at 11:14:08 AM UTC-5, BGB wrote:
> >> On 7/25/2021 6:05 AM, Terje Mathisen wrote:
> >>> MitchAlsup wrote:
> >>>> Having watched this from inside:
> >>>> a) HW designers know a lot more about this today than in 1980
> >>>> b) even systems that started out as IEEE-format gradually went
> >>>> closer and closer to full IEEE-compliant (GPUs) until there is no
> >>>> useful difference in the quality of the arithmetic.
> >>>> c) once 754-2009 came out the overhead to do denorms went to
> >>>> zero, and there is no reason to avoid full speed denorms in practice.
> >>>> (BGB's small FPGA prototyping environment aside.)
> >>>
> >>> I agree.
> >>>
> >>>> d) HW designers have learned how to perform all of the rounding
> >>>> modes at no overhead compared to RNE.
> >>>
> >>> This is actually dead easy since all the other modes are easier than
> >>> RNE: As soon as you have all four bits required for RNE (i.e.
> >>> sign/ulp/guard/sticky) then the remaining rounding modes only need
> >>> various subsets of these, so you use the rounding mode to route one of 5
> >>> or 6 possible 16-entry one-bit lookup tables into the rounding circuit
> >>> where it becomes the input to be added into the ulp position of the
> >>> final packed (sign/exp/mantissa) fp result.
> >>>
> >> Oddly enough, the extra cost to rounding itself is not the main issue
> >> with multiple rounding modes, but more the question of how the bits get
> >> there (if one doesn't already have an FPU status register or similar).
> >>
> >> Granted, could in theory put these bits in SR or similar, but, yeah...
> >>
> >> It would be better IMO if it were part of the instruction, but there
> >> isn't really any good / non-annoying way to encode this.
> > <
> > And this is why they are put in control/status registers.
> > <
>
> There are several problems with this, but the *main* problem is that the
> rounding mode setting becomes a super-global variable. If one subroutine
> touches the register, it affects all code in the same thread. And it's
> "super-global" because it crosses source code and language barriers
> (e.g. consider a program written in Go that has a Python scripting back
> end that calls out to a DLL that is written in C++ that changes the
> floating-point rounding mode...).
>
> As I have accounted for elsewhere, this is a real problem. As a SW
> developer I therefore prefer to work with architectures that do not have
> an FPU control register - /even/ if that means that I can only use RNE
> (because let's face it - that's the only rounding mode I'm ever going
> to use anyway).

Do you use C? On x86 convertion from floating point to integers
were implemented by setting rouding mode and store. Due to C
rules mode was "round towards zero".

> Having the rounding modes as part of the instruction is *much* better
> from a SW developer's perspective - but that blows up opcode space for
> a feature that is never used.

At least for store it may be quite important: on Pentium my FP program
spent about 50% (or more) of time changing rounding modes for convertion
from floats to integers. There was something like 20 FP operations
and the result was converted to integer (this was inside a loop
that iterated many times).

--
Waldek Hebisch

Re: The value of floating-point exceptions?

<sdudub$glp$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19305&group=comp.arch#19305

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: cr88...@gmail.com (BGB)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Thu, 29 Jul 2021 09:28:25 -0500
Organization: A noiseless patient Spider
Lines: 114
Message-ID: <sdudub$glp$1@dont-email.me>
References: <sd9a9h$ro6$1@dont-email.me> <sde6m7$kr1$1@dont-email.me>
<sde74m$nio$1@dont-email.me>
<7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com>
<e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com>
<fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com>
<713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com>
<sdjghd$1i4a$1@gioia.aioe.org> <sdk2kd$lu1$1@dont-email.me>
<476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com>
<sdlo5n$da3$1@dont-email.me> <sdua2r$avt$1@z-news.wcss.wroc.pl>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 29 Jul 2021 14:28:27 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="02163751defd1f58c9555c09cfa5b411";
logging-data="17081"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18lq+/KGn5/0GQJb/OFXPao"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.12.0
Cancel-Lock: sha1:LLjFMxZe+ICXKmHyyIpKLEIAKAA=
In-Reply-To: <sdua2r$avt$1@z-news.wcss.wroc.pl>
Content-Language: en-US
 by: BGB - Thu, 29 Jul 2021 14:28 UTC

On 7/29/2021 8:22 AM, antispam@math.uni.wroc.pl wrote:
> Marcus <m.delete@this.bitsnbites.eu> wrote:
>> On 2021-07-25 19:22, MitchAlsup wrote:
>>> On Sunday, July 25, 2021 at 11:14:08 AM UTC-5, BGB wrote:
>>>> On 7/25/2021 6:05 AM, Terje Mathisen wrote:
>>>>> MitchAlsup wrote:
>>>>>> Having watched this from inside:
>>>>>> a) HW designers know a lot more about this today than in 1980
>>>>>> b) even systems that started out as IEEE-format gradually went
>>>>>> closer and closer to full IEEE-compliant (GPUs) until there is no
>>>>>> useful difference in the quality of the arithmetic.
>>>>>> c) once 754-2009 came out the overhead to do denorms went to
>>>>>> zero, and there is no reason to avoid full speed denorms in practice.
>>>>>> (BGB's small FPGA prototyping environment aside.)
>>>>>
>>>>> I agree.
>>>>>
>>>>>> d) HW designers have learned how to perform all of the rounding
>>>>>> modes at no overhead compared to RNE.
>>>>>
>>>>> This is actually dead easy since all the other modes are easier than
>>>>> RNE: As soon as you have all four bits required for RNE (i.e.
>>>>> sign/ulp/guard/sticky) then the remaining rounding modes only need
>>>>> various subsets of these, so you use the rounding mode to route one of 5
>>>>> or 6 possible 16-entry one-bit lookup tables into the rounding circuit
>>>>> where it becomes the input to be added into the ulp position of the
>>>>> final packed (sign/exp/mantissa) fp result.
>>>>>
>>>> Oddly enough, the extra cost to rounding itself is not the main issue
>>>> with multiple rounding modes, but more the question of how the bits get
>>>> there (if one doesn't already have an FPU status register or similar).
>>>>
>>>> Granted, could in theory put these bits in SR or similar, but, yeah...
>>>>
>>>> It would be better IMO if it were part of the instruction, but there
>>>> isn't really any good / non-annoying way to encode this.
>>> <
>>> And this is why they are put in control/status registers.
>>> <
>>
>> There are several problems with this, but the *main* problem is that the
>> rounding mode setting becomes a super-global variable. If one subroutine
>> touches the register, it affects all code in the same thread. And it's
>> "super-global" because it crosses source code and language barriers
>> (e.g. consider a program written in Go that has a Python scripting back
>> end that calls out to a DLL that is written in C++ that changes the
>> floating-point rounding mode...).
>>
>> As I have accounted for elsewhere, this is a real problem. As a SW
>> developer I therefore prefer to work with architectures that do not have
>> an FPU control register - /even/ if that means that I can only use RNE
>> (because let's face it - that's the only rounding mode I'm ever going
>> to use anyway).
>
> Do you use C? On x86 convertion from floating point to integers
> were implemented by setting rouding mode and store. Due to C
> rules mode was "round towards zero".
>

If one has an ISA with hard-coded rounding modes, then the instruction
for converting to integer can itself be defined as either
truncate-towards-zero or round towards negative infinity.

Though, FWIW, the rounding the conversions towards negative infinity
might have made more sense and been less annoying:
0.5 -> 0
-0.5 -> -1
...

But, alas, this is one of those "if you poke this, software will break"
areas...

Sort of stuck with it in much the same way as integer promotions
favoring promotion to unsigned types rather than to signed types.

Though, seemingly as absurd as it is, the promotion to unsigned
typically makes more sense in the contexts where it comes up than
promotion to signed would have.

>> Having the rounding modes as part of the instruction is *much* better
>> from a SW developer's perspective - but that blows up opcode space for
>> a feature that is never used.
>
> At least for store it may be quite important: on Pentium my FP program
> spent about 50% (or more) of time changing rounding modes for convertion
> from floats to integers. There was something like 20 FP operations
> and the result was converted to integer (this was inside a loop
> that iterated many times).
>

I have vague memories of one time where a loop was doing conversions of
this sort. The compiler resorted to doing autovectorization which
produced something sufficiently awful (some gigantic mess of vector
operations) that it was actually faster to do the type conversion via a
function call which did the conversion via manual bit twiddling (which
at least defeated the vectorization).

There were pragmas that were supposed to turn the autovectorization off,
but they were not working...

This sort of thing has led me to have a negative position towards
autovectorization, as sometimes it helps, but often it makes things a
lot worse. If it were up to me, things like vectorization and loop
unrolling would have explicit attributes, say:
[[unroll]] for(i=0; i<10; i++) { do_something; }
[[no_unroll]] for(i=0; i<10; i++) { do_something; }

Where, the former requests that the compiler do this, and the latter
forbids it (by extension, it would also forbid things like
autovectorization).

Re: The value of floating-point exceptions?

<sdunpq$io1$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19306&group=comp.arch#19306

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: m.del...@this.bitsnbites.eu (Marcus)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Thu, 29 Jul 2021 19:16:42 +0200
Organization: A noiseless patient Spider
Lines: 52
Message-ID: <sdunpq$io1$1@dont-email.me>
References: <sd9a9h$ro6$1@dont-email.me>
<e9c738bd-7c0e-4b3b-9385-3a0d0658b059n@googlegroups.com>
<a74c6bf2-9ad1-4969-b3cb-b650ae8ebdadn@googlegroups.com>
<sde6m7$kr1$1@dont-email.me> <sde74m$nio$1@dont-email.me>
<7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com>
<e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com>
<fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com>
<713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com>
<sdjghd$1i4a$1@gioia.aioe.org> <sdk2kd$lu1$1@dont-email.me>
<476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com>
<sdlo5n$da3$1@dont-email.me>
<1f8827fe-a288-4f2e-8e4e-40cc343febbdn@googlegroups.com>
<48d7c07e-2684-4eb8-a480-a40664c48493n@googlegroups.com>
<922f7388-1131-45c1-a8ef-cb4e61fbc4f1n@googlegroups.com>
<sdog27$jc1$1@dont-email.me>
<f518be30-3b21-4d38-ad4f-42118055634cn@googlegroups.com>
<sdphtb$nkp$1@dont-email.me> <sdro37$re5$1@dont-email.me>
<907ad68e-9672-4406-83e9-03114f9339a1n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 29 Jul 2021 17:16:42 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="fdd2882c4a37cf078563d7c3c596eea0";
logging-data="19201"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19nsD9JAhGo3LOAotw6dlDeVtlXHaTGyUw="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:+0c52HK5+IY2lp70GV5qGhnl9VE=
In-Reply-To: <907ad68e-9672-4406-83e9-03114f9339a1n@googlegroups.com>
Content-Language: en-US
 by: Marcus - Thu, 29 Jul 2021 17:16 UTC

On 2021-07-28 21:53, Quadibloc wrote:
> On Wednesday, July 28, 2021 at 8:03:21 AM UTC-6, Marcus wrote:
>
>> My interpretation of the situation is that IEEE 754 was largely inspired
>> by x87 (and similar architectures), and later IEEE 754 conformant
>> implementations mimicked that design (in order to be standard
>> compliant, if nothing else).
>
> As this is _basically_ true, I saw no need to correct you, but since
> other people have, but their corrections are... in my view, somewhat
> incomplete... I now think I need to speak up.

Thanks for the clarifications! I was mostly extrapolating...

But I think that my point still stands: Back when the original IEEE 754
standard was written, using an RM register was in line with contemporary
hardware designs (and their constraints & goals).

However, I claim that such an approach is outdated, if not from a
hardware perspective, at least from a software development perspective.

While an RM register /can/ be used in a way that guarantees predictable
behavior, /if/ you add stringent mechanisms in programming languages and
ABI:s (which is unfortunately largely missing ATM), it is still a very
large and loaded gun aiming at your feet [1].

On the other hand, if you encode the rounding mode as part of the
instruction you are 100% guaranteed to get predictable and intended
behavior.

>
> Intel's 8087 did not pre-date the IEEE 754 standard.
>
> But Intel was working on the 8087 at the time that the IEEE 754
> standard was being drawn up. And what it presented to the committee
> drawing it up was basically the *specification* for the 8087.
>
> Which they adopted, minus a few of the rounding modes that the
> original 8087 provided.
>
> This was despite the fact that until Intel got their patents in hand,
> Kahan wasn't able to reveal that, yes, it was actually possible to
> achieve the perfect rounding that it was desired to include in the
> standard. But eventually the secret of guard, round, and sticky
> did get revealed in time.
>
> John Savard
>

[1]
https://blog.aopa.org/aopa/wp-content/uploads/2016/06/how_to_shoot_yourself_in_the_foot.jpg

Re: The value of floating-point exceptions?

<sdunr1$qje$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19307&group=comp.arch#19307

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!aioe.org!aoTW/Fm1++YcllHDt9jnUQ.user.46.165.242.91.POSTED!not-for-mail
From: terje.ma...@tmsw.no (Terje Mathisen)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Thu, 29 Jul 2021 19:17:21 +0200
Organization: Aioe.org NNTP Server
Message-ID: <sdunr1$qje$1@gioia.aioe.org>
References: <sd9a9h$ro6$1@dont-email.me> <sde6m7$kr1$1@dont-email.me>
<sde74m$nio$1@dont-email.me>
<7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com>
<e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com>
<fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com>
<713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com>
<sdjghd$1i4a$1@gioia.aioe.org> <sdk2kd$lu1$1@dont-email.me>
<476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com>
<sdlo5n$da3$1@dont-email.me> <sdua2r$avt$1@z-news.wcss.wroc.pl>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="27246"; posting-host="aoTW/Fm1++YcllHDt9jnUQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101
Firefox/60.0 SeaMonkey/2.53.8.1
X-Notice: Filtered by postfilter v. 0.9.2
 by: Terje Mathisen - Thu, 29 Jul 2021 17:17 UTC

antispam@math.uni.wroc.pl wrote:
> Marcus <m.delete@this.bitsnbites.eu> wrote:
>> As I have accounted for elsewhere, this is a real problem. As a SW
>> developer I therefore prefer to work with architectures that do not have
>> an FPU control register - /even/ if that means that I can only use RNE
>> (because let's face it - that's the only rounding mode I'm ever going
>> to use anyway).
>
> Do you use C? On x86 convertion from floating point to integers
> were implemented by setting rouding mode and store. Due to C
> rules mode was "round towards zero".
>
>> Having the rounding modes as part of the instruction is *much* better
>> from a SW developer's perspective - but that blows up opcode space for
>> a feature that is never used.
>
> At least for store it may be quite important: on Pentium my FP program
> spent about 50% (or more) of time changing rounding modes for convertion
> from floats to integers. There was something like 20 FP operations
> and the result was converted to integer (this was inside a loop
> that iterated many times).

At this point you should consider using an old hack: Assuming your input
values does not need the full 53-bit range, you can add a FP bias value
(typically 2^53 or a binary power larger than the maximum input), store
to memory and extract the integer part from the FP mantissa with shift &
mask.

Terje

--
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

Re: The value of floating-point exceptions?

<memo.20210729184106.14388I@jgd.cix.co.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19308&group=comp.arch#19308

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: jgd...@cix.co.uk (John Dallman)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Thu, 29 Jul 2021 18:41 +0100 (BST)
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <memo.20210729184106.14388I@jgd.cix.co.uk>
References: <sdua2r$avt$1@z-news.wcss.wroc.pl>
Reply-To: jgd@cix.co.uk
Injection-Info: reader02.eternal-september.org; posting-host="d6079561d0e3d8bd5b114384eb192846";
logging-data="5372"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+fFwVsql32QHk6JcqDB1LjkM/qiQR1RWY="
Cancel-Lock: sha1:XsDg/PQpw4ePZKREkEJGoqzN4mc=
 by: John Dallman - Thu, 29 Jul 2021 17:41 UTC

In article <sdua2r$avt$1@z-news.wcss.wroc.pl>, antispam@math.uni.wroc.pl
() wrote:

> Do you use C? On x86 convertion from floating point to integers
> were implemented by setting rouding mode and store. Due to C
> rules mode was "round towards zero".

> At least for store it may be quite important: on Pentium my FP
> program spent about 50% (or more) of time changing rounding modes
> for convertion from floats to integers.

This was fixed with the SSE2 instruction set extension, in 2001. SSE2 has
conversion instructions specifically for C. Even Microsoft have changed
the default floating-point instruction set to SSE2, as of Visual Studio
2015.

John

Re: The value of floating-point exceptions?

<fdb4eae9-2315-44bd-9e34-28c437cdb592n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19312&group=comp.arch#19312

  copy link   Newsgroups: comp.arch
X-Received: by 2002:ac8:5e46:: with SMTP id i6mr5480812qtx.326.1627583701680; Thu, 29 Jul 2021 11:35:01 -0700 (PDT)
X-Received: by 2002:a05:6808:5d3:: with SMTP id d19mr2472405oij.155.1627583701496; Thu, 29 Jul 2021 11:35:01 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.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: comp.arch
Date: Thu, 29 Jul 2021 11:35:01 -0700 (PDT)
In-Reply-To: <sdunpq$io1$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:4d78:fd0f:f097:e375; posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:4d78:fd0f:f097:e375
References: <sd9a9h$ro6$1@dont-email.me> <e9c738bd-7c0e-4b3b-9385-3a0d0658b059n@googlegroups.com> <a74c6bf2-9ad1-4969-b3cb-b650ae8ebdadn@googlegroups.com> <sde6m7$kr1$1@dont-email.me> <sde74m$nio$1@dont-email.me> <7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com> <e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com> <fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com> <713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com> <sdjghd$1i4a$1@gioia.aioe.org> <sdk2kd$lu1$1@dont-email.me> <476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com> <sdlo5n$da3$1@dont-email.me> <1f8827fe-a288-4f2e-8e4e-40cc343febbdn@googlegroups.com> <48d7c07e-2684-4eb8-a480-a40664c48493n@googlegroups.com> <922f7388-1131-45c1-a8ef-cb4e61fbc4f1n@googlegroups.com> <sdog27$jc1$1@dont-email.me> <f518be30-3b21-4d38-ad4f-42118055634cn@googlegroups.com> <sdphtb$nkp$1@dont-email.me> <sdro37$re5$1@dont-email.me> <907ad68e-9672-4406-83e9-03114f9339a1n@googlegroups.com> <sdunpq$io1$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fdb4eae9-2315-44bd-9e34-28c437cdb592n@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Thu, 29 Jul 2021 18:35:01 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 64
 by: MitchAlsup - Thu, 29 Jul 2021 18:35 UTC

On Thursday, July 29, 2021 at 12:16:45 PM UTC-5, Marcus wrote:
> On 2021-07-28 21:53, Quadibloc wrote:
> > On Wednesday, July 28, 2021 at 8:03:21 AM UTC-6, Marcus wrote:
> >
> >> My interpretation of the situation is that IEEE 754 was largely inspired
> >> by x87 (and similar architectures), and later IEEE 754 conformant
> >> implementations mimicked that design (in order to be standard
> >> compliant, if nothing else).
> >
> > As this is _basically_ true, I saw no need to correct you, but since
> > other people have, but their corrections are... in my view, somewhat
> > incomplete... I now think I need to speak up.
<
> Thanks for the clarifications! I was mostly extrapolating...
>
> But I think that my point still stands: Back when the original IEEE 754
> standard was written, using an RM register was in line with contemporary
> hardware designs (and their constraints & goals).
>
> However, I claim that such an approach is outdated, if not from a
> hardware perspective, at least from a software development perspective.
>
> While an RM register /can/ be used in a way that guarantees predictable
> behavior, /if/ you add stringent mechanisms in programming languages and
> ABI:s (which is unfortunately largely missing ATM), it is still a very
> large and loaded gun aiming at your feet [1].
>
> On the other hand, if you encode the rounding mode as part of the
> instruction you are 100% guaranteed to get predictable and intended
> behavior.
<
How do you compile::
<
for( i = 0 i < max i+=4 )
{ setRoundingMode(rm[i]);
a = b + c;
setRoundingMode(rm[i+1]);
d = a * f;
setRoundingMode(rm[i+2]);
b = d / g;
setRoundingMode(rm[i+4]);
c = sqrt( d*b );
} using instruction only rounding modes ?
> >
> > Intel's 8087 did not pre-date the IEEE 754 standard.
> >
> > But Intel was working on the 8087 at the time that the IEEE 754
> > standard was being drawn up. And what it presented to the committee
> > drawing it up was basically the *specification* for the 8087.
> >
> > Which they adopted, minus a few of the rounding modes that the
> > original 8087 provided.
> >
> > This was despite the fact that until Intel got their patents in hand,
> > Kahan wasn't able to reveal that, yes, it was actually possible to
> > achieve the perfect rounding that it was desired to include in the
> > standard. But eventually the secret of guard, round, and sticky
> > did get revealed in time.
> >
> > John Savard
> >
> [1]
> https://blog.aopa.org/aopa/wp-content/uploads/2016/06/how_to_shoot_yourself_in_the_foot.jpg

Re: The value of floating-point exceptions?

<sdutr9$ue4$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19314&group=comp.arch#19314

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: m.del...@this.bitsnbites.eu (Marcus)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Thu, 29 Jul 2021 20:59:43 +0200
Organization: A noiseless patient Spider
Lines: 85
Message-ID: <sdutr9$ue4$1@dont-email.me>
References: <sd9a9h$ro6$1@dont-email.me>
<a74c6bf2-9ad1-4969-b3cb-b650ae8ebdadn@googlegroups.com>
<sde6m7$kr1$1@dont-email.me> <sde74m$nio$1@dont-email.me>
<7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com>
<e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com>
<fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com>
<713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com>
<sdjghd$1i4a$1@gioia.aioe.org> <sdk2kd$lu1$1@dont-email.me>
<476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com>
<sdlo5n$da3$1@dont-email.me>
<1f8827fe-a288-4f2e-8e4e-40cc343febbdn@googlegroups.com>
<48d7c07e-2684-4eb8-a480-a40664c48493n@googlegroups.com>
<922f7388-1131-45c1-a8ef-cb4e61fbc4f1n@googlegroups.com>
<sdog27$jc1$1@dont-email.me>
<f518be30-3b21-4d38-ad4f-42118055634cn@googlegroups.com>
<sdphtb$nkp$1@dont-email.me> <sdro37$re5$1@dont-email.me>
<907ad68e-9672-4406-83e9-03114f9339a1n@googlegroups.com>
<sdunpq$io1$1@dont-email.me>
<fdb4eae9-2315-44bd-9e34-28c437cdb592n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 29 Jul 2021 18:59:53 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="fdd2882c4a37cf078563d7c3c596eea0";
logging-data="31172"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+C6lB0HCSZzi/jAoP+NSC/AA6EDJopJpQ="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:OtexL+k4LoQjHbS/aQOEYbi1Cj8=
In-Reply-To: <fdb4eae9-2315-44bd-9e34-28c437cdb592n@googlegroups.com>
Content-Language: en-US
 by: Marcus - Thu, 29 Jul 2021 18:59 UTC

On 2021-07-29 20:35, MitchAlsup wrote:
> On Thursday, July 29, 2021 at 12:16:45 PM UTC-5, Marcus wrote:
>> On 2021-07-28 21:53, Quadibloc wrote:
>>> On Wednesday, July 28, 2021 at 8:03:21 AM UTC-6, Marcus wrote:
>>>
>>>> My interpretation of the situation is that IEEE 754 was largely inspired
>>>> by x87 (and similar architectures), and later IEEE 754 conformant
>>>> implementations mimicked that design (in order to be standard
>>>> compliant, if nothing else).
>>>
>>> As this is _basically_ true, I saw no need to correct you, but since
>>> other people have, but their corrections are... in my view, somewhat
>>> incomplete... I now think I need to speak up.
> <
>> Thanks for the clarifications! I was mostly extrapolating...
>>
>> But I think that my point still stands: Back when the original IEEE 754
>> standard was written, using an RM register was in line with contemporary
>> hardware designs (and their constraints & goals).
>>
>> However, I claim that such an approach is outdated, if not from a
>> hardware perspective, at least from a software development perspective.
>>
>> While an RM register /can/ be used in a way that guarantees predictable
>> behavior, /if/ you add stringent mechanisms in programming languages and
>> ABI:s (which is unfortunately largely missing ATM), it is still a very
>> large and loaded gun aiming at your feet [1].
>>
>> On the other hand, if you encode the rounding mode as part of the
>> instruction you are 100% guaranteed to get predictable and intended
>> behavior.
> <
> How do you compile::
> <
> for( i = 0 i < max i+=4 )
> {
> setRoundingMode(rm[i]);
> a = b + c;
> setRoundingMode(rm[i+1]);
> d = a * f;
> setRoundingMode(rm[i+2]);
> b = d / g;
> setRoundingMode(rm[i+4]);
> c = sqrt( d*b );
> }
> using instruction only rounding modes ?

You don't (at least not in that exact form). You would have to
explicitly code the dynamic part using a switch/case statement or such,
same as you would do if you wanted to dynamically select single
precision or double-precision.

....and forgive me for saying so, but the example feels kind of silly. I
doubt that it would ever end up in production code (if someone would
need to do something similar in a performant manner, JIT would probably
be a more suitable solution). In experimental code (e.g. to explore
rounding & precision influences on an algorithm), I might have used a
more flexible solution like Fabrice Bellard's SoftFP [1] or LibBF [2].

/Marcus

[1] https://bellard.org/softfp/
[2] https://bellard.org/libbf/

>>>
>>> Intel's 8087 did not pre-date the IEEE 754 standard.
>>>
>>> But Intel was working on the 8087 at the time that the IEEE 754
>>> standard was being drawn up. And what it presented to the committee
>>> drawing it up was basically the *specification* for the 8087.
>>>
>>> Which they adopted, minus a few of the rounding modes that the
>>> original 8087 provided.
>>>
>>> This was despite the fact that until Intel got their patents in hand,
>>> Kahan wasn't able to reveal that, yes, it was actually possible to
>>> achieve the perfect rounding that it was desired to include in the
>>> standard. But eventually the secret of guard, round, and sticky
>>> did get revealed in time.
>>>
>>> John Savard
>>>
>> [1]
>> https://blog.aopa.org/aopa/wp-content/uploads/2016/06/how_to_shoot_yourself_in_the_foot.jpg

Re: The value of floating-point exceptions?

<sdutsq$v88$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19315&group=comp.arch#19315

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: cr88...@gmail.com (BGB)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Thu, 29 Jul 2021 14:00:39 -0500
Organization: A noiseless patient Spider
Lines: 54
Message-ID: <sdutsq$v88$1@dont-email.me>
References: <sd9a9h$ro6$1@dont-email.me> <sde6m7$kr1$1@dont-email.me>
<sde74m$nio$1@dont-email.me>
<7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com>
<e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com>
<fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com>
<713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com>
<sdjghd$1i4a$1@gioia.aioe.org> <sdk2kd$lu1$1@dont-email.me>
<476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com>
<sdlo5n$da3$1@dont-email.me> <sdua2r$avt$1@z-news.wcss.wroc.pl>
<sdunr1$qje$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 29 Jul 2021 19:00:42 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="02163751defd1f58c9555c09cfa5b411";
logging-data="32008"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+cud5yA2B7WA/Qbb8XkWk7"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.12.0
Cancel-Lock: sha1:SqWpPg4KDeXb0yjtG5xWcczi6nQ=
In-Reply-To: <sdunr1$qje$1@gioia.aioe.org>
Content-Language: en-US
 by: BGB - Thu, 29 Jul 2021 19:00 UTC

On 7/29/2021 12:17 PM, Terje Mathisen wrote:
> antispam@math.uni.wroc.pl wrote:
>> Marcus <m.delete@this.bitsnbites.eu> wrote:
>>> As I have accounted for elsewhere, this is a real problem. As a SW
>>> developer I therefore prefer to work with architectures that do not have
>>> an FPU control register - /even/ if that means that I can only use RNE
>>> (because let's face it - that's the only rounding mode I'm ever going
>>> to use anyway).
>>
>> Do you use C?  On x86 convertion from floating point to integers
>> were implemented by setting rouding mode and store.  Due to C
>> rules mode was "round towards zero".
>>
>>> Having the rounding modes as part of the instruction is *much* better
>>> from a SW developer's perspective - but that blows up opcode space for
>>> a feature that is never used.
>>
>> At least for store it may be quite important: on Pentium my FP program
>> spent about 50% (or more) of time changing rounding modes for convertion
>> from floats to integers.  There was something like 20 FP operations
>> and the result was converted to integer (this was inside a loop
>> that iterated many times).
>
> At this point you should consider using an old hack: Assuming your input
> values does not need the full 53-bit range, you can add a FP bias value
> (typically 2^53 or a binary power larger than the maximum input), store
> to memory and extract the integer part from the FP mantissa with shift &
> mask.
>

FWIW...

This is actually more or less how my FPU itself implements Float->Int
conversion. It adds a large synthetic value and then extracts the value
from the mantissa, though its value is a little bigger as it can make
use of the intermediate mantissa being large enough to hold a 64-bit
integer value.

It can then extract the output value from the mantissa.
Of course, this mechanism breaks down if the value goes sufficiently far
outside the 64-bit integer range.

A similar process can also be used for Int->Float, just it is an FADD
between a synthetic large denormal value (hidden bit is 0) and a zero.
The FADD's renormalizer then fixes it up on the output side.

In a few edge cases like this, it could be useful to be able to encode
such large denormals as inputs to other operations, but alas. No real
way to do this within the IEEE formats.

> Terje
>

Re: The value of floating-point exceptions?

<sdv19d$2t7$3@z-news.wcss.wroc.pl>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19320&group=comp.arch#19320

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!news-out.netnews.com!news.alt.net!fdc3.netnews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!newsfeed.pionier.net.pl!pwr.wroc.pl!news.wcss.wroc.pl!not-for-mail
From: antis...@math.uni.wroc.pl
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Thu, 29 Jul 2021 19:58:37 +0000 (UTC)
Organization: Politechnika Wroclawska
Lines: 37
Message-ID: <sdv19d$2t7$3@z-news.wcss.wroc.pl>
References: <sd9a9h$ro6$1@dont-email.me> <7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com> <e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com> <fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com> <713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com> <sdjghd$1i4a$1@gioia.aioe.org> <sdk2kd$lu1$1@dont-email.me> <476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com> <sdlo5n$da3$1@dont-email.me> <sdua2r$avt$1@z-news.wcss.wroc.pl> <sdunr1$qje$1@gioia.aioe.org>
NNTP-Posting-Host: hera.math.uni.wroc.pl
X-Trace: z-news.wcss.wroc.pl 1627588717 2983 156.17.86.1 (29 Jul 2021 19:58:37 GMT)
X-Complaints-To: abuse@news.pwr.wroc.pl
NNTP-Posting-Date: Thu, 29 Jul 2021 19:58:37 +0000 (UTC)
Cancel-Lock: sha1:iTY6CYJ+h93gXdej4RIit32UyoE=
User-Agent: tin/2.4.3-20181224 ("Glen Mhor") (UNIX) (Linux/4.19.0-10-amd64 (x86_64))
X-Received-Bytes: 3144
 by: antis...@math.uni.wroc.pl - Thu, 29 Jul 2021 19:58 UTC

Terje Mathisen <terje.mathisen@tmsw.no> wrote:
> antispam@math.uni.wroc.pl wrote:
> > Marcus <m.delete@this.bitsnbites.eu> wrote:
> >> As I have accounted for elsewhere, this is a real problem. As a SW
> >> developer I therefore prefer to work with architectures that do not have
> >> an FPU control register - /even/ if that means that I can only use RNE
> >> (because let's face it - that's the only rounding mode I'm ever going
> >> to use anyway).
> >
> > Do you use C? On x86 convertion from floating point to integers
> > were implemented by setting rouding mode and store. Due to C
> > rules mode was "round towards zero".
> >
> >> Having the rounding modes as part of the instruction is *much* better
> >> from a SW developer's perspective - but that blows up opcode space for
> >> a feature that is never used.
> >
> > At least for store it may be quite important: on Pentium my FP program
> > spent about 50% (or more) of time changing rounding modes for convertion
> > from floats to integers. There was something like 20 FP operations
> > and the result was converted to integer (this was inside a loop
> > that iterated many times).
>
> At this point you should consider using an old hack: Assuming your input
> values does not need the full 53-bit range, you can add a FP bias value
> (typically 2^53 or a binary power larger than the maximum input), store
> to memory and extract the integer part from the FP mantissa with shift &
> mask.

For me rounding to nearest was preferable compared to C rule. Various
C rounding functions came later, so at first I used pure C with C
rule. When I identified the problem I replaced assignment in C
by gcc inline assemby doing the store in default round to nearest
mode...

--
Waldek Hebisch

Re: The value of floating-point exceptions?

<3aab6ec4-7ff0-4bac-9021-dffc8dc27d3en@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19322&group=comp.arch#19322

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:620a:2446:: with SMTP id h6mr6808114qkn.497.1627589414543; Thu, 29 Jul 2021 13:10:14 -0700 (PDT)
X-Received: by 2002:a05:6830:3109:: with SMTP id b9mr4701398ots.276.1627589414337; Thu, 29 Jul 2021 13:10:14 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!feeder5.feed.usenet.farm!feeder1.feed.usenet.farm!feed.usenet.farm!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.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: comp.arch
Date: Thu, 29 Jul 2021 13:10:14 -0700 (PDT)
In-Reply-To: <sdutr9$ue4$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:4d78:fd0f:f097:e375; posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:4d78:fd0f:f097:e375
References: <sd9a9h$ro6$1@dont-email.me> <a74c6bf2-9ad1-4969-b3cb-b650ae8ebdadn@googlegroups.com> <sde6m7$kr1$1@dont-email.me> <sde74m$nio$1@dont-email.me> <7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com> <e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com> <fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com> <713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com> <sdjghd$1i4a$1@gioia.aioe.org> <sdk2kd$lu1$1@dont-email.me> <476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com> <sdlo5n$da3$1@dont-email.me> <1f8827fe-a288-4f2e-8e4e-40cc343febbdn@googlegroups.com> <48d7c07e-2684-4eb8-a480-a40664c48493n@googlegroups.com> <922f7388-1131-45c1-a8ef-cb4e61fbc4f1n@googlegroups.com> <sdog27$jc1$1@dont-email.me> <f518be30-3b21-4d38-ad4f-42118055634cn@googlegroups.com> <sdphtb$nkp$1@dont-email.me> <sdro37$re5$1@dont-email.me> <907ad68e-9672-4406-83e9-03114f9339a1n@googlegroups.com> <sdunpq$io1$1@dont-email.me> <fdb4eae9-2315-44bd-9e34-28c437cdb592n@googlegroups.com> <sdutr9$ue4$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3aab6ec4-7ff0-4bac-9021-dffc8dc27d3en@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Thu, 29 Jul 2021 20:10:14 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 88
 by: MitchAlsup - Thu, 29 Jul 2021 20:10 UTC

On Thursday, July 29, 2021 at 1:59:56 PM UTC-5, Marcus wrote:
> On 2021-07-29 20:35, MitchAlsup wrote:
> > On Thursday, July 29, 2021 at 12:16:45 PM UTC-5, Marcus wrote:
> >> On 2021-07-28 21:53, Quadibloc wrote:
> >>> On Wednesday, July 28, 2021 at 8:03:21 AM UTC-6, Marcus wrote:
> >>>
> >>>> My interpretation of the situation is that IEEE 754 was largely inspired
> >>>> by x87 (and similar architectures), and later IEEE 754 conformant
> >>>> implementations mimicked that design (in order to be standard
> >>>> compliant, if nothing else).
> >>>
> >>> As this is _basically_ true, I saw no need to correct you, but since
> >>> other people have, but their corrections are... in my view, somewhat
> >>> incomplete... I now think I need to speak up.
> > <
> >> Thanks for the clarifications! I was mostly extrapolating...
> >>
> >> But I think that my point still stands: Back when the original IEEE 754
> >> standard was written, using an RM register was in line with contemporary
> >> hardware designs (and their constraints & goals).
> >>
> >> However, I claim that such an approach is outdated, if not from a
> >> hardware perspective, at least from a software development perspective.
> >>
> >> While an RM register /can/ be used in a way that guarantees predictable
> >> behavior, /if/ you add stringent mechanisms in programming languages and
> >> ABI:s (which is unfortunately largely missing ATM), it is still a very
> >> large and loaded gun aiming at your feet [1].
> >>
> >> On the other hand, if you encode the rounding mode as part of the
> >> instruction you are 100% guaranteed to get predictable and intended
> >> behavior.
> > <
> > How do you compile::
> > <
> > for( i = 0 i < max i+=4 )
> > {
> > setRoundingMode(rm[i]);
> > a = b + c;
> > setRoundingMode(rm[i+1]);
> > d = a * f;
> > setRoundingMode(rm[i+2]);
> > b = d / g;
> > setRoundingMode(rm[i+4]);
> > c = sqrt( d*b );
> > }
> > using instruction only rounding modes ?
> You don't (at least not in that exact form). You would have to
> explicitly code the dynamic part using a switch/case statement or such,
> same as you would do if you wanted to dynamically select single
> precision or double-precision.
>
> ...and forgive me for saying so, but the example feels kind of silly. I
> doubt that it would ever end up in production code
<
As noted above this is not for production code it is a test over the
algorithm to see if the algorithm is sufficiently stable to make it into
production code.
<
< (if someone would
> need to do something similar in a performant manner, JIT would probably
> be a more suitable solution). In experimental code (e.g. to explore
> rounding & precision influences on an algorithm), I might have used a
> more flexible solution like Fabrice Bellard's SoftFP [1] or LibBF [2].
>
> /Marcus
>
> [1] https://bellard.org/softfp/
> [2] https://bellard.org/libbf/
> >>>
> >>> Intel's 8087 did not pre-date the IEEE 754 standard.
> >>>
> >>> But Intel was working on the 8087 at the time that the IEEE 754
> >>> standard was being drawn up. And what it presented to the committee
> >>> drawing it up was basically the *specification* for the 8087.
> >>>
> >>> Which they adopted, minus a few of the rounding modes that the
> >>> original 8087 provided.
> >>>
> >>> This was despite the fact that until Intel got their patents in hand,
> >>> Kahan wasn't able to reveal that, yes, it was actually possible to
> >>> achieve the perfect rounding that it was desired to include in the
> >>> standard. But eventually the secret of guard, round, and sticky
> >>> did get revealed in time.
> >>>
> >>> John Savard
> >>>
> >> [1]
> >> https://blog.aopa.org/aopa/wp-content/uploads/2016/06/how_to_shoot_yourself_in_the_foot.jpg

Re: The value of floating-point exceptions?

<588a5b12-0b5b-4ef4-8d4d-6c9273dcb5dfn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19324&group=comp.arch#19324

  copy link   Newsgroups: comp.arch
X-Received: by 2002:ae9:e109:: with SMTP id g9mr7576865qkm.95.1627595339496;
Thu, 29 Jul 2021 14:48:59 -0700 (PDT)
X-Received: by 2002:a05:6830:1c1:: with SMTP id r1mr4800357ota.22.1627595339286;
Thu, 29 Jul 2021 14:48:59 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Thu, 29 Jul 2021 14:48:59 -0700 (PDT)
In-Reply-To: <sdv19d$2t7$3@z-news.wcss.wroc.pl>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:56a:f39c:db00:502:1a7:8e3:4239;
posting-account=1nOeKQkAAABD2jxp4Pzmx9Hx5g9miO8y
NNTP-Posting-Host: 2001:56a:f39c:db00:502:1a7:8e3:4239
References: <sd9a9h$ro6$1@dont-email.me> <7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com>
<e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com> <fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com>
<713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com> <sdjghd$1i4a$1@gioia.aioe.org>
<sdk2kd$lu1$1@dont-email.me> <476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com>
<sdlo5n$da3$1@dont-email.me> <sdua2r$avt$1@z-news.wcss.wroc.pl>
<sdunr1$qje$1@gioia.aioe.org> <sdv19d$2t7$3@z-news.wcss.wroc.pl>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <588a5b12-0b5b-4ef4-8d4d-6c9273dcb5dfn@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: jsav...@ecn.ab.ca (Quadibloc)
Injection-Date: Thu, 29 Jul 2021 21:48:59 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Quadibloc - Thu, 29 Jul 2021 21:48 UTC

On Thursday, July 29, 2021 at 1:58:39 PM UTC-6, anti...@math.uni.wroc.pl wrote:

> For me rounding to nearest was preferable compared to C rule.

I should think that it would be for *anyone*. Certainly it would be
for Fortran programmers, some of whom have to make do with
C instead due to availability issues.

What on Earth possessed them to make such a rule for C?

Of course, the System/360's rounding mode was truncation,
similar or equivalent to round towards zero (given that floating-point
was sign-magnitude) and I suppose that it may avoid some issues
in converting to integer or something like that, though I thought it
was just ease of implementation.

And, of course, the C language long predates the 8087 and the
IEEE 754 standard, and so what would be the point of specifying
a rounding mode, when at the time most computers did not _have_
a choice of rounding modes?

I suppose they could have added that part of the C standard
after the Kernaghan and Ritchie days, though, since they
definitely made _other_ changes to C since then.

John Savard

Re: The value of floating-point exceptions?

<sdv9f6$2t7$4@z-news.wcss.wroc.pl>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19326&group=comp.arch#19326

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!news.uzoreto.com!news-out.netnews.com!news.alt.net!fdc3.netnews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!newsfeed.pionier.net.pl!pwr.wroc.pl!news.wcss.wroc.pl!not-for-mail
From: antis...@math.uni.wroc.pl
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Thu, 29 Jul 2021 22:18:14 +0000 (UTC)
Organization: Politechnika Wroclawska
Lines: 32
Message-ID: <sdv9f6$2t7$4@z-news.wcss.wroc.pl>
References: <sd9a9h$ro6$1@dont-email.me> <fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com> <713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com> <sdjghd$1i4a$1@gioia.aioe.org> <sdk2kd$lu1$1@dont-email.me> <476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com> <sdlo5n$da3$1@dont-email.me> <sdua2r$avt$1@z-news.wcss.wroc.pl> <sdunr1$qje$1@gioia.aioe.org> <sdv19d$2t7$3@z-news.wcss.wroc.pl> <588a5b12-0b5b-4ef4-8d4d-6c9273dcb5dfn@googlegroups.com>
NNTP-Posting-Host: hera.math.uni.wroc.pl
X-Trace: z-news.wcss.wroc.pl 1627597094 2983 156.17.86.1 (29 Jul 2021 22:18:14 GMT)
X-Complaints-To: abuse@news.pwr.wroc.pl
NNTP-Posting-Date: Thu, 29 Jul 2021 22:18:14 +0000 (UTC)
Cancel-Lock: sha1:E3FkRpFOKuGzm0cLR7I3TvuOXds=
User-Agent: tin/2.4.3-20181224 ("Glen Mhor") (UNIX) (Linux/4.19.0-10-amd64 (x86_64))
X-Received-Bytes: 2603
 by: antis...@math.uni.wroc.pl - Thu, 29 Jul 2021 22:18 UTC

Quadibloc <jsavard@ecn.ab.ca> wrote:
> On Thursday, July 29, 2021 at 1:58:39 PM UTC-6, anti...@math.uni.wroc.pl wrote:
>
> > For me rounding to nearest was preferable compared to C rule.
>
> I should think that it would be for *anyone*. Certainly it would be
> for Fortran programmers, some of whom have to make do with
> C instead due to availability issues.
>
> What on Earth possessed them to make such a rule for C?
>
> Of course, the System/360's rounding mode was truncation,
> similar or equivalent to round towards zero (given that floating-point
> was sign-magnitude) and I suppose that it may avoid some issues
> in converting to integer or something like that, though I thought it
> was just ease of implementation.
>
> And, of course, the C language long predates the 8087 and the
> IEEE 754 standard, and so what would be the point of specifying
> a rounding mode, when at the time most computers did not _have_
> a choice of rounding modes?

Anybody knows what PDP-11 did?

> I suppose they could have added that part of the C standard
> after the Kernaghan and Ritchie days, though, since they
> definitely made _other_ changes to C since then.

The rule is in my copy of (translation of) orignal K&R book.

--
Waldek Hebisch

Re: The value of floating-point exceptions?

<f586970f-d104-482f-b26a-70a145da70cbn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19328&group=comp.arch#19328

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:6214:f66:: with SMTP id iy6mr7358780qvb.58.1627597703322;
Thu, 29 Jul 2021 15:28:23 -0700 (PDT)
X-Received: by 2002:a05:6808:6cc:: with SMTP id m12mr11728037oih.51.1627597703022;
Thu, 29 Jul 2021 15:28:23 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Thu, 29 Jul 2021 15:28:22 -0700 (PDT)
In-Reply-To: <588a5b12-0b5b-4ef4-8d4d-6c9273dcb5dfn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:4d78:fd0f:f097:e375;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:4d78:fd0f:f097:e375
References: <sd9a9h$ro6$1@dont-email.me> <7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com>
<e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com> <fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com>
<713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com> <sdjghd$1i4a$1@gioia.aioe.org>
<sdk2kd$lu1$1@dont-email.me> <476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com>
<sdlo5n$da3$1@dont-email.me> <sdua2r$avt$1@z-news.wcss.wroc.pl>
<sdunr1$qje$1@gioia.aioe.org> <sdv19d$2t7$3@z-news.wcss.wroc.pl> <588a5b12-0b5b-4ef4-8d4d-6c9273dcb5dfn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f586970f-d104-482f-b26a-70a145da70cbn@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Thu, 29 Jul 2021 22:28:23 +0000
Content-Type: text/plain; charset="UTF-8"
 by: MitchAlsup - Thu, 29 Jul 2021 22:28 UTC

On Thursday, July 29, 2021 at 4:49:00 PM UTC-5, Quadibloc wrote:
> On Thursday, July 29, 2021 at 1:58:39 PM UTC-6, anti...@math.uni.wroc.pl wrote:
>
> > For me rounding to nearest was preferable compared to C rule.
> I should think that it would be for *anyone*. Certainly it would be
> for Fortran programmers, some of whom have to make do with
> C instead due to availability issues.
<
FORTRAN programmers have had INT, CEIL, FLOOR, TRUNC, and NINT since
I learned FORTRAN in 1969.
>
> What on Earth possessed them to make such a rule for C?
<
principle of least surprise creates greater average surprise !
>
> Of course, the System/360's rounding mode was truncation,
> similar or equivalent to round towards zero (given that floating-point
> was sign-magnitude) and I suppose that it may avoid some issues
> in converting to integer or something like that, though I thought it
> was just ease of implementation.
<
Yes S/360 had no problem in implementing INT, CEIL, FLOOR, TRUNC, and NINT
>
> And, of course, the C language long predates the 8087 and the
> IEEE 754 standard, and so what would be the point of specifying
> a rounding mode, when at the time most computers did not _have_
> a choice of rounding modes?
<
While choice of rounding mode is new-ish, the ability to specify the
kind of rounding in FP->integer conversions goes WAY BACK.
>
> I suppose they could have added that part of the C standard
> after the Kernaghan and Ritchie days, though, since they
> definitely made _other_ changes to C since then.
>
> John Savard

Re: The value of floating-point exceptions?

<97b4021e-c476-4dea-bfc9-ac2f5c382dc1n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19330&group=comp.arch#19330

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a37:7c7:: with SMTP id 190mr7413836qkh.269.1627598078296; Thu, 29 Jul 2021 15:34:38 -0700 (PDT)
X-Received: by 2002:a05:6808:158a:: with SMTP id t10mr11637651oiw.175.1627598076555; Thu, 29 Jul 2021 15:34:36 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.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: comp.arch
Date: Thu, 29 Jul 2021 15:34:36 -0700 (PDT)
In-Reply-To: <sdv9f6$2t7$4@z-news.wcss.wroc.pl>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:4d78:fd0f:f097:e375; posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:4d78:fd0f:f097:e375
References: <sd9a9h$ro6$1@dont-email.me> <fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com> <713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com> <sdjghd$1i4a$1@gioia.aioe.org> <sdk2kd$lu1$1@dont-email.me> <476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com> <sdlo5n$da3$1@dont-email.me> <sdua2r$avt$1@z-news.wcss.wroc.pl> <sdunr1$qje$1@gioia.aioe.org> <sdv19d$2t7$3@z-news.wcss.wroc.pl> <588a5b12-0b5b-4ef4-8d4d-6c9273dcb5dfn@googlegroups.com> <sdv9f6$2t7$4@z-news.wcss.wroc.pl>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <97b4021e-c476-4dea-bfc9-ac2f5c382dc1n@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Thu, 29 Jul 2021 22:34:38 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 37
 by: MitchAlsup - Thu, 29 Jul 2021 22:34 UTC

On Thursday, July 29, 2021 at 5:18:16 PM UTC-5, anti...@math.uni.wroc.pl wrote:
> Quadibloc <jsa...@ecn.ab.ca> wrote:
> > On Thursday, July 29, 2021 at 1:58:39 PM UTC-6, anti...@math.uni.wroc.pl wrote:
> >
> > > For me rounding to nearest was preferable compared to C rule.
> >
> > I should think that it would be for *anyone*. Certainly it would be
> > for Fortran programmers, some of whom have to make do with
> > C instead due to availability issues.
> >
> > What on Earth possessed them to make such a rule for C?
> >
> > Of course, the System/360's rounding mode was truncation,
> > similar or equivalent to round towards zero (given that floating-point
> > was sign-magnitude) and I suppose that it may avoid some issues
> > in converting to integer or something like that, though I thought it
> > was just ease of implementation.
> >
> > And, of course, the C language long predates the 8087 and the
> > IEEE 754 standard, and so what would be the point of specifying
> > a rounding mode, when at the time most computers did not _have_
> > a choice of rounding modes?
<
> Anybody knows what PDP-11 did?
<
DPD-11 had a control/status register, and a bit in that status register
when 0 indicated round and when 1 indicated truncate.
<
Other bits were generally for interrupt enables and the FP condition codes.
<
> > I suppose they could have added that part of the C standard
> > after the Kernaghan and Ritchie days, though, since they
> > definitely made _other_ changes to C since then.
<
> The rule is in my copy of (translation of) orignal K&R book.
>
> --
> Waldek Hebisch

Re: The value of floating-point exceptions?

<644bb0b4-8deb-478d-ba65-c92a1e0565a6n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19341&group=comp.arch#19341

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:620a:1193:: with SMTP id b19mr410999qkk.439.1627618495313;
Thu, 29 Jul 2021 21:14:55 -0700 (PDT)
X-Received: by 2002:a9d:6f84:: with SMTP id h4mr607994otq.240.1627618494972;
Thu, 29 Jul 2021 21:14:54 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!feeder1.feed.usenet.farm!feed.usenet.farm!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Thu, 29 Jul 2021 21:14:54 -0700 (PDT)
In-Reply-To: <f586970f-d104-482f-b26a-70a145da70cbn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:56a:f39c:db00:64ce:1147:1ca3:6a59;
posting-account=1nOeKQkAAABD2jxp4Pzmx9Hx5g9miO8y
NNTP-Posting-Host: 2001:56a:f39c:db00:64ce:1147:1ca3:6a59
References: <sd9a9h$ro6$1@dont-email.me> <7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com>
<e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com> <fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com>
<713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com> <sdjghd$1i4a$1@gioia.aioe.org>
<sdk2kd$lu1$1@dont-email.me> <476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com>
<sdlo5n$da3$1@dont-email.me> <sdua2r$avt$1@z-news.wcss.wroc.pl>
<sdunr1$qje$1@gioia.aioe.org> <sdv19d$2t7$3@z-news.wcss.wroc.pl>
<588a5b12-0b5b-4ef4-8d4d-6c9273dcb5dfn@googlegroups.com> <f586970f-d104-482f-b26a-70a145da70cbn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <644bb0b4-8deb-478d-ba65-c92a1e0565a6n@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: jsav...@ecn.ab.ca (Quadibloc)
Injection-Date: Fri, 30 Jul 2021 04:14:55 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2234
 by: Quadibloc - Fri, 30 Jul 2021 04:14 UTC

On Thursday, July 29, 2021 at 4:28:25 PM UTC-6, MitchAlsup wrote:

> Yes S/360 had no problem in implementing INT, CEIL, FLOOR, TRUNC, and NINT

Are we talking about two different things here?

Of course there were functions in FORTRAN to produce the nearest
integer to a floating-point number... but rounding modes that applied
to every calculation? I did not think the S/360 had any such feature -
it was strictly truncation, even after they at least put in a guard digit.

John Savard

Re: The value of floating-point exceptions?

<42810977-4463-42a6-93fa-66dde113fa2cn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19342&group=comp.arch#19342

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:620a:1593:: with SMTP id d19mr456436qkk.472.1627618562706;
Thu, 29 Jul 2021 21:16:02 -0700 (PDT)
X-Received: by 2002:a05:6830:3109:: with SMTP id b9mr598154ots.276.1627618562426;
Thu, 29 Jul 2021 21:16:02 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Thu, 29 Jul 2021 21:16:02 -0700 (PDT)
In-Reply-To: <f586970f-d104-482f-b26a-70a145da70cbn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:56a:f39c:db00:64ce:1147:1ca3:6a59;
posting-account=1nOeKQkAAABD2jxp4Pzmx9Hx5g9miO8y
NNTP-Posting-Host: 2001:56a:f39c:db00:64ce:1147:1ca3:6a59
References: <sd9a9h$ro6$1@dont-email.me> <7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com>
<e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com> <fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com>
<713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com> <sdjghd$1i4a$1@gioia.aioe.org>
<sdk2kd$lu1$1@dont-email.me> <476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com>
<sdlo5n$da3$1@dont-email.me> <sdua2r$avt$1@z-news.wcss.wroc.pl>
<sdunr1$qje$1@gioia.aioe.org> <sdv19d$2t7$3@z-news.wcss.wroc.pl>
<588a5b12-0b5b-4ef4-8d4d-6c9273dcb5dfn@googlegroups.com> <f586970f-d104-482f-b26a-70a145da70cbn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <42810977-4463-42a6-93fa-66dde113fa2cn@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: jsav...@ecn.ab.ca (Quadibloc)
Injection-Date: Fri, 30 Jul 2021 04:16:02 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Quadibloc - Fri, 30 Jul 2021 04:16 UTC

On Thursday, July 29, 2021 at 4:28:25 PM UTC-6, MitchAlsup wrote:

> While choice of rounding mode is new-ish, the ability to specify the
> kind of rounding in FP->integer conversions goes WAY BACK.

Well, of course, but that is something entirely different, and doesn't
affect how lengthy floating-point computations preserve accuracy.

John Savard

Re: The value of floating-point exceptions?

<861r7d5ei2.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19461&group=comp.arch#19461

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Sun, 01 Aug 2021 09:14:13 -0700
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <861r7d5ei2.fsf@linuxsc.com>
References: <sd9a9h$ro6$1@dont-email.me> <7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com> <e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com> <fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com> <713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com> <sdjghd$1i4a$1@gioia.aioe.org> <sdk2kd$lu1$1@dont-email.me> <476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com> <sdlo5n$da3$1@dont-email.me> <sdua2r$avt$1@z-news.wcss.wroc.pl> <sdunr1$qje$1@gioia.aioe.org> <sdv19d$2t7$3@z-news.wcss.wroc.pl> <588a5b12-0b5b-4ef4-8d4d-6c9273dcb5dfn@googlegroups.com> <f586970f-d104-482f-b26a-70a145da70cbn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="0728152d16a9fd1546fce06c5fab8b72";
logging-data="29764"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18SfDDQvq9Zz83PylDWP82HvOWw5i8JAKw="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:7JHAyYelBCGKPDhKrkJFvOiz3HQ=
sha1:vMSIz6/XAQwagct5WLkAzYFXZ50=
 by: Tim Rentsch - Sun, 1 Aug 2021 16:14 UTC

MitchAlsup <MitchAlsup@aol.com> writes:

> On Thursday, July 29, 2021 at 4:49:00 PM UTC-5, Quadibloc wrote:
>
>> On Thursday, July 29, 2021 at 1:58:39 PM UTC-6,
>> anti...@math.uni.wroc.pl wrote:
>>
>>> For me rounding to nearest was preferable compared to C rule.
>>
>> I should think that it would be for *anyone*. Certainly it would be
>> for Fortran programmers, some of whom have to make do with
>> C instead due to availability issues.
>
> FORTRAN programmers have had INT, CEIL, FLOOR, TRUNC, and NINT since
> I learned FORTRAN in 1969.
>
>> What on Earth possessed them to make such a rule for C?
>
> principle of least surprise creates greater average surprise !

The C Rationale document says this:

There was strong agreement in the C89 Committee that
floating values should truncate toward zero when converted
to an integer type, the specification adopted in the
Standard. Although K&R permitted negative floating values
to truncate away from zero, no C89 Committee member knew of
an implementation that functioned in such a manner.

Since the purpose of the C standardization effort was to describe
the language as it then currently existed, and not to define a
new language, C89/C90 kept this rule.

C99 added functions in <math.h> for converting floating values to
integer values that do various kinds of rounding, including some
that do rounding according to the current rounding direction.

Re: The value of floating-point exceptions?

<2b097c60-ffcb-4afb-8cb6-3c061693c25cn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19466&group=comp.arch#19466

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:6214:1c4d:: with SMTP id if13mr12529758qvb.56.1627840884737;
Sun, 01 Aug 2021 11:01:24 -0700 (PDT)
X-Received: by 2002:aca:ac46:: with SMTP id v67mr7965108oie.99.1627840884512;
Sun, 01 Aug 2021 11:01:24 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Sun, 1 Aug 2021 11:01:24 -0700 (PDT)
In-Reply-To: <861r7d5ei2.fsf@linuxsc.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:56a:f39c:db00:d4e7:933:b3f9:fe99;
posting-account=1nOeKQkAAABD2jxp4Pzmx9Hx5g9miO8y
NNTP-Posting-Host: 2001:56a:f39c:db00:d4e7:933:b3f9:fe99
References: <sd9a9h$ro6$1@dont-email.me> <7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com>
<e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com> <fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com>
<713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com> <sdjghd$1i4a$1@gioia.aioe.org>
<sdk2kd$lu1$1@dont-email.me> <476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com>
<sdlo5n$da3$1@dont-email.me> <sdua2r$avt$1@z-news.wcss.wroc.pl>
<sdunr1$qje$1@gioia.aioe.org> <sdv19d$2t7$3@z-news.wcss.wroc.pl>
<588a5b12-0b5b-4ef4-8d4d-6c9273dcb5dfn@googlegroups.com> <f586970f-d104-482f-b26a-70a145da70cbn@googlegroups.com>
<861r7d5ei2.fsf@linuxsc.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2b097c60-ffcb-4afb-8cb6-3c061693c25cn@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: jsav...@ecn.ab.ca (Quadibloc)
Injection-Date: Sun, 01 Aug 2021 18:01:24 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Quadibloc - Sun, 1 Aug 2021 18:01 UTC

On Sunday, August 1, 2021 at 10:14:16 AM UTC-6, Tim Rentsch quoted, in part:

> There was strong agreement in the C89 Committee that
> floating values should truncate toward zero when converted
> to an integer type,

I have no problem with that. Of course the integer part of a float would
be what you get from round towards zero.

Where I think round-to-nearest is preferable is after an arithmetic
operation, where the result is rounded to go back in the same
floating-point type.

John Savard

Re: The value of floating-point exceptions?

<86k0l445ht.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19482&group=comp.arch#19482

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Mon, 02 Aug 2021 01:26:22 -0700
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <86k0l445ht.fsf@linuxsc.com>
References: <sd9a9h$ro6$1@dont-email.me> <7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com> <e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com> <fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com> <713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com> <sdjghd$1i4a$1@gioia.aioe.org> <sdk2kd$lu1$1@dont-email.me> <476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com> <sdlo5n$da3$1@dont-email.me> <sdua2r$avt$1@z-news.wcss.wroc.pl> <sdunr1$qje$1@gioia.aioe.org> <sdv19d$2t7$3@z-news.wcss.wroc.pl> <588a5b12-0b5b-4ef4-8d4d-6c9273dcb5dfn@googlegroups.com> <f586970f-d104-482f-b26a-70a145da70cbn@googlegroups.com> <861r7d5ei2.fsf@linuxsc.com> <2b097c60-ffcb-4afb-8cb6-3c061693c25cn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="060020ed4df747d792a42c4a015e636f";
logging-data="8864"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX199Nm5TW6YZ3/3FlR4haKLeIH2bK0j0qOM="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:lPxCyFcqOK0CPDhVf4t1Qed0CCA=
sha1:ZwKQ4K3Wf5rVmGXszDB5XUe/2Ew=
 by: Tim Rentsch - Mon, 2 Aug 2021 08:26 UTC

Quadibloc <jsavard@ecn.ab.ca> writes:

> On Sunday, August 1, 2021 at 10:14:16 AM UTC-6, Tim Rentsch quoted, in part:
>
>> There was strong agreement in the C89 Committee that
>> floating values should truncate toward zero when converted
>> to an integer type,
>
> I have no problem with that. Of course the integer part of a float would
> be what you get from round towards zero.
>
> Where I think round-to-nearest is preferable is after an arithmetic
> operation, where the result is rounded to go back in the same
> floating-point type.

Then you are in luck - the C standard allows C implementations
to use that rule.

Re: The value of floating-point exceptions?

<se961p$fka$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19494&group=comp.arch#19494

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: cr88...@gmail.com (BGB)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Mon, 2 Aug 2021 11:21:12 -0500
Organization: A noiseless patient Spider
Lines: 78
Message-ID: <se961p$fka$1@dont-email.me>
References: <sd9a9h$ro6$1@dont-email.me>
<7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com>
<e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com>
<fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com>
<713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com>
<sdjghd$1i4a$1@gioia.aioe.org> <sdk2kd$lu1$1@dont-email.me>
<476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com>
<sdlo5n$da3$1@dont-email.me> <sdua2r$avt$1@z-news.wcss.wroc.pl>
<sdunr1$qje$1@gioia.aioe.org> <sdv19d$2t7$3@z-news.wcss.wroc.pl>
<588a5b12-0b5b-4ef4-8d4d-6c9273dcb5dfn@googlegroups.com>
<f586970f-d104-482f-b26a-70a145da70cbn@googlegroups.com>
<861r7d5ei2.fsf@linuxsc.com>
<2b097c60-ffcb-4afb-8cb6-3c061693c25cn@googlegroups.com>
<86k0l445ht.fsf@linuxsc.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 2 Aug 2021 16:21:13 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="f5f7aa8673f5a56462de82292dc92d86";
logging-data="16010"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18KFdTEkB4Y028rybm4sF9E"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.12.0
Cancel-Lock: sha1:ADW+cMQKLtSz4/edi0bId8QpIrg=
In-Reply-To: <86k0l445ht.fsf@linuxsc.com>
Content-Language: en-US
 by: BGB - Mon, 2 Aug 2021 16:21 UTC

On 8/2/2021 3:26 AM, Tim Rentsch wrote:
> Quadibloc <jsavard@ecn.ab.ca> writes:
>
>> On Sunday, August 1, 2021 at 10:14:16 AM UTC-6, Tim Rentsch quoted, in part:
>>
>>> There was strong agreement in the C89 Committee that
>>> floating values should truncate toward zero when converted
>>> to an integer type,
>>
>> I have no problem with that. Of course the integer part of a float would
>> be what you get from round towards zero.
>>
>> Where I think round-to-nearest is preferable is after an arithmetic
>> operation, where the result is rounded to go back in the same
>> floating-point type.
>
> Then you are in luck - the C standard allows C implementations
> to use that rule.
>

Yeah. If one directly follows the C standard, they are can use
hard-wired truncate-towards-zero for integer, and round-to-nearest for
floating point.

While IEEE-754 asks a bit more, the stuff it asks doesn't map exactly to
C, and many traditional sorts of compiler optimizations are likely to
break any sort of bit-exactness one could otherwise expect from it.

More people are more likely to care that everything looks as it should
from C, than they are about rarely-used edge cases in the IEEE standard.

Granted, if I were to try for a bit-exact FPU design, it would more
likely focus on making everything truncate-towards-zero, as it is a
little easier to achieve bit-exact results with truncation than with
Round-Nearest-Even or similar.

Though, there are limits:
Partial width FMUL is still subject to long chains of ones in the result
changing the result of the FMUL if low-order multipliers are omitted.

In theory, one could hack around this by checking for some special cases
and predicting whether low-order results could produce results which
result in a carry (via lookup tables).

One possibility for lookup tables would be two or three levels of 3*3 ->
2, which figure out whether the MSB is 0, 1, or depends on the next
lower result. These would in-turn be fed into a lookup table to produce
an answer.

2-bit outputs:
00 = MSB is Clear (eg: 4*5)
01 = A&B has MSB Set, A*B Depends on next lower result
10 = A&B has MSB Set, A*B does Not
11 = Both A&B and A*B have MSB Set

And, further reductions:
00,zz = 00
01,00 = 01
01,01 = 11
01,10 = 11
01,11 = 11
10,zz = 10
11,zz = 11
01,00,00 = 10
01,00,01 = 11
01,00,10 = 01
01,00,11 = 11
....

With another LUT answering whether or not the adders would produce a
carry, ...

This would still be inexact though (reduces the probability of an
inexact result, but does not eliminate it; given this is, at best, an
approximation).

Re: The value of floating-point exceptions?

<260f4c66-afce-4594-a6dd-5cf6d7ce8f8an@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19511&group=comp.arch#19511

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a37:7141:: with SMTP id m62mr18099407qkc.496.1627946975978;
Mon, 02 Aug 2021 16:29:35 -0700 (PDT)
X-Received: by 2002:a05:6808:1807:: with SMTP id bh7mr482501oib.157.1627946974144;
Mon, 02 Aug 2021 16:29:34 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Mon, 2 Aug 2021 16:29:33 -0700 (PDT)
In-Reply-To: <91b95806-d901-48db-912d-0b0e5c119f9fn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:56a:f39c:db00:2920:884b:39e4:e50e;
posting-account=1nOeKQkAAABD2jxp4Pzmx9Hx5g9miO8y
NNTP-Posting-Host: 2001:56a:f39c:db00:2920:884b:39e4:e50e
References: <sd9a9h$ro6$1@dont-email.me> <memo.20210721153537.10680P@jgd.cix.co.uk>
<e9c738bd-7c0e-4b3b-9385-3a0d0658b059n@googlegroups.com> <a74c6bf2-9ad1-4969-b3cb-b650ae8ebdadn@googlegroups.com>
<sde6m7$kr1$1@dont-email.me> <sde74m$nio$1@dont-email.me> <7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com>
<e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com> <sdf4t3$6cl$2@newsreader4.netcologne.de>
<c0917435-65c8-45f1-b745-5fd7ff4f58c0n@googlegroups.com> <548e3590-e939-40b7-8f78-3040d59358f7n@googlegroups.com>
<sdj9rq$ue1$2@newsreader4.netcologne.de> <91b95806-d901-48db-912d-0b0e5c119f9fn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <260f4c66-afce-4594-a6dd-5cf6d7ce8f8an@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: jsav...@ecn.ab.ca (Quadibloc)
Injection-Date: Mon, 02 Aug 2021 23:29:34 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Quadibloc - Mon, 2 Aug 2021 23:29 UTC

On Monday, July 26, 2021 at 11:13:34 PM UTC-6, Quadibloc wrote:

> A while back, there was a discussion of base-3 logic. While
> I didn't think that would ever fly, I thought that using base 3
> for the pins of memory modules - so that two wires could carry
> 3 bits, with one of the 9 combinations unused - might be a
> good idea.

> That would be simpler than GDDR6x, which almost requires
> a mini-A/D converter on each data pin!

> The trouble is, though, that memory modules that contain
> 96-bit memory lines are less easily used in our power-of-two
> world.

> But now I've figured out how DDR4w, as we might call it,
> w because it's one less than x, 3 instead of 4 signal levels...
> could be useful.

> Have a three-channel memory built up of DDR4w modules.

> Now we have a factor of 3 due to the memory, and another
> factor of 3 due to the number of channels. So one could
> build a computer built around a 36-bit word, and yet it could
> use ordinary sockets for ordinary-looking memory modules!

> And use five-channel memory if you want a computer with a
> 60-bit word, or single, double, or quad channel for a 48-bit
> word!!

> Suddenly, diversity is returned to the world of the computer,
> and the tyranny of the 8-bit byte is ended!!

Of course, this is a crazy idea.

But in the *real* world, a recent leak has revealed that
Intel's forthcoming Thunderbolt 5 standard will indeed
use PAM-3 modulation, with three signal states per
baud, in order to increase bandwidth!

So ternary does live...

John Savard

Re: The value of floating-point exceptions?

<861r733mag.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19654&group=comp.arch#19654

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Sun, 08 Aug 2021 09:59:19 -0700
Organization: A noiseless patient Spider
Lines: 67
Message-ID: <861r733mag.fsf@linuxsc.com>
References: <sd9a9h$ro6$1@dont-email.me> <7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com> <e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com> <fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com> <713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com> <sdjghd$1i4a$1@gioia.aioe.org> <sdk2kd$lu1$1@dont-email.me> <476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com> <sdlo5n$da3$1@dont-email.me> <sdua2r$avt$1@z-news.wcss.wroc.pl> <sdunr1$qje$1@gioia.aioe.org> <sdv19d$2t7$3@z-news.wcss.wroc.pl> <588a5b12-0b5b-4ef4-8d4d-6c9273dcb5dfn@googlegroups.com> <f586970f-d104-482f-b26a-70a145da70cbn@googlegroups.com> <861r7d5ei2.fsf@linuxsc.com> <2b097c60-ffcb-4afb-8cb6-3c061693c25cn@googlegroups.com> <86k0l445ht.fsf@linuxsc.com> <se961p$fka$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="0ee88566ce2bde9648efa50db1b9ec0d";
logging-data="11376"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/1y3Oh5bGoxtrMJemOCzYC7IP3LEUGsQU="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:EqGmoPerQFW8G9tqzMz6129Pajw=
sha1:2bhxQvfKT9CgImdJ7xvghevwpRc=
 by: Tim Rentsch - Sun, 8 Aug 2021 16:59 UTC

BGB <cr88192@gmail.com> writes:

> On 8/2/2021 3:26 AM, Tim Rentsch wrote:
>
>> Quadibloc <jsavard@ecn.ab.ca> writes:
>>
>>> On Sunday, August 1, 2021 at 10:14:16 AM UTC-6, Tim Rentsch
>>> quoted, in part:
>>>
>>>> There was strong agreement in the C89 Committee that
>>>> floating values should truncate toward zero when converted
>>>> to an integer type,
>>>
>>> I have no problem with that. Of course the integer part of a
>>> float would be what you get from round towards zero.
>>>
>>> Where I think round-to-nearest is preferable is after an
>>> arithmetic operation, where the result is rounded to go back
>>> in the same floating-point type.
>>
>> Then you are in luck - the C standard allows C implementations
>> to use that rule.
>
> Yeah. If one directly follows the C standard, they are can use
> hard-wired truncate-towards-zero for integer, and round-to-nearest for
> floating point.
>
> While IEEE-754 asks a bit more, the stuff it asks doesn't map exactly
> to C, and many traditional sorts of compiler optimizations are likely
> to break any sort of bit-exactness one could otherwise expect from it.

I am curious to know what you think these might be. The C standard
does include the conditional feature macro __STDC_IEC_559__ :

The integer constant 1, intended to indicate conformance to
the specifications in annex F (IEC 60559 floating-point
arithmetic).

which references the normative annex F, which says in its introduction

This annex specifies C language support for the IEC 60559
floating-point standard. The IEC 60559 floating-point
standard is specifically Binary floating-point arithmetic for
microprocessor systems, second edition (IEC 60559:1989),
previously designated IEC 559:1989 and as IEEE Standard for
Binary Floating-Point Arithmetic (ANSI/IEEE 754.1985). IEEE
Standard for Radix-Independent Floating-Point Arithmetic
(ANSI/IEEE 854.1987) generalizes the binary standard to
remove dependencies on radix and word length. IEC 60559
generally refers to the floating-point standard, as in IEC
60559 operation, IEC 60559 format, etc. An implementation
that defines __STDC_IEC_559__ shall conform to the
specifications in this annex. Where a binding between the C
language and IEC 60559 is indicated, the IEC 60559-specified
behavior is adopted by reference, unless stated otherwise.
Since negative and positive infinity are representable in IEC
60559 formats, all real numbers lie within the range of
representable values.

Annex F is quite detailed, occupying 25 pages in the C standard.
An example requirement:

The +, -, *, and / operators provide the IEC 60559 add,
subtract, multiply, and divide operations.

which makes me wonder what IEEE-754 behaviors you think would
not be observed in such an implementation.

Re: The value of floating-point exceptions?

<sep6np$lcc$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19656&group=comp.arch#19656

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: cr88...@gmail.com (BGB)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Sun, 8 Aug 2021 13:11:00 -0500
Organization: A noiseless patient Spider
Lines: 92
Message-ID: <sep6np$lcc$1@dont-email.me>
References: <sd9a9h$ro6$1@dont-email.me>
<7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com>
<e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com>
<fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com>
<713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com>
<sdjghd$1i4a$1@gioia.aioe.org> <sdk2kd$lu1$1@dont-email.me>
<476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com>
<sdlo5n$da3$1@dont-email.me> <sdua2r$avt$1@z-news.wcss.wroc.pl>
<sdunr1$qje$1@gioia.aioe.org> <sdv19d$2t7$3@z-news.wcss.wroc.pl>
<588a5b12-0b5b-4ef4-8d4d-6c9273dcb5dfn@googlegroups.com>
<f586970f-d104-482f-b26a-70a145da70cbn@googlegroups.com>
<861r7d5ei2.fsf@linuxsc.com>
<2b097c60-ffcb-4afb-8cb6-3c061693c25cn@googlegroups.com>
<86k0l445ht.fsf@linuxsc.com> <se961p$fka$1@dont-email.me>
<861r733mag.fsf@linuxsc.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 8 Aug 2021 18:11:05 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="36b93e9d6933c91e195e12303c986093";
logging-data="21900"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/oIukd8oQ2nkbVcn2Yithy"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.12.0
Cancel-Lock: sha1:sV0NWU6LDLhae5yU4115OJUOdKU=
In-Reply-To: <861r733mag.fsf@linuxsc.com>
Content-Language: en-US
 by: BGB - Sun, 8 Aug 2021 18:11 UTC

On 8/8/2021 11:59 AM, Tim Rentsch wrote:
> BGB <cr88192@gmail.com> writes:
>
>> On 8/2/2021 3:26 AM, Tim Rentsch wrote:
>>
>>> Quadibloc <jsavard@ecn.ab.ca> writes:
>>>
>>>> On Sunday, August 1, 2021 at 10:14:16 AM UTC-6, Tim Rentsch
>>>> quoted, in part:
>>>>
>>>>> There was strong agreement in the C89 Committee that
>>>>> floating values should truncate toward zero when converted
>>>>> to an integer type,
>>>>
>>>> I have no problem with that. Of course the integer part of a
>>>> float would be what you get from round towards zero.
>>>>
>>>> Where I think round-to-nearest is preferable is after an
>>>> arithmetic operation, where the result is rounded to go back
>>>> in the same floating-point type.
>>>
>>> Then you are in luck - the C standard allows C implementations
>>> to use that rule.
>>
>> Yeah. If one directly follows the C standard, they are can use
>> hard-wired truncate-towards-zero for integer, and round-to-nearest for
>> floating point.
>>
>> While IEEE-754 asks a bit more, the stuff it asks doesn't map exactly
>> to C, and many traditional sorts of compiler optimizations are likely
>> to break any sort of bit-exactness one could otherwise expect from it.
>
> I am curious to know what you think these might be. The C standard
> does include the conditional feature macro __STDC_IEC_559__ :
>
> The integer constant 1, intended to indicate conformance to
> the specifications in annex F (IEC 60559 floating-point
> arithmetic).
>
> which references the normative annex F, which says in its introduction
>
> This annex specifies C language support for the IEC 60559
> floating-point standard. The IEC 60559 floating-point
> standard is specifically Binary floating-point arithmetic for
> microprocessor systems, second edition (IEC 60559:1989),
> previously designated IEC 559:1989 and as IEEE Standard for
> Binary Floating-Point Arithmetic (ANSI/IEEE 754.1985). IEEE
> Standard for Radix-Independent Floating-Point Arithmetic
> (ANSI/IEEE 854.1987) generalizes the binary standard to
> remove dependencies on radix and word length. IEC 60559
> generally refers to the floating-point standard, as in IEC
> 60559 operation, IEC 60559 format, etc. An implementation
> that defines __STDC_IEC_559__ shall conform to the
> specifications in this annex. Where a binding between the C
> language and IEC 60559 is indicated, the IEC 60559-specified
> behavior is adopted by reference, unless stated otherwise.
> Since negative and positive infinity are representable in IEC
> 60559 formats, all real numbers lie within the range of
> representable values.
>
> Annex F is quite detailed, occupying 25 pages in the C standard.
> An example requirement:
>
> The +, -, *, and / operators provide the IEC 60559 add,
> subtract, multiply, and divide operations.
>
> which makes me wonder what IEEE-754 behaviors you think would
> not be observed in such an implementation.
>

Hmm...

Was going to note the lack of any standard way to specify the rounding
mode, ...

But, then went and looked at it and noted that it seems to be that I had
failed to notice that "fenv.h" was a thing, which does provide a means
to specify this.

So, it appears that a function is used to get/set the rounding mode, but
a pragma may be required to tell the compiler to actually use the
rounding mode and similar (and also disable some types of optimizations):
#pragma STDC FENV_ACCESS ON //enable FPU magic
fesetround(FE_TOWARDZERO); //set to truncate
...

With:
#pragma fenv_access(on) //apparent alternate notation

I guess I could maybe look into this some more...

Re: The value of floating-point exceptions?

<f75b7425-1cd2-434a-b58b-9f145b2ad5c6n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19659&group=comp.arch#19659

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:620a:88c:: with SMTP id b12mr2329530qka.483.1628449239752; Sun, 08 Aug 2021 12:00:39 -0700 (PDT)
X-Received: by 2002:a9d:3a49:: with SMTP id j67mr15530854otc.114.1628449239495; Sun, 08 Aug 2021 12:00:39 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!tr1.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.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: comp.arch
Date: Sun, 8 Aug 2021 12:00:39 -0700 (PDT)
In-Reply-To: <861r733mag.fsf@linuxsc.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:1de5:284a:9e56:52df; posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:1de5:284a:9e56:52df
References: <sd9a9h$ro6$1@dont-email.me> <7cf5713e-f138-488b-9ccf-d85df84c50can@googlegroups.com> <e7e0b9a2-7990-4ec8-9c40-a6e9a07bd306n@googlegroups.com> <fc5a33d0-7c17-4855-8ab3-162884bd6b7bn@googlegroups.com> <713a35af-9cce-4954-b968-1b4b754e7b1en@googlegroups.com> <sdjghd$1i4a$1@gioia.aioe.org> <sdk2kd$lu1$1@dont-email.me> <476a9f6b-5fa0-4606-aed6-cf31089b8c5bn@googlegroups.com> <sdlo5n$da3$1@dont-email.me> <sdua2r$avt$1@z-news.wcss.wroc.pl> <sdunr1$qje$1@gioia.aioe.org> <sdv19d$2t7$3@z-news.wcss.wroc.pl> <588a5b12-0b5b-4ef4-8d4d-6c9273dcb5dfn@googlegroups.com> <f586970f-d104-482f-b26a-70a145da70cbn@googlegroups.com> <861r7d5ei2.fsf@linuxsc.com> <2b097c60-ffcb-4afb-8cb6-3c061693c25cn@googlegroups.com> <86k0l445ht.fsf@linuxsc.com> <se961p$fka$1@dont-email.me> <861r733mag.fsf@linuxsc.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f75b7425-1cd2-434a-b58b-9f145b2ad5c6n@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Sun, 08 Aug 2021 19:00:39 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 78
 by: MitchAlsup - Sun, 8 Aug 2021 19:00 UTC

On Sunday, August 8, 2021 at 11:59:22 AM UTC-5, Tim Rentsch wrote:
> BGB <cr8...@gmail.com> writes:
>
> > On 8/2/2021 3:26 AM, Tim Rentsch wrote:
> >
> >> Quadibloc <jsa...@ecn.ab.ca> writes:
> >>
> >>> On Sunday, August 1, 2021 at 10:14:16 AM UTC-6, Tim Rentsch
> >>> quoted, in part:
> >>>
> >>>> There was strong agreement in the C89 Committee that
> >>>> floating values should truncate toward zero when converted
> >>>> to an integer type,
> >>>
> >>> I have no problem with that. Of course the integer part of a
> >>> float would be what you get from round towards zero.
> >>>
> >>> Where I think round-to-nearest is preferable is after an
> >>> arithmetic operation, where the result is rounded to go back
> >>> in the same floating-point type.
> >>
> >> Then you are in luck - the C standard allows C implementations
> >> to use that rule.
> >
> > Yeah. If one directly follows the C standard, they are can use
> > hard-wired truncate-towards-zero for integer, and round-to-nearest for
> > floating point.
> >
> > While IEEE-754 asks a bit more, the stuff it asks doesn't map exactly
> > to C, and many traditional sorts of compiler optimizations are likely
> > to break any sort of bit-exactness one could otherwise expect from it.
> I am curious to know what you think these might be. The C standard
> does include the conditional feature macro __STDC_IEC_559__ :
>
> The integer constant 1, intended to indicate conformance to
> the specifications in annex F (IEC 60559 floating-point
> arithmetic).
>
> which references the normative annex F, which says in its introduction
>
> This annex specifies C language support for the IEC 60559
> floating-point standard. The IEC 60559 floating-point
> standard is specifically Binary floating-point arithmetic for
> microprocessor systems, second edition (IEC 60559:1989),
> previously designated IEC 559:1989 and as IEEE Standard for
> Binary Floating-Point Arithmetic (ANSI/IEEE 754.1985). IEEE
> Standard for Radix-Independent Floating-Point Arithmetic
> (ANSI/IEEE 854.1987) generalizes the binary standard to
> remove dependencies on radix and word length. IEC 60559
> generally refers to the floating-point standard, as in IEC
> 60559 operation, IEC 60559 format, etc. An implementation
> that defines __STDC_IEC_559__ shall conform to the
> specifications in this annex. Where a binding between the C
> language and IEC 60559 is indicated, the IEC 60559-specified
> behavior is adopted by reference, unless stated otherwise.
> Since negative and positive infinity are representable in IEC
> 60559 formats, all real numbers lie within the range of
> representable values.
>
> Annex F is quite detailed, occupying 25 pages in the C standard.
> An example requirement:
>
> The +, -, *, and / operators provide the IEC 60559 add,
> subtract, multiply, and divide operations.
>
> which makes me wonder what IEEE-754 behaviors you think would
> not be observed in such an implementation.
<
There is stuff in IEEE 754-2008 and -2019 that is not in -1985.
<
FMAC for example.
<
List of transcendental functions which must be "accurately" implemented
--more about the various boundary conditions and resultant values than
properly rounded.
<
5th rounding mode (Round away from zero == round nearest magnitude.)
<
Return to -1985 MAX() and MIN() {which -2009 totally blew}

Pages:12345678910
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor