Sizeof int

J

jacob navia

Keith Thompson a écrit :
No, having a bignum library doesn't mean you can change sizeof(int).
It may mean you can change sizeof(bignum).

Obviously. The "int" type is fixed, but in a bignum
package the size of the bignums may vary. I wrote
elsewhere sizeof (bignum int) but not everywhere

Sorry about this confusion
 
M

Mark McIntyre

Mark McIntyre a écrit :

Ahh what a good argumentation!

Thanks. I thought it was quite apt too.
It reflects immediately the intellectual capacities of the poster.

Or perhaps it reflects immediately my boredom with your "mines bigger
than yours" argument with Tom. Still, at least I didn't choose to
gratuitously insult either of your intelligences.
Reading the subject of the thread is also something too difficult for
you.

Yeah, whatever. If you choose to consider yourself superior, there's a
word for that, even in French.
If you followed the discussion you could have understood something.

I followed it right up to the point at which it became a session of
oneupmansship between two offtopic posters.
But it is obviously much easier to throw some obscenity.

Apparently you don't know what the phrase means. I suggest you read
"Liars Poker".
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
M

Mark McIntyre

While I'm not sure of the context, and with my downed server
to worry about I can't go check,

Floating point. The context is that IEE754 /removes/ the dependenct on
word length. I strongly suspect its got nothing to do with C as such.
I stand corrected.

I don't think so!
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
T

Tak-Shing Chan

Floating point. The context is that IEE754 /removes/ the dependenct on
word length. I strongly suspect its got nothing to do with C as such.

What do you mean by ``C as such''? All I am saying is that
C does have a ``concept'' of word length, even though the
behaviour of the abstract machine does not depend on it.

Tak-Shing
 
K

Keith Thompson

Mark McIntyre said:
Floating point. The context is that IEE754 /removes/ the dependenct on
word length. I strongly suspect its got nothing to do with C as such.


I don't think so!

Here's the actual quotation from C99 F.1 (the introduction to Annex F
(normative), "IEC 60559 floating-point arithmetic":

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.

I haven't bothered to indicate italics.

So "word length" refers only to the difference between the IEEE 754
and 854 standards. I don't believe this paragraph implies that the C
standard uses the concept of "word length".
 
T

Tak-Shing Chan

So "word length" refers only to the difference between the IEEE 754
and 854 standards. I don't believe this paragraph implies that the C
standard uses the concept of "word length".

There is a big difference between ``has [the] concept of''
(Poelstra, 2006-07-22) and ``uses the concept of'' (Thompson,
2006-07-23). ISO/IEC 9899:1999 (E) certainly has a concept of
word length (otherwise F.1 would be uninterpretable), but this
concept is never used in the rest of the standard.

Tak-Shing
 
M

Mark McIntyre

On Sun, 23 Jul 2006, Mark McIntyre wrote:

What do you mean by ``C as such''? All I am saying is that
C does have a ``concept'' of word length, even though the
behaviour of the abstract machine does not depend on it.

I disagree. The very para you quote is a reference to a different
standard, it does NOT refer to any feature of C.

<extreme analogy>
You could as well claim that C has a concept of ISO, because its
mentioned on several pages.
</end>
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
M

Mark McIntyre

So "word length" refers only to the difference between the IEEE 754
and 854 standards. I don't believe this paragraph implies that the C
standard uses the concept of "word length".

There is a big difference between ``has [the] concept of''
(Poelstra, 2006-07-22) and ``uses the concept of'' (Thompson,
2006-07-23). ISO/IEC 9899:1999 (E) certainly has a concept of
word length (otherwise F.1 would be uninterpretable), but this
concept is never used in the rest of the standard.

I've already said this elsethread but to recap:

in that case, C also has the concept of ISO, and of Annex. I suspect
that is nonsense.

My feeling is that you searched for "word length" and got a hit, but
didn't thoroughly read it. If so, no problem but stop digging.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
T

Tak-Shing Chan

I disagree. The very para you quote is a reference to a different
standard, it does NOT refer to any feature of C.

<extreme analogy>
You could as well claim that C has a concept of ISO, because its
mentioned on several pages.
</end>

Your analogy is broken. The paragraph I quoted refers to a
normative reference of the standard. According to the standard:

``The following normative documents contain provisions
which, through reference in this text, constitute provisions of
this International Standard'' (ISO/IEC 9899:1999, 2 para. 1).

The standard continues: ``ISO 60559:1989, Binary
floating-point arithmetic for microprocessor systems (previously
designated IEC 559:1989)'' (ISO/IEC 9899:1999, 2 para. 8).

Then we have, in Annex F, an explicit reference to
ISO 60559:1989, making it a provision of C as well.

Tak-Shing
 
T

Tak-Shing Chan

So "word length" refers only to the difference between the IEEE 754
and 854 standards. I don't believe this paragraph implies that the C
standard uses the concept of "word length".

There is a big difference between ``has [the] concept of''
(Poelstra, 2006-07-22) and ``uses the concept of'' (Thompson,
2006-07-23). ISO/IEC 9899:1999 (E) certainly has a concept of
word length (otherwise F.1 would be uninterpretable), but this
concept is never used in the rest of the standard.

I've already said this elsethread but to recap:

in that case, C also has the concept of ISO, and of Annex. I suspect
that is nonsense.

No, because the concepts of ``ISO'' and ``Annex'' are not
backed by normative references (ISO/IEC 9899:1999, clause 2).

Tak-Shing
 
D

Dik T. Winter

> Dik T. Winter a écrit : ....
>
> No it is floating slash, and it is working since several years.

It is not, it is fixed slash. In fixed slash notation you represent
the numerator and denominator with fixed size representation. In
floating slash notation you use a number of bits that say where the
slash is (say the value is m), then the denominator is m+1 bits (or
m bits if there is a hidden most significant bit), the remainder
of the notation is the numerator. (In what way does your slash float?)
Say your slash designator is k bits wide, in that case m ranges from
0 to 2^k - 1. So the size of the denominator ranges from 1 to 2^k bits
and the size of the numerator ranges from n - k downto
n - 2^k bits (where n is the total number of bits allocated, and assuming
hidden bit in the numerator).

Floating slash is used very limited because the operations are fairly
complex. Fixed slash is used a bit more, but rounding is complicated.
>
> You are welcome. First you misunderstand, then you start drawing
> absurd conclusions. I am speaking about indefinitely long integers
> not just two word size integers!

You were *not* talking about indefinitely long integers. Your packages
has integers of a fixed size. My example was to show the difficulty
in rounding operations when using fixed slash notation, and I am not
talking about "word size integers", I am talking about integers with a
fixed size.
>
>
> ????
> I wrote sizeof (bgnum int)

No, you did not write that, see your original article. But what I was
stating was that you use a fixed slash notation type with fixed size
integers for both integers and rationals. There is no reason to do
so. If you had split the two types, there was no need to fix the size
of integers. It makes sense to fix the size of the integers used in
the fixed slash notation for rationals, otherwise the growth would be
uncontrolled (with fixed slash notation the size of the integers needed
can easily double with every operation, even addition).

But my question still stands. How do you do rounding of results in your
notation? Do you always obtain the nearest representable result? Or
what? Those are things a numerical mathematician needs to know. He/she
can even be satisfied when you state that the result is not always the
nearest representable number, as long as you give the error bounds.
One of my gripes with the Cray 1 was that it nowhere gave error bounds
on the operations, you had to read the hardware reference manual to
find that a multiplication of two operands (with 48 bit mantissa) could
give a result that was only precise in 45 bits. If they had stated that
upfront, that would have simplified error analysis.
 
J

Joe Wright

Tak-Shing Chan said:
Your analogy is broken. The paragraph I quoted refers to a
normative reference of the standard. According to the standard:

``The following normative documents contain provisions
which, through reference in this text, constitute provisions of
this International Standard'' (ISO/IEC 9899:1999, 2 para. 1).

The standard continues: ``ISO 60559:1989, Binary
floating-point arithmetic for microprocessor systems (previously
designated IEC 559:1989)'' (ISO/IEC 9899:1999, 2 para. 8).

Then we have, in Annex F, an explicit reference to
ISO 60559:1989, making it a provision of C as well.

Surely, a 'word' is that amount of information the cpu can get from
memory in a single access. It is usually (not always) the width of the
accumulator.

The Intel family of cpu's is interesting. The 8080 and 8085 has
eight-bit words and eight-bit accumulators. The 8086 has 16-bit word and
accumulator. The 8088 has 8-bit word and 16-bit accumulator.

The 80386 and 80486 have 32-bit word and accumulator. The 80586
(Pentium) has 32-bit accumulator and 64-bit memory word.

There are C implementations for each of these processors. None of them
require or even allow the C programmer to know the width of the memory
word nor that of the accumulator.

I realize that accumulator may not be defined in the C standard, but all
our machines have at lease one. :)
 
B

Ben Pfaff

Joe Wright said:
Surely, a 'word' is that amount of information the cpu can get from
memory in a single access. It is usually (not always) the width of the
accumulator.

I don't think there's any general agreement on how to define the
"word size" of a machine.
 
M

Mark McIntyre

Your analogy is broken.
Nope.

The paragraph I quoted refers to a
normative reference of the standard.

So what? ISO gets mentioned in normative sections.

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
T

Tak-Shing Chan

So what? ISO gets mentioned in normative sections.

There are no normative references for ``ISO'' in the entire
C standard. See clause 2 for the list of normative references.

Tak-Shing
 
M

Mark McIntyre

There are no normative references for ``ISO'' in the entire
C standard. See clause 2 for the list of normative references.

*shrug*.

You're wrong, youre too stubborn to admit it. I can live with that.
EOT
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
T

Tak-Shing Chan

*shrug*.

You're wrong, youre too stubborn to admit it. I can live with that.
EOT

On the contrary, my point is fully supported by ISO/IEC
9899:1999 (E).

Are you disagreeing with the C standard? Are you saying
that the C standard is wrong?

Tak-Shing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top