Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #71022 > unrolled thread
| Started by | "Skybuck Flying" <skybuck2000@hotmail.com> |
|---|---|
| First post | 2015-09-21 20:17 +0200 |
| Last post | 2015-09-22 11:23 +0200 |
| Articles | 20 on this page of 145 — 21 participants |
Back to article view | Back to comp.lang.c
How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-21 20:17 +0200
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-21 20:43 +0200
Re: How to write this sign function in Delphi. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-21 19:51 +0100
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-21 23:26 +0200
Re: How to write this sign function in Delphi. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-21 22:47 +0100
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-22 16:29 +0200
Re: How to write this sign function in Delphi. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-22 16:11 +0100
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-23 11:18 +0200
Re: How to write this sign function in Delphi. David Brown <david.brown@hesbynett.no> - 2015-09-23 13:01 +0200
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-21 20:53 +0200
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-21 20:54 +0200
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-21 20:58 +0200
Re: How to write this sign function in Delphi. M Philbrook <jamie_ka1lpa@charter.net> - 2015-09-21 18:15 -0400
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-09-21 15:21 -0700
Re: How to write this sign function in Delphi. Robert Wessel <robertwessel2@yahoo.com> - 2015-09-21 17:51 -0500
Re: How to write this sign function in Delphi. James Kuyper <jameskuyper@verizon.net> - 2015-09-21 19:15 -0400
Re: How to write this sign function in Delphi. Robert Wessel <robertwessel2@yahoo.com> - 2015-09-21 23:59 -0500
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-09-22 09:22 -0700
Re: How to write this sign function in Delphi. Keith Thompson <kst-u@mib.org> - 2015-09-22 10:32 -0700
Re: How to write this sign function in Delphi. jt@toerring.de (Jens Thoms Toerring) - 2015-09-22 18:17 +0000
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-09-22 12:25 -0700
Re: How to write this sign function in Delphi. jt@toerring.de (Jens Thoms Toerring) - 2015-09-22 22:33 +0000
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-09-22 15:52 -0700
Re: How to write this sign function in Delphi. raltbos@xs4all.nl (Richard Bos) - 2015-09-22 23:09 +0000
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-09-23 09:07 -0700
Re: How to write this sign function in Delphi. Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-09-23 16:55 +0000
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-09-23 10:46 -0700
Re: How to write this sign function in Delphi. jt@toerring.de (Jens Thoms Toerring) - 2015-09-23 23:18 +0000
Re: How to write this sign function in Delphi. James Kuyper <jameskuyper@verizon.net> - 2015-09-23 22:29 -0400
Re: How to write this sign function in Delphi. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-24 11:09 +0100
Re: How to write this sign function in Delphi. Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-27 18:23 -0700
Re: How to write this sign function in Delphi. glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-09-28 05:20 +0000
Re: How to write this sign function in Delphi. Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-27 23:23 -0700
Re: How to write this sign function in Delphi. Richard Heathfield <rjh@cpax.org.uk> - 2015-09-28 09:03 +0100
Re: How to write this sign function in Delphi. Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-28 01:24 -0700
Re: How to write this sign function in Delphi. Richard Heathfield <rjh@cpax.org.uk> - 2015-09-28 09:32 +0100
Re: How to write this sign function in Delphi. Bartc <bc@freeuk.com> - 2015-09-28 10:22 +0100
Re: How to write this sign function in Delphi. Richard Heathfield <rjh@cpax.org.uk> - 2015-09-28 11:35 +0100
Re: How to write this sign function in Delphi. Keith Thompson <kst-u@mib.org> - 2015-09-28 10:33 -0700
Re: How to write this sign function in Delphi. Richard Heathfield <rjh@cpax.org.uk> - 2015-09-28 18:59 +0100
Re: How to write this sign function in Delphi. Rosario19 <Ros@invalid.invalid> - 2015-09-28 20:09 +0200
Re: How to write this sign function in Delphi. Robert Wessel <robertwessel2@yahoo.com> - 2015-09-28 13:39 -0500
Re: How to write this sign function in Delphi. Richard Heathfield <rjh@cpax.org.uk> - 2015-09-28 20:04 +0100
Re: How to write this sign function in Delphi. Robert Wessel <robertwessel2@yahoo.com> - 2015-09-28 16:43 -0500
Re: How to write this sign function in Delphi. Martin Shobe <martin.shobe@yahoo.com> - 2015-09-28 18:55 -0500
Re: How to write this sign function in Delphi. Robert Wessel <robertwessel2@yahoo.com> - 2015-09-28 19:31 -0500
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-09-28 12:16 -0700
Re: How to write this sign function in Delphi. Keith Thompson <kst-u@mib.org> - 2015-09-28 14:31 -0700
Re: How to write this sign function in Delphi. Robert Wessel <robertwessel2@yahoo.com> - 2015-09-28 16:47 -0500
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-09-29 11:54 -0700
Re: How to write this sign function in Delphi. Robert Wessel <robertwessel2@yahoo.com> - 2015-10-01 00:36 -0500
Re: How to write this sign function in Delphi. raltbos@xs4all.nl (Richard Bos) - 2015-10-02 10:53 +0000
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-10-02 09:48 -0700
Re: How to write this sign function in Delphi. Robert Wessel <robertwessel2@yahoo.com> - 2015-10-03 11:27 -0500
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-10-03 12:32 -0700
Re: How to write this sign function in Delphi. Robert Wessel <robertwessel2@yahoo.com> - 2015-10-03 11:26 -0500
Re: How to write this sign function in Delphi. Tim Rentsch <txr@alumni.caltech.edu> - 2015-10-04 16:46 -0700
Re: How to write this sign function in Delphi. Keith Thompson <kst-u@mib.org> - 2015-09-28 14:23 -0700
Re: How to write this sign function in Delphi. Robert Wessel <robertwessel2@yahoo.com> - 2015-09-28 16:52 -0500
Re: How to write this sign function in Delphi. Tim Rentsch <txr@alumni.caltech.edu> - 2015-09-30 01:39 -0700
Re: How to write this sign function in Delphi. Keith Thompson <kst-u@mib.org> - 2015-09-30 12:37 -0700
Re: How to write this sign function in Delphi. glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-09-30 21:28 +0000
Re: How to write this sign function in Delphi. James Kuyper <jameskuyper@verizon.net> - 2015-09-30 17:54 -0400
Re: How to write this sign function in Delphi. glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-10-01 03:59 +0000
Re: How to write this sign function in Delphi. James Kuyper <jameskuyper@verizon.net> - 2015-10-01 01:42 -0400
Re: How to write this sign function in Delphi. Keith Thompson <kst-u@mib.org> - 2015-09-30 16:20 -0700
Re: How to write this sign function in Delphi. Tim Rentsch <txr@alumni.caltech.edu> - 2015-10-04 16:39 -0700
Re: How to write this sign function in Delphi. glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-09-28 23:23 +0000
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-09-29 09:35 -0700
Re: How to write this sign function in Delphi. raltbos@xs4all.nl (Richard Bos) - 2015-10-02 11:06 +0000
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-10-02 09:23 -0700
Re: How to write this sign function in Delphi. Martin Shobe <martin.shobe@yahoo.com> - 2015-10-02 12:07 -0500
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-10-02 10:47 -0700
Re: How to write this sign function in Delphi. Keith Thompson <kst-u@mib.org> - 2015-10-02 17:48 -0700
Re: How to write this sign function in Delphi. Richard Heathfield <rjh@cpax.org.uk> - 2015-10-03 16:46 +0100
Re: How to write this sign function in Delphi. Martin Shobe <martin.shobe@yahoo.com> - 2015-10-05 10:41 -0500
Re: How to write this sign function in Delphi. James Kuyper <jameskuyper@verizon.net> - 2015-09-28 15:31 -0400
Re: How to write this sign function in Delphi. Robert Wessel <robertwessel2@yahoo.com> - 2015-09-28 16:40 -0500
Re: How to write this sign function in Delphi. James Kuyper <jameskuyper@verizon.net> - 2015-09-28 18:17 -0400
Re: How to write this sign function in Delphi. Tim Rentsch <txr@alumni.caltech.edu> - 2015-09-30 02:49 -0700
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-09-30 06:27 -0700
Re: How to write this sign function in Delphi. Tim Rentsch <txr@alumni.caltech.edu> - 2015-09-29 10:43 -0700
Re: How to write this sign function in Delphi. glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-09-28 22:51 +0000
Re: How to write this sign function in Delphi. Tim Rentsch <txr@alumni.caltech.edu> - 2015-09-30 02:11 -0700
Re: How to write this sign function in Delphi. glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-09-28 22:48 +0000
Re: How to write this sign function in Delphi. Robert Wessel <robertwessel2@yahoo.com> - 2015-09-28 22:03 -0500
Re: How to write this sign function in Delphi. Tim Rentsch <txr@alumni.caltech.edu> - 2015-09-30 01:13 -0700
Re: How to write this sign function in Delphi. Bartc <bc@freeuk.com> - 2015-09-30 17:06 +0100
Re: How to write this sign function in Delphi. Richard Heathfield <rjh@cpax.org.uk> - 2015-09-30 17:26 +0100
Re: How to write this sign function in Delphi. Keith Thompson <kst-u@mib.org> - 2015-09-30 13:04 -0700
Re: How to write this sign function in Delphi. glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-09-28 09:12 +0000
Re: How to write this sign function in Delphi. David Brown <david.brown@hesbynett.no> - 2015-09-28 12:28 +0200
Re: How to write this sign function in Delphi. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-28 20:44 +0100
Re: How to write this sign function in Delphi. Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-10-01 01:39 -0700
Re: How to write this sign function in Delphi. Keith Thompson <kst-u@mib.org> - 2015-10-01 08:55 -0700
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-10-01 09:02 -0700
Re: How to write this sign function in Delphi. Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-10-01 14:55 -0700
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-10-01 16:48 -0700
Re: How to write this sign function in Delphi. raltbos@xs4all.nl (Richard Bos) - 2015-10-02 11:46 +0000
Re: How to write this sign function in Delphi. Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-10-06 00:15 -0700
Re: How to write this sign function in Delphi. Les Cargill <lcargill99@comcast.com> - 2015-10-06 02:43 -0500
Re: How to write this sign function in Delphi. David Brown <david.brown@hesbynett.no> - 2015-10-06 10:13 +0200
Re: How to write this sign function in Delphi. Les Cargill <lcargill99@comcast.com> - 2015-10-06 19:14 -0500
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-10-06 21:36 -0700
Re: How to write this sign function in Delphi. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-10-06 09:25 +0100
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-10-06 09:28 -0700
Re: How to write this sign function in Delphi. Keith Thompson <kst-u@mib.org> - 2015-10-06 13:11 -0700
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-10-06 13:56 -0700
Re: How to write this sign function in Delphi. glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-10-07 00:25 +0000
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-10-06 09:44 -0700
Re: How to write this sign function in Delphi. Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-10-06 10:08 -0700
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-10-06 12:00 -0700
Re: How to write this sign function in Delphi. Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-10-07 01:58 -0700
Re: How to write this sign function in Delphi. Richard Heathfield <rjh@cpax.org.uk> - 2015-10-07 10:12 +0100
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-10-08 00:40 -0700
Re: How to write this sign function in Delphi. Philip Lantz <prl@canterey.us> - 2015-10-03 12:29 -0700
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-10-03 13:20 -0700
Re: How to write this sign function in Delphi. Philip Lantz <prl@canterey.us> - 2015-10-03 12:33 -0700
Re: How to write this sign function in Delphi. James Kuyper <jameskuyper@verizon.net> - 2015-10-03 17:02 -0400
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-10-03 15:04 -0700
Re: How to write this sign function in Delphi. glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-10-04 05:12 +0000
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-10-04 12:58 -0700
Re: How to write this sign function in Delphi. Philip Lantz <prl@canterey.us> - 2015-10-03 12:37 -0700
Re: How to write this sign function in Delphi. James Kuyper <jameskuyper@verizon.net> - 2015-10-03 16:21 -0400
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-10-03 16:05 -0700
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-10-03 14:02 -0700
Re: How to write this sign function in Delphi. supercat@casperkitty.com - 2015-09-24 09:39 -0700
Re: How to write this sign function in Delphi. raltbos@xs4all.nl (Richard Bos) - 2015-09-27 16:26 +0000
Re: How to write this sign function in Delphi. M Philbrook <jamie_ka1lpa@charter.net> - 2015-09-21 22:06 -0400
Re: How to write this sign function in Delphi. James Kuyper <jameskuyper@verizon.net> - 2015-09-22 10:17 -0400
Re: How to write this sign function in Delphi. M Philbrook <jamie_ka1lpa@charter.net> - 2015-09-22 19:48 -0400
Re: How to write this sign function in Delphi. Noob <root@127.0.0.1> - 2015-09-23 13:15 +0200
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-21 21:25 +0200
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-21 21:54 +0200
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-21 22:02 +0200
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-21 21:50 +0200
Re: How to write this sign function in Delphi. M Philbrook <jamie_ka1lpa@charter.net> - 2015-09-21 18:08 -0400
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-22 08:31 +0200
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-22 10:18 +0200
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-22 10:50 +0200
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-22 11:00 +0200
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-22 11:07 +0200
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-22 11:20 +0200
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-22 11:15 +0200
Re: How to write this sign function in Delphi. "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-09-22 11:23 +0200
Page 4 of 8 — ← Prev page 1 2 3 [4] 5 6 7 8 Next page →
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2015-09-30 12:37 -0700 |
| Message-ID | <lnsi5v3dgs.fsf@kst-u.example.com> |
| In reply to | #71468 |
Tim Rentsch <txr@alumni.caltech.edu> writes:
[...]
> I believe FLT_RADIX is the exponent of the model used to report
> the results, not necessarily what is used in the implementation.
> Indeed what is used in the implementation may not have a value
> that corresponds to the value 'b' in the floating-point model.
> For example, what is stored could be the log of a value rather
> than the value itself (which would allow multiplications and
> divisions to be done by addition). Certainly if FLT_RADIX is
> the model value for 'b' then FLT_RADIX is an integer.
The floating-point model in N1570 5.2.4.2.2 says that each
floating-point value is represented as
x = s * b**e * SUM(k=1..p_)(f[k] * b**-k)
(The mathematical notation in the standard is clearer, but I can't
easily reproduce it in ASCII.)
But a footnote says:
The floating-point model is intended to clarify the description
of each floating-point characteristic and does not require the
floating-point arithmetic of the implementation to be identical.
So the question is, just how much does the standard's "model" constrain
the behavior of floating-point implementations? How much freedom does
that "does not require ... to be identical" phrasing grant?
Note that we're just talking about representable values. The results of
operations are a different matter, discussed elsewhere in the standard.
If FLT_RADIX (b in the above model) is 2, must the values 0.0, 0.5,
1.0, 1.5, and 2.0 (among many others) be exactly representable?
The model implie that they are, but if the standard permits enough
leeway for the answer to be "no", then I question the usefulness
of the model.
On the other hand, for an implementation with FLT_RADIX==2
which can't represent those numbers exactly, one might argue
that the floating-point model *doesn't* successfully "clarify
the description", and therefore that the implementation is
non-conforming.
In practice, IEEE representations do satisfy the C model, and most or
all existing non-IEEE implementations do as well, so it's probably
not much of a practical issue -- except that we might be depending
on things that the standard doesn't actually guarantee.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
|---|---|
| Date | 2015-09-30 21:28 +0000 |
| Message-ID | <muhk67$h24$1@speranza.aioe.org> |
| In reply to | #71496 |
Keith Thompson <kst-u@mib.org> wrote: (snip) > The floating-point model in N1570 5.2.4.2.2 says that each > floating-point value is represented as > x = s * b**e * SUM(k=1..p_)(f[k] * b**-k) You mean that f is an array with elements from 1 to p? That doesn't sound C like to me. > (The mathematical notation in the standard is clearer, but I can't > easily reproduce it in ASCII.) -- glen
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Date | 2015-09-30 17:54 -0400 |
| Message-ID | <muhli8$m44$1@dont-email.me> |
| In reply to | #71507 |
On 09/30/2015 05:28 PM, glen herrmannsfeldt wrote: > Keith Thompson <kst-u@mib.org> wrote: > > (snip) > >> The floating-point model in N1570 5.2.4.2.2 says that each >> floating-point value is represented as > >> x = s * b**e * SUM(k=1..p_)(f[k] * b**-k) > > You mean that f is an array with elements from 1 to p? No, this is mathematical notation describing the meaning of the floating point representation. It's not C syntax. In the unlikely event that you used an implementation which emulated floating point operations using C code, which stored the signifcand in an actual C array with p elements, it would index that array with indices from 0 to p-1. -- James Kuyper
[toc] | [prev] | [next] | [standalone]
| From | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
|---|---|
| Date | 2015-10-01 03:59 +0000 |
| Message-ID | <muib2q$q7n$1@speranza.aioe.org> |
| In reply to | #71509 |
James Kuyper <jameskuyper@verizon.net> wrote: (snip) >>> The floating-point model in N1570 5.2.4.2.2 says that each >>> floating-point value is represented as >>> x = s * b**e * SUM(k=1..p_)(f[k] * b**-k) (then I wrote) >> You mean that f is an array with elements from 1 to p? > No, this is mathematical notation describing the meaning of the floating > point representation. It's not C syntax. In the unlikely event that you > used an implementation which emulated floating point operations using C > code, which stored the signifcand in an actual C array with p elements, > it would index that array with indices from 0 to p-1. OK, but mathematics can deal with indexing from zero. Taylor series expansions normally start from zero, such that the first term has a zero exponent (and zeroth derivative). Mathematics does tend to use 1 origin for matrices. In the case above, since the exponent bias isn't given, there isn't much difference which origin is used. I had thought that zero origin was ingrained enough into C that it would be used here, even though it is, as you note, just mathematical notation. -- glen
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Date | 2015-10-01 01:42 -0400 |
| Message-ID | <muih96$4c1$1@dont-email.me> |
| In reply to | #71522 |
On 09/30/2015 11:59 PM, glen herrmannsfeldt wrote: > James Kuyper <jameskuyper@verizon.net> wrote: > > (snip) >>>> The floating-point model in N1570 5.2.4.2.2 says that each >>>> floating-point value is represented as > >>>> x = s * b**e * SUM(k=1..p_)(f[k] * b**-k) > > (then I wrote) >>> You mean that f is an array with elements from 1 to p? > >> No, this is mathematical notation describing the meaning of the floating >> point representation. It's not C syntax. In the unlikely event that you >> used an implementation which emulated floating point operations using C >> code, which stored the signifcand in an actual C array with p elements, >> it would index that array with indices from 0 to p-1. > > OK, but mathematics can deal with indexing from zero. Sure - summation notation can start and end anywhere. However, SUM(k=1,p ... b**-k is marginally easier to write than SUM(k=0,p-1 ... b**(1-k) -- James Kuyper
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2015-09-30 16:20 -0700 |
| Message-ID | <lnk2r7335h.fsf@kst-u.example.com> |
| In reply to | #71507 |
glen herrmannsfeldt <gah@ugcs.caltech.edu> writes:
> Keith Thompson <kst-u@mib.org> wrote:
>
> (snip)
>
>> The floating-point model in N1570 5.2.4.2.2 says that each
>> floating-point value is represented as
>
>> x = s * b**e * SUM(k=1..p_)(f[k] * b**-k)
>
> You mean that f is an array with elements from 1 to p?
>
> That doesn't sound C like to me.
It isn't. The above is my sloppy summary of the mathematical expression
in N1570 5.2.4.2.2p2. "f[k]" is actually written as "f" with "k" as a
subscript; it denotes a digit of the significand. If b (FLT_RADIX) is
2, each f[k] is a bit.
If you have a copy of N1570 it's easier to read it there, but here's the
description of the parameters:
s sign (+/-1)
b base or radix of exponent representation (an integer > 1)
e exponent (an integer between a minimum emin and a maximum emax)
p precision (the number of base-b digits in the significand)
f[k] nonnegative integers less than b (the significand digits)
where +/- is a plus-or-minus sign and "emin" and "emax" are written with
subscripts.
>> (The mathematical notation in the standard is clearer, but I can't
>> easily reproduce it in ASCII.)
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | Tim Rentsch <txr@alumni.caltech.edu> |
|---|---|
| Date | 2015-10-04 16:39 -0700 |
| Message-ID | <kfna8ry6w6g.fsf@x-alumni2.alumni.caltech.edu> |
| In reply to | #71496 |
Keith Thompson <kst-u@mib.org> writes: > Tim Rentsch <txr@alumni.caltech.edu> writes: > [...] >> I believe FLT_RADIX is the exponent of the model used to report >> the results, not necessarily what is used in the implementation. >> Indeed what is used in the implementation may not have a value >> that corresponds to the value 'b' in the floating-point model. >> For example, what is stored could be the log of a value rather >> than the value itself (which would allow multiplications and >> divisions to be done by addition). Certainly if FLT_RADIX is >> the model value for 'b' then FLT_RADIX is an integer. > > The floating-point model in N1570 5.2.4.2.2 says that each > floating-point value is represented as > > x = s * b**e * SUM(k=1..p_)(f[k] * b**-k) > > (The mathematical notation in the standard is clearer, but I can't > easily reproduce it in ASCII.) > > But a footnote says: > > The floating-point model is intended to clarify the description > of each floating-point characteristic and does not require the > floating-point arithmetic of the implementation to be identical. > > So the question is, just how much does the standard's "model" constrain > the behavior of floating-point implementations? How much freedom does > that "does not require ... to be identical" phrasing grant? > > Note that we're just talking about representable values. The results of > operations are a different matter, discussed elsewhere in the standard. > > If FLT_RADIX (b in the above model) is 2, must the values 0.0, 0.5, > 1.0, 1.5, and 2.0 (among many others) be exactly representable? > The model implie that they are, but if the standard permits enough > leeway for the answer to be "no", then I question the usefulness > of the model. > > On the other hand, for an implementation with FLT_RADIX==2 > which can't represent those numbers exactly, one might argue > that the floating-point model *doesn't* successfully "clarify > the description", and therefore that the implementation is > non-conforming. > > In practice, IEEE representations do satisfy the C model, and most or > all existing non-IEEE implementations do as well, so it's probably > not much of a practical issue -- except that we might be depending > on things that the standard doesn't actually guarantee. Let me say first that this part of the Standard is probably the vaguest statement of requirements it has. I don't know how to assign it either a most likely meaning or an intended meaning, based just on what is written in the Standard proper. Having said that, what I believe was intended is as follow. The mathematical model in 5.2.4.2.2 is used to give meaning to the various macros in that section. Whatever representation or encoding an implementation actually uses, how it behaves should be at least as good as those its macro values indicate. There are two caveats that go along with this. One is that "at least as good" is not necessarily meant exactly literally. For example, the point you mention about particular values for base 2, I believe is not meant to be implied precisely, as otherwise there seems little point in permitting "other" representations. The second caveat is that there are some minimal requirements that are intended but not clearly stated. An example of this is the expectation that zero be representable exactly. Although I think there are some expectations (ie, by WG14) along these lines, AFAIK they have never been specifically identified or written down, except in some cases as ad hoc examples. The above impressions are formed based mostly on reading documents available on the open-std.org website. Exactly which ones I can't tell you, I'm sorry to say (although there a fair chance one or more DRs played a part). So FWIW, there is my undocumented opinion. In practical terms I think these possibilities make no difference, as it is very unlikely (like you say) that we will ever see an implementation that uses a different sort of representation. Still it would be nice to know what the requirements are really meant to be.
[toc] | [prev] | [next] | [standalone]
| From | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
|---|---|
| Date | 2015-09-28 23:23 +0000 |
| Message-ID | <muci5b$2d9$1@speranza.aioe.org> |
| In reply to | #71384 |
Robert Wessel <robertwessel2@yahoo.com> wrote: (snip on floatint point representations) > Since DBL_DIG is required not required to be more than 10, the upper > bound on that is about (10*10-1), or bit over 33 bits worth. It is, > however, unclear to me that having a DBL_DIG of 10 is actually > sufficient to require that all integers 1..(10*10-1) are representable > exactly. For conventional FP systems that would seem to be the case, > but FP formats with non-integer bases, for example, you might have > very few integers that have an exact representation. I don't know about C, Fortran requires the radix to be integer. There have been some suggestions that e is an optimal radix, but it isn't at all convenient for hardware. pi would be interesting in that many useful multiples of pi would have exact representations. But otherwise, when considering the representable digits in a different radix than that in use, there is usually a maximum, average, and minimum precision (number of represented digits). For IEEE double, with 53 bits including the hidden one, relative error goes from 2**52 up to almost 2**53. Depending on the value, you have between 52 and 53 bits. I was assuming that DBL_DIG of 10 required all 10 digit decimal integers to be representable exactly, but maybe not. -- glen
[toc] | [prev] | [next] | [standalone]
| From | supercat@casperkitty.com |
|---|---|
| Date | 2015-09-29 09:35 -0700 |
| Message-ID | <6d9eeea4-35b2-407a-9007-3bd07dafe79d@googlegroups.com> |
| In reply to | #71405 |
On Monday, September 28, 2015 at 6:23:35 PM UTC-5, glen herrmannsfeldt wrote: > There have been some suggestions that e is an optimal radix, but > it isn't at all convenient for hardware. pi would be interesting in > that many useful multiples of pi would have exact representations. What would be the "exact" representation of 4pi? Using non-integer radix will make it hard to produce correctly-rounded results for even simple expressions like (x+x); I would think the most interesting non-binary form would be balanced ternary. While there would be many values for which (x+x) was not representable despite being in range, balanced ternary has the nice feature that rounding never has to take a midpoint up or down because there's never a midpoint. On a related note, I wonder if any notable floating-point implementations have endeavored to define rounding rules such that any numerical value which is a boundary between consecutive low-precision representations would also be a boundary between consecutive high-precision representations. In IEEE-754, that doesn't hold, which means that the value assigned by a statement like float "f=16777218.9999999999999999;" may assign "f" a value of 16777220.0f, even though 16777218, which is also representable, is obviously closer.
[toc] | [prev] | [next] | [standalone]
| From | raltbos@xs4all.nl (Richard Bos) |
|---|---|
| Date | 2015-10-02 11:06 +0000 |
| Message-ID | <560e63da.7387453@news.xs4all.nl> |
| In reply to | #71435 |
supercat@casperkitty.com wrote: > On Monday, September 28, 2015 at 6:23:35 PM UTC-5, glen herrmannsfeldt wrote: > > There have been some suggestions that e is an optimal radix, but > > it isn't at all convenient for hardware. pi would be interesting in > > that many useful multiples of pi would have exact representations. > > What would be the "exact" representation of 4pi? I think 4pi, being larger than one circle, is officially declared to be Not Useful. (The uses of base-pi are arcane, obscure, and AFAIAA not greatly important. But they exist.) > Using non-integer radix will make it hard to produce correctly-rounded > results for even simple expressions like (x+x); On the contrary. pi+pi will be exactly 20. No rounding needed. The problems in this regard are the same as with integer bases. Of course, the _real_ problem is that most numbers we use _aren't_ multiples or rational fractions of pi, and base-pi is as difficult for them as base-16 is for pi. Richard
[toc] | [prev] | [next] | [standalone]
| From | supercat@casperkitty.com |
|---|---|
| Date | 2015-10-02 09:23 -0700 |
| Message-ID | <e674378a-2ead-4abc-ab38-db5a7faef632@googlegroups.com> |
| In reply to | #71597 |
On Friday, October 2, 2015 at 6:07:15 AM UTC-5, Richard Bos wrote: > supercat wrote: > > What would be the "exact" representation of 4pi? > > I think 4pi, being larger than one circle, is officially declared to be > Not Useful. (The uses of base-pi are arcane, obscure, and AFAIAA not > greatly important. But they exist.) How would one add two numbers in base pi? Integer number bases have the nice property that the sum, difference, or product of any two numbers which have finite representations will likewise have a finite representation, and any base of the form P^(Q/R) will likewise have that property if P, Q, and R are all positive integers. But I don't think that works with pi.
[toc] | [prev] | [next] | [standalone]
| From | Martin Shobe <martin.shobe@yahoo.com> |
|---|---|
| Date | 2015-10-02 12:07 -0500 |
| Message-ID | <mumdgb$ppv$1@dont-email.me> |
| In reply to | #71620 |
On 10/2/2015 11:23 AM, supercat@casperkitty.com wrote: > On Friday, October 2, 2015 at 6:07:15 AM UTC-5, Richard Bos wrote: >> supercat wrote: >>> What would be the "exact" representation of 4pi? >> >> I think 4pi, being larger than one circle, is officially declared to be >> Not Useful. (The uses of base-pi are arcane, obscure, and AFAIAA not >> greatly important. But they exist.) > > How would one add two numbers in base pi? Integer number bases have the nice > property that the sum, difference, or product of any two numbers which have > finite representations will likewise have a finite representation, and any > base of the form P^(Q/R) will likewise have that property if P, Q, and R are > all positive integers. But I don't think that works with pi. That property holds for any base greater than one. Martin Shobe
[toc] | [prev] | [next] | [standalone]
| From | supercat@casperkitty.com |
|---|---|
| Date | 2015-10-02 10:47 -0700 |
| Message-ID | <293434fc-dbae-405d-ba2f-b0d8dca384f3@googlegroups.com> |
| In reply to | #71626 |
On Friday, October 2, 2015 at 12:07:24 PM UTC-5, Martin Shobe wrote: > That property holds for any base greater than one. How about base 1.5? What's the sum of 1.0+1.0 in that base?
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2015-10-02 17:48 -0700 |
| Message-ID | <lnwpv4zshx.fsf@kst-u.example.com> |
| In reply to | #71630 |
supercat@casperkitty.com writes:
> On Friday, October 2, 2015 at 12:07:24 PM UTC-5, Martin Shobe wrote:
>> That property holds for any base greater than one.
>
> How about base 1.5? What's the sum of 1.0+1.0 in that base?
Approximately
10.010000010010010100000000010000001000010000001001001010000000000010001001...
Curiously, there doesn't seem to be a repeating pattern.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2015-10-03 16:46 +0100 |
| Message-ID | <muot5i$pnn$1@dont-email.me> |
| In reply to | #71654 |
On 03/10/15 01:48, Keith Thompson wrote: > supercat@casperkitty.com writes: >> On Friday, October 2, 2015 at 12:07:24 PM UTC-5, Martin Shobe wrote: >>> That property holds for any base greater than one. >> >> How about base 1.5? What's the sum of 1.0+1.0 in that base? > > Approximately > 10.010000010010010100000000010000001000010000001001001010000000000010001001... > > Curiously, there doesn't seem to be a repeating pattern. If that's true (and I have no reason to doubt you), then 2 is irrational. :-) -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | Martin Shobe <martin.shobe@yahoo.com> |
|---|---|
| Date | 2015-10-05 10:41 -0500 |
| Message-ID | <muu5j0$vr0$1@dont-email.me> |
| In reply to | #71630 |
On 10/2/2015 12:47 PM, supercat@casperkitty.com wrote: > On Friday, October 2, 2015 at 12:07:24 PM UTC-5, Martin Shobe wrote: >> That property holds for any base greater than one. > > How about base 1.5? What's the sum of 1.0+1.0 in that base? > Yeah. I messed that up. Sorry. Martin Shobe
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Date | 2015-09-28 15:31 -0400 |
| Message-ID | <56099589.3050705@verizon.net> |
| In reply to | #71380 |
On 09/28/2015 01:59 PM, Richard Heathfield wrote: ... > The important question in the present context is: what is the largest > integer that double is required to be able to represent precisely, such > that all smaller (positive) integers can also be represented? > > It was my belief that this number is considerably lower than 2^53, but > it is now only my opinion. I don't quite see how to get the relevant > number from the Linear B description of floating point provided in the > Standard. From 5.2.4.2.2p2, "A floating-point number (x) is defined by the following model: x = s*b^e * (the sum from k=1 to p of (f_k * b^(-k)) )" [Note: the model actually given relies upon sub-scripts, super-scripts, one greek letter, and three levels of printing, none of which are guaranteed to display meaningfully in a usenet message. I've therefore taken the liberty of re-writing it to avoid those problems, without changing the underlying meaning. f_k corresponds to 'k' being a subscript of f, b^e corresponds to pow(b,e), and I've converted a three-level sigma symbol into English words.] For any given x, you can represent x+1 by increasing f_e by 1 - if the result is b, then replace it by 0 and carry on to the next digit. But you can only do this only if f_e exists. Therefore, the smallest positive (so s==1) integer x such that x+1 can't be represented has e==p+1, f_0==1, and f_k==0 for all other values of k. That number has the value 1*b^(p+1)*1*b^(-1), or simply b^p. 5.2.4.2.2p13 says that DBL_EPSILON == b^(1-p) == FLT_RADIX/(b^p). Therefore, the number you're looking for is FLT_RADIX/DBL_EPSILON. The smallest permitted value for FLT_RADIX is 2; the largest permitted value of DBL_EPSILON is 1e-9, so the number you're looking for can't be smaller than 2e9. You can get exactly that limit using p=1, b=2e9. That would require 31 bits to store the significand, and only 3 bits for the exponent, with e_min==-3 and e_max=4, so it would fit in 35 bits. b=2^31 would make more efficient use of that amount of space. I can't vouch for the accuracy of the above analysis - I'm too error prone; but if it is in error, it should at least be correctable to give the right answer.
[toc] | [prev] | [next] | [standalone]
| From | Robert Wessel <robertwessel2@yahoo.com> |
|---|---|
| Date | 2015-09-28 16:40 -0500 |
| Message-ID | <8scj0bp19ohm57d9clnbk529hggaiuf6ji@4ax.com> |
| In reply to | #71390 |
On Mon, 28 Sep 2015 15:31:21 -0400, James Kuyper <jameskuyper@verizon.net> wrote: >On 09/28/2015 01:59 PM, Richard Heathfield wrote: >... >> The important question in the present context is: what is the largest >> integer that double is required to be able to represent precisely, such >> that all smaller (positive) integers can also be represented? >> >> It was my belief that this number is considerably lower than 2^53, but >> it is now only my opinion. I don't quite see how to get the relevant >> number from the Linear B description of floating point provided in the >> Standard. > >From 5.2.4.2.2p2, "A floating-point number (x) is defined by the >following model: >x = s*b^e * (the sum from k=1 to p of (f_k * b^(-k)) )" > >[Note: the model actually given relies upon sub-scripts, super-scripts, >one greek letter, and three levels of printing, none of which are >guaranteed to display meaningfully in a usenet message. I've therefore >taken the liberty of re-writing it to avoid those problems, without >changing the underlying meaning. f_k corresponds to 'k' being a >subscript of f, b^e corresponds to pow(b,e), and I've converted a >three-level sigma symbol into English words.] > >For any given x, you can represent x+1 by increasing f_e by 1 - if the >result is b, then replace it by 0 and carry on to the next digit. But >you can only do this only if f_e exists. Therefore, the smallest >positive (so s==1) integer x such that x+1 can't be represented has >e==p+1, f_0==1, and f_k==0 for all other values of k. That number has >the value 1*b^(p+1)*1*b^(-1), or simply b^p. > >5.2.4.2.2p13 says that DBL_EPSILON == b^(1-p) == FLT_RADIX/(b^p). >Therefore, the number you're looking for is FLT_RADIX/DBL_EPSILON. The >smallest permitted value for FLT_RADIX is 2; the largest permitted value >of DBL_EPSILON is 1e-9, so the number you're looking for can't be >smaller than 2e9. You can get exactly that limit using p=1, b=2e9. That >would require 31 bits to store the significand, and only 3 bits for the >exponent, with e_min==-3 and e_max=4, so it would fit in 35 bits. b=2^31 >would make more efficient use of that amount of space. > >I can't vouch for the accuracy of the above analysis - I'm too error >prone; but if it is in error, it should at least be correctable to give >the right answer. Though the footnote to that says: "The floating-point model is intended to clarify the description of each floating-point characteristic and does not require the floating-point arithmetic of the implementation to be identical." Are non-integer bases actually ruled out?
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Date | 2015-09-28 18:17 -0400 |
| Message-ID | <5609BC75.7010903@verizon.net> |
| In reply to | #71396 |
On 09/28/2015 05:40 PM, Robert Wessel wrote: ... > Though the footnote to that says: "The floating-point model is > intended to clarify the description of each floating-point > characteristic and does not require the floating-point arithmetic of > the implementation to be identical." Are non-integer bases actually > ruled out? Not as far as I can see. The possibilities allowed by floating point implementations that can be exactly described by the model form a well-defined set that's capable of being meaningfully discussed. The possibilities allowed by the fact that an implementation need not be well-described by that model do not. Actual FP implementations that don't quite fit might be worth discussing, but the full range of possibilities is too ill-defined.
[toc] | [prev] | [next] | [standalone]
| From | Tim Rentsch <txr@alumni.caltech.edu> |
|---|---|
| Date | 2015-09-30 02:49 -0700 |
| Message-ID | <kfnio6sb5k8.fsf@x-alumni2.alumni.caltech.edu> |
| In reply to | #71396 |
Robert Wessel <robertwessel2@yahoo.com> writes: > On Mon, 28 Sep 2015 15:31:21 -0400, James Kuyper > <jameskuyper@verizon.net> wrote: > >> On 09/28/2015 01:59 PM, Richard Heathfield wrote: >> ... >>> The important question in the present context is: what is the largest >>> integer that double is required to be able to represent precisely, such >>> that all smaller (positive) integers can also be represented? >>> >>> It was my belief that this number is considerably lower than 2^53, but >>> it is now only my opinion. I don't quite see how to get the relevant >>> number from the Linear B description of floating point provided in the >>> Standard. >> >> From 5.2.4.2.2p2, "A floating-point number (x) is defined by the >> following model: >> x = s*b^e * (the sum from k=1 to p of (f_k * b^(-k)) )" >> [snip] > > Though the footnote to that says: "The floating-point model is > intended to clarify the description of each floating-point > characteristic and does not require the floating-point arithmetic of > the implementation to be identical." Are non-integer bases actually > ruled out? I read about this somewhere. I think it was a DR but may have been discussion from one of the meetings, I don't remember exactly where. The intent was (and is, AFAIK) to allow non-standard representations to be used, within certain limits; in particular there is an expectation that zero must be representable exactly. IIRC an example was mentioned using a logarithmic encoding. So AFAIK the intent was not to preclude non-integer bases (among many other possibilities).
[toc] | [prev] | [next] | [standalone]
Page 4 of 8 — ← Prev page 1 2 3 [4] 5 6 7 8 Next page →
Back to top | Article view | comp.lang.c
csiph-web