473,382 Members | 1,078 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,382 software developers and data experts.

ANSI Standard : HUGE_VAL * 0.0

Hi ,

What is the behaviour as per ANSI standard for HUGE_VAL * 0.0? Also
is there anywhere I can download ANSI standards for C/C++?

Thanks,
Satish

Feb 7 '07 #1
6 3461
"Satish" <sa*************@gmail.comwrites:
What is the behaviour as per ANSI standard for HUGE_VAL * 0.0?
The standard doesn't say. It could be a NaN or 0, for example.
Also is there anywhere I can download ANSI standards for C/C++?
webstore.ansi.org
--
"If I've told you once, I've told you LLONG_MAX times not to
exaggerate."
--Jack Klein
Feb 7 '07 #2
Ben Pfaff <bl*@cs.stanford.eduwrites:
"Satish" <sa*************@gmail.comwrites:
[snip]
>Also is there anywhere I can download ANSI standards for C/C++?

webstore.ansi.org
n1124.pdf is the ISO C99 standard with two Technical Corrigenda merged
into it (the changes are marked with change bars). I have a copy of
the C99 standard itself (I paid $18 for it), but I usually use n1124
intead.

<http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1124.pdf>

I don't know about C++. Ask in comp.std.c++ or comp.lang.c++ -- but
check their FAQ first.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 7 '07 #3
On Feb 7, 5:57 pm, Keith Thompson <k...@mib.orgwrote:
Ben Pfaff <b...@cs.stanford.eduwrites:
"Satish" <satishsantha...@gmail.comwrites:

[snip]
Also is there anywhere I can download ANSI standards for C/C++?
webstore.ansi.org

n1124.pdf is the ISO C99 standard with two Technical Corrigenda merged
into it (the changes are marked with change bars). I have a copy of
the C99 standard itself (I paid $18 for it), but I usually use n1124
intead.

<http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1124.pdf>

I don't know about C++. Ask in comp.std.c++ or comp.lang.c++ -- but
check their FAQ first.

--
Keith Thompson (The_Other_Keith) k...@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Keith and Ben thanks for your quick replies. It helped me.

Thanks again,
Satish

Feb 7 '07 #4
Satish wrote:
>
What is the behaviour as per ANSI standard for HUGE_VAL * 0.0?
Also is there anywhere I can download ANSI standards for C/C++?
No, there is no standard for C/C++. If you want a standard for a
extant language, such as C or Pascal or Ada, or even (shudder) C++,
the answer might be different, and it would probably be an ISO
standard.

Googling for N869 or N1124 might be illuminating.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews

Feb 8 '07 #5
On Feb 7, 5:35 pm, Ben Pfaff <b...@cs.stanford.eduwrote:
"Satish" <satishsantha...@gmail.comwrites:
What is the behaviour as per ANSI standard for HUGE_VAL * 0.0?

The standard doesn't say. It could be a NaN or 0, for example.
Also is there anywhere I can download ANSI standards for C/C++?

webstore.ansi.org
--
"If I've told you once, I've told you LLONG_MAX times not to
exaggerate."
--Jack Klein
Hi,

With your statement above my project could have been using a bad
design for years. Mine is a computationally intensive project. We
used to initialize variables with HUGE_VAL and project lived with it
even many comparison might have gone wrong when val * 0.0 was used.
As we moved to new compilers we identified this problem because the
new compiler returns NaN. So initializing to HUGE_VAL to my opinion
is bad design. At the sametime I cannot assign the variable with 0
because for example I use a check if val == HUGE_VAL update database
as NULL. I cannot do like val == 0 because the value indeed may be
computed to 0. So I was wondering do you think it is a good idea to
initialize variable with NaN. Does the standard say anything for NaN
* 0.0? At least the popular math functions when operated with NaN or
invalid values like fmod(-HUGE_VAL, 0) do they return HUGE_VAL or NaN?

Thanks,
Satish

Feb 10 '07 #6
Satish wrote:
>
.... snip ...
>
With your statement above my project could have been using a bad
design for years. Mine is a computationally intensive project. We
used to initialize variables with HUGE_VAL and project lived with it
even many comparison might have gone wrong when val * 0.0 was used.
As we moved to new compilers we identified this problem because the
new compiler returns NaN. So initializing to HUGE_VAL to my opinion
is bad design. At the sametime I cannot assign the variable with 0
because for example I use a check if val == HUGE_VAL update database
as NULL. I cannot do like val == 0 because the value indeed may be
computed to 0. So I was wondering do you think it is a good idea to
initialize variable with NaN. Does the standard say anything for NaN
* 0.0? At least the popular math functions when operated with NaN or
invalid values like fmod(-HUGE_VAL, 0) do they return HUGE_VAL or NaN?
NaN <opanything = NaN.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
Feb 10 '07 #7

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

Similar topics

20
by: skoco | last post by:
Hello! Do you know when will be the new standard for c++ approved? And WHAT will be inside? Hope there will be some thread and synchro classes, text and XML parsing, new containers and other new...
5
by: Mr. Olsen | last post by:
Dear Everyone, This is my first post on this newsgroup. I have extensive experience and knowledge of other programming languages, primarily on an Assembler level, the Z80, 6502/10, MC680x0, but...
4
by: Brand Bogard | last post by:
When creating a #define symbol like this, #define SYMBOL1_OFFSET 100 #define SYMBOL2_OFFSET(SYMBOL1_OFFSET +\ 50) The 50) is on a new line. Can there be any whitespace after the \...
8
by: Wolfgang Draxinger | last post by:
As already noted a few months ago I'm working on a language, that is intended to be compiled into C as an intermediary. ATM I'm working with the latest publically avaliable draft of C99...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.