473,761 Members | 8,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3477
"Satish" <sa************ *@gmail.comwrit es:
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.o rg
--
"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.stanfor d.eduwrites:
"Satish" <sa************ *@gmail.comwrit es:
[snip]
>Also is there anywhere I can download ANSI standards for C/C++?

webstore.ansi.o rg
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_Keit h) 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.orgwr ote:
Ben Pfaff <b...@cs.stanfo rd.eduwrites:
"Satish" <satishsantha.. .@gmail.comwrit es:

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

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_Keit h) 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.securityfoc us.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.stanfo rd.eduwrote:
"Satish" <satishsantha.. .@gmail.comwrit es:
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.o rg
--
"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.securityfoc us.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
2273
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 things. God save me from coding in boring & slow & no pointers java!! p.s.: how much time usually needs the compiler vendors to implement new standards? p.s.2: anybody knows which compiler supports export keyword? Thanks to you all.
5
1624
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 also experience with Pascal, Basic and a multiple of other languages. I used to develop computer games for the 8-bit computers and the 16-bit computers such as Atari and Amiga. But "C" is "new" to me from a programming perspective. I want to...
4
1620
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 \ character according to the standard?
8
1405
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 avaliable from open-std.org. However I was considering to obtain a copy of the real thing, but I wonder if it worth it. Mainly I'm interested in _generating_ standard conforming code. Is it worth it? Also I'd like to know, where to get a copy of the old...
0
9531
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10115
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9957
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8780
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7332
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5229
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3456
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.