473,387 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

hex float literals in C++


It is widely acknowledged that C++ is moving toward greater
compatibility with C99. Great! Where can I find the details?
I'm particularly interested in support for hexadecimal floating point
constants.

I have found the TR1 document which describes new library features

http://www.open-std.org/jtc1/sc22/wg...2005/n1836.pdf
which describes a new 'hexfloat' manipulator and incorporates by
reference the C99 format conversion specifiers: %a and %A.

But what about literal floats in program text? Will I be able
to write:

float x = 0x1.ap+0;

in a standards conforming C++ program at some point? I can already
do this with some (most?) compilers, but I find myself battling the
"standards compliance police". Is there a draft or a proposal,
or something that I can reference, so at least I can say "This works
with the compilers we're using today, and it is on track to be standardized
in the future, so there's an awfully good chance it will continue to
work for as long as we need it."

Thanks,
John Salmon
Jan 15 '07 #1
1 3547
John Salmon wrote:
It is widely acknowledged that C++ is moving toward greater
compatibility with C99. Great! Where can I find the details?
I'm particularly interested in support for hexadecimal floating point
constants.

I have found the TR1 document which describes new library features

http://www.open-std.org/jtc1/sc22/wg...2005/n1836.pdf
which describes a new 'hexfloat' manipulator and incorporates by
reference the C99 format conversion specifiers: %a and %A.

But what about literal floats in program text? Will I be able
to write:

float x = 0x1.ap+0;

in a standards conforming C++ program at some point? I can already
do this with some (most?) compilers, but I find myself battling the
"standards compliance police". Is there a draft or a proposal,
or something that I can reference, so at least I can say "This works
with the compilers we're using today, and it is on track to be standardized
in the future, so there's an awfully good chance it will continue to
work for as long as we need it."
If you don't get an answer here, you might try on comp.std.c++.

Cheers! --M

Jan 15 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tomasz Stochmal | last post by:
Hi I need to write a function that will convert a float number given as string into long and reverse function of that, example: '713566671863.6850' becomes 7135666718636850L...
5
by: Peter Scheurer | last post by:
Hi, we found some strange behavior when operating with floats and round(). The following simplified statement reproduces the problem. select 6.56 - round(convert(float, 6.56), 2) from...
18
by: Active8 | last post by:
I put the bare essentials in a console app. http://home.earthlink.net/~mcolasono/tmp/degub.zip Opening output.fft and loading it into a vector<float> screws up, but input1.dat doesn't. It does...
2
by: julien | last post by:
Hi, I am using Sybase 12.5 dataserver and ASP.NET I am calling a stored procedure from my asp.net page, in this stored procedure, I have 2 float fields that are returned. One is directly taken...
15
by: Kay Schluehr | last post by:
I wonder why this expression works: >>> decimal.Decimal("5.5")**1024 Decimal("1.353299876254915295189966576E+758") but this one causes an error 5.5**1024 Traceback (most recent call...
5
by: Peter Hansen | last post by:
I'm investigating a puzzling problem involving an attempt to generate a constant containing an (IEEE 754) "infinity" value. (I understand that special float values are a "platform-dependent...
11
by: Christian | last post by:
Hi, I have a small problem about distant compilation and float literals. Here is my program : #include <stdio.h> void main() { float f; double d; f = 0.5;
6
by: Joakim Hove | last post by:
Hello, consider a function: double some_func(double arg) { /* */ }
9
by: Lie | last post by:
I've noticed some oddly inconsistent behavior with int and float: Python 2.5.1 (r251:54863, Mar 7 2008, 03:39:23) on linux2 -345 works, but Traceback (most recent call last): File...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.