Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Size of primitive types?

Reply
Thread Tools

Size of primitive types?

 
 
Roedy Green
Guest
Posts: n/a
 
      05-29-2004
On Sat, 29 May 2004 06:59:51 -0500, "Ryan Stewart"
<(E-Mail Removed)> wrote or quoted :

>I took the OP's question to mean actual size on the hardware since he's
>comparing it to C++. To my understanding, there is no standard for that in
>Java.


Java standards don't say HOW something has to be implemented, just the
net effect on the programmer. So even though the logical sizes of
primitives to the programmer are rigidly specified, exactly how that
is pulled off with the hardware is none of our business.

In a similar way Java is says nothing about how many bits a reference
is, or whether it must be a pointer a handle (indirect pointer), and
what additional information it carries besides address.

It does not even insist that 0 be used to represent null.

Java does not specify byte sex internally, just that when you do i/o
it looks as though the machine were 2's complement big endian. This
way a little-endian machine is not in the least slowed down, except
when it comes time to do binary i/o.


--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      05-29-2004
On Sat, 29 May 2004 17:42:50 GMT, Andrew Thompson
<(E-Mail Removed)> wrote or quoted :

>What about setting the follow-ups*
>to a valid group?


You have to put some answer back in the bad group to tell the OP who
where the rest of us are hanging out.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      05-29-2004
On Sat, 29 May 2004 18:58:51 GMT, Roedy Green wrote:
> On Sat, 29 May 2004 17:42:50 GMT, Andrew Thompson wrote or quoted :
>
>>What about setting the follow-ups*
>>to a valid group?

>
> You have to put some answer back in the bad group to tell the OP who
> where the rest of us are hanging out.


The *answer* *does* go back to the original group..
It is only *responses* to that post that
go to the 'follow-up' address..

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
Reply With Quote
 
Ryan Stewart
Guest
Posts: n/a
 
      05-29-2004
"P.Hill" <(E-Mail Removed)> wrote in message
news:c9ade9$fg3$(E-Mail Removed)...
> Ryan Stewart wrote:
> >>comp.lang.java

> >
> > I thought it was created but then "uncreated". That doesn't keep people

from
> > posting there. Unfortunately I saw his post there first.

>
> You read an group you know to be old and out of date? That's odd.
> Try to encourage it's death by leaving it alone and using
> comp.lang.java.programmer or .help
>

I do encourage its death. I do so by encouraging people who post there to
instead use one of the aforementioned groups. I think I failed to include
that in my reply this time though...


 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      05-29-2004
On Sat, 29 May 2004 19:10:34 GMT, Andrew Thompson
<(E-Mail Removed)> wrote or quoted :

>
>The *answer* *does* go back to the original group..
>It is only *responses* to that post that
>go to the 'follow-up' address..



Unless you mention that you have done that, people won't notice the
follow-up to and their responses just disappear as far as they are
concerned. In the political groups, it is a standard dirty trick to
flame then set the follow-up to some irrelevant bitbucket group like
alt.test so the replies will be thrown away.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      05-29-2004
On Sat, 29 May 2004 19:34:12 GMT, Roedy Green wrote:
> On Sat, 29 May 2004 19:10:34 GMT, Andrew Thompson wrote or quoted :

...
>>The *answer* *does* go back to the original group..
>>It is only *responses* to that post that
>>go to the 'follow-up' address..

>
> Unless you mention that you have done that, ..

<snip Roedy going off on a tangent>

I make a point of mentioning it.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
Reply With Quote
 
Michael Borgwardt
Guest
Posts: n/a
 
      05-30-2004
Roedy Green wrote:
> It specifies the size to the extent there is no way you can tell if
> the actual size inside is larger. I/O sizes and endianness are fixed.
>
> Arithmetic cannot give extra precision.


Actually, it *can*, disproving your claim above. That's why there is an
extra feature, the "strictfp" keyword that allows you to *avoid* having
extra precision...
 
Reply With Quote
 
Mark Thornton
Guest
Posts: n/a
 
      05-30-2004
Michael Borgwardt wrote:

> Roedy Green wrote:
>
>> It specifies the size to the extent there is no way you can tell if
>> the actual size inside is larger. I/O sizes and endianness are fixed.
>>
>> Arithmetic cannot give extra precision.

>
>
> Actually, it *can*, disproving your claim above. That's why there is an
> extra feature, the "strictfp" keyword that allows you to *avoid* having
> extra precision...


Sorry, it can provide an extended exponent range but not extra
precision. Using strictfp ensures that the exponent range is that of
standard double (float), it makes no difference to the precision (number
of mantissa bits) which is always fixed at 53 for double expressions and
I think 24 for float expressions (after allowing for the implied leading
1 bit in each case).
Non conforming VMs may behave differently (e.g. Microsoft's VM).

Mark Thornton
 
Reply With Quote
 
Mark Thornton
Guest
Posts: n/a
 
      05-31-2004
Roedy Green wrote:

> On Sun, 30 May 2004 15:09:06 +0100, Mark Thornton
> <(E-Mail Removed)> wrote or quoted :
>
>
>>Sorry, it can provide an extended exponent range but not extra
>>precision.

>
>
> Wait. I thought the idea was to allow the extra guard bits to be used
> which happens naturally when you use the Pentium FP registers.


No, the main idea was to allow x86 to execute with little loss of speed.
The strict mode requires that the range of the exponent be respected
and this requires the load/save technique to ensure an outsize exponent
is not carried through intermediate results. The x86 processors have a
mode to specify the precision to use (float, double or extended) so it
isn't necessary to allow extended precision in order to use these
processors at maximum speed.

Yes, some people did want a way to allow extended precision as well, but
this was not approved. Also worth noting is that the fastest way of
performing many floating point operations now is via the SSE and SSE2
instructions, which provide float and double precision respectively.

Mark Thornton
 
Reply With Quote
 
Mark Thornton
Guest
Posts: n/a
 
      05-31-2004
Michael Borgwardt wrote:

> Roedy Green wrote:
>
>>> Sorry, it can provide an extended exponent range but not extra
>>> precision.

>>
>>
>>
>> Wait. I thought the idea was to allow the extra guard bits to be used
>> which happens naturally when you use the Pentium FP registers.

>
>
> No, after googling around a bit I found that I had been wrong and Mark is
> right. Leaving out strictfp only allows the JVM to use the extra bits
> for the exponent, not the mantissa, in intermediate results (apparently
> the FPU allows you to choose how to distribute them). This makes FP
> arithmetic faster and succeed in some instances where strictfp arithmetic
> has to produce an overflow, but it does not make it more precise.
>
> Yes, it appears idiotic to me, too. The only people who would object to
> some results being more precise (and thus different) on some platforms
> will be using strictfp anyway, won't they?


Actually no, this is a very complicated business. Algorithms to provide
quad precision (based on doubles) require the precision to be exactly as
expected, but also want as much speed as possible.

Mark Thornton
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Default primitive values from primitive Class<?> object. Daniel Pitts Java 7 10-23-2008 04:30 PM
Preferred Size, Minimum Size, Size Jason Cavett Java 5 05-25-2008 08:32 AM
mega pixels, file size, image size, and print size - Adobe Evangelists Frank ess Digital Photography 0 11-14-2006 05:08 PM
Primitive vs. non-primitive l-value richardclay09@yahoo.co.uk C++ 7 05-09-2005 02:52 PM
How to pass other than a primitive type as a property of a custom control? Henri ASP .Net 0 05-17-2004 02:41 PM



Advertisments