473,572 Members | 3,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

exponentiation operator (lack of)

Curious:
Why wasnt a primitive exponentiation operator not added to C99?
And, are there requests to do so in the next std revision?

Justification for doing so:
C and C++ are increasingly used in low-level
numerical computations, replacing Fortran in newer projects.
Check, for example, sourceforge.net or freshmeat.net

But neither language offers a primitive exp operator.
^ is exclusive OR, which is much less common in numerical
programs than exponentiation. However, ^^ is open.

Dec 22 '05 #1
67 8588
ca****@colorado .edu wrote:
Curious:
Why wasnt a primitive exponentiation operator not added to C99?


You should read the FAQ before posting, this is answered in question
14.7, see http://www.eskimo.com/~scs/C-faq/q14.7.html for the answer.

Robert Gamble

Dec 22 '05 #2
That is not an answer, just an excuse. It links language operators to
presence or absence of hardware. C is not assembly language.
Translation is the job of something called a compiler.

Dec 22 '05 #3
ca****@colorado .edu wrote:
That is not an answer, just an excuse. It links language operators to
presence or absence of hardware. C is not assembly language.
Translation is the job of something called a compiler.

1) You have failed to quote sufficient context -- for which Google's
broken Usenet interface is no excuse.
2) You were directed to an answer -- in the FAQ, which you should have
read *before* asking your original question.
3) This newsgroup is primarily concerned with the ISO C language as it
*is*. If you want it to be different, the proper place for such
discussions is news:comp.std.c .

Further, I recommend you do some reading on the history of the C
language, why it was created, what was its intended purpose, etc. That
may provide insight into the design decisions made.

HTH,
--ag

--
Artie Gold -- Austin, Texas
http://goldsays.blogspot.com
http://www.cafepress.com/goldsays
"If you have nothing to hide, you're not trying!"
Dec 22 '05 #4
ca****@colorado .edu wrote:
C is not assembly language.


Some people would beg to differ. C evolved from B which was merely a
very high level macro assembler. C itself was developed primarily as
replacement of assembly - a better way to write low level system
software. You want something higher level, try C++ (there you can
overload whatever operater you want).

Dec 22 '05 #5
sl*******@yahoo .com a écrit :
ca****@colorado .edu wrote:
C is not assembly language.

Some people would beg to differ. C evolved from B which was merely a
very high level macro assembler. C itself was developed primarily as
replacement of assembly - a better way to write low level system
software. You want something higher level, try C++ (there you can
overload whatever operater you want).


This is the old story supported by many people around here.

C is dead and everybody should move to the "higher" level, C++.

This justifies trying to deny C any evolution possibilities, and
keeping the discussion in this group as "low level" as
possible.

The OP question is a good one. Personally I do not think we need a new
exponentiation operator, and in lcc-win32 there is operator overloading,
but those are not answers to the OP question.

May I remind you that the supposedly "higher" level C++ doesn't
have an exponentiation operator EITHER ???

I think the answer is that the enormous problem of introducing a
new operator, with all the complications of the 15 levels of
precedence of C makes the introduction of an ^^ operator an
herculean task, one that nobody has attempted, and probably never
will.

Let's stop the nonsense and tell the truth for one.

jacob

Dec 23 '05 #6
> Some people would beg to differ. C evolved from B which was merely a
very high level macro assembler. C itself was developed primarily as
replacement of assembly - a better way to write low level system
software. You want something higher level, try C++ (there you can
overload whatever operater you want)


Absolutely correct, but C++ does not have an exponentiation operator
to overload. I might be off base here since I use C++ very little,
but I dont think pow(..) is in the "overloadab le" list.

As regards gradual departure of C from assembly, let me note that
C99 offers a built-in complex type and associated operators.
Those are not part of any widely used assembly language
instruction set, although they can be microcoded in some
embedded systems.

Dec 23 '05 #7
"sl*******@yaho o.com" writes:
Some people would beg to differ. C evolved from B which was merely a
very high level macro assembler. C itself was developed primarily as
replacement of assembly - a better way to write low level system
software. You want something higher level, try C++ (there you can
overload whatever operater you want).


This exposes one of the frailties of C++. The natural exponentiation
operator, ^, has the precedence of exclusive or, which is far too low for
the operation desired. Overloading it would be a disaster waiting to
happen. You would have parens all over the place and if you forgot one
there would probably be hell to pay in faulty results.
Dec 23 '05 #8
jacob navia wrote:
sl*******@yahoo .com a écrit :
ca****@colorado .edu wrote:
C is not assembly language.

Some people would beg to differ. C evolved from B which was merely a
very high level macro assembler. C itself was developed primarily as
replacement of assembly - a better way to write low level system
software. You want something higher level, try C++ (there you can
overload whatever operater you want).

<snip>

May I remind you that the supposedly "higher" level C++ doesn't
have an exponentiation operator EITHER ???


The OP I was replying to did not mention anything about exponentiation
operator. He just said operators are linked to what is available in
assembly.

Dec 23 '05 #9
On 2005-12-23, ca****@colorado .edu <ca****@colorad o.edu> wrote:
Some people would beg to differ. C evolved from B which was merely a
very high level macro assembler. C itself was developed primarily as
replacement of assembly - a better way to write low level system
software. You want something higher level, try C++ (there you can
overload whatever operater you want)


Absolutely correct, but C++ does not have an exponentiation operator
to overload. I might be off base here since I use C++ very little,
but I dont think pow(..) is in the "overloadab le" list.


I believe functions can also be overloaded.
Dec 23 '05 #10

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

Similar topics

2
4576
by: David Laub | last post by:
I know there is no C# exponentiation operator. But since the double class is sealed, there seems no way to add the operator override without creating a new class which uses containment (of a double value) This seems a major pain, and would probably wind up being more syntactically messy than just calling Math.Pow(x,y) Surely greater...
0
7640
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7705
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...
0
8000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6337
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...
0
5248
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...
0
3685
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...
0
3673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2138
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1240
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.