Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

octal value in long representation takes 22 digits

 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

In K & B's book for SCJP 1.4, its given that octal value can be represented upto 21 digits not including the leading zero.

When i tried checking for it, i am able to use it upto 22 digits NOT including the leading zero. I do use JDK 1.4.2_05 version. It compiles and runs fine without any compiler error.



As its based on SCJP book, i had posted it here though its of a beginner question.

Any suggestions or clarifications on this?

Thanks in advance.
[ June 06, 2007: Message edited by: Raghavan Muthu ]
 
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The greatest positive number has 21 digits.
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Manfred Klug,

Thats fine. Thanks for the info. But my intention was why the compiler was not throwing any errors when >21 digits (22 digits) were present.

Probably, was it a typo in K & B's book or am i missing something?

Any ranchers please help me out here.
TIA.
 
Manfred Klug
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Raghavan,

if you have a look at the greatest positive number, you will see that all bits from those digits are used for positive numbers.

For negative numbers, you need one additional bit. That's the 22 digit.
 
Self destruct mode activated. Instructions for deactivation encoded in this tiny ad.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic