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
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 8 API documentation
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?
subject: Hexadecimal floating-point literals
Help with using Buffered Reader and if statements
Replacing characters in a string?
Compiling errata for K&B, SCJP 6
Single precision /double precision?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014