Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
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
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
x+=a and x=x+a
mantravadi murali
Greenhorn
Posts: 1
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
<pre>
int x;
x = x+0.1;
gives an error.
while......
x += 0.1
doesn't give an error.
Art Metzer
Ranch Hand
Posts: 241
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi, Mantravadi.
You don't get any compilation error in the second case because
x += 0.1;
is equivalent to
x = (int) ( x + 0.1 );
Art
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
what accounts for precision problems when computing floating point numbers?
cut off decimals of a float number
Percision problems with Double and Float numbers
different between java 1.5 and 1.6
Missing Numeric Suffixes
More...