A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Hexadecimal floating-point literals
Jesper de Jong
Joined: Aug 16, 2005
Aug 09, 2010 01:29:55
I've been programming in Java for more than 10 years, so I thought I knew the language inside out, but I
just discovered a new, obscure feature
: you can write floating-point constants in hexadecimal.
You can for example write:
which is equal to 640.5.
Java Beginners FAQ
JavaRanch SCJP FAQ
The Java Tutorial
Java SE 7 API documentation
- My blog about Scala
Joined: Oct 13, 2005
Aug 09, 2010 05:11:13
I never knew that, but it's in the
Java™ Language Specification
that you can use p/P as an exponent indicator.
Joined: Sep 29, 2008
Aug 09, 2010 06:01:15
Yeah, I never actually understood this one... I suppose some day it could come in handy?
I agree. Here's the link:
subject: Hexadecimal floating-point literals
Help with using Buffered Reader and if statements
Single precision /double precision?
Compiling errata for K&B, SCJP 6
Replacing characters in a string?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013