How can exponents be used in Turbo Pascal without the ^ operator?

  • Thread starter Thread starter The Grimmus
  • Start date Start date
  • Tags Tags
    Exponents Pascal
Click For Summary

Discussion Overview

The discussion revolves around the use of exponents in Turbo Pascal, specifically addressing the absence of a dedicated exponentiation operator like the ^ operator. Participants explore alternative methods for performing exponentiation within the language.

Discussion Character

  • Technical explanation, Homework-related

Main Points Raised

  • One participant inquires about the existence of the ^ operator for exponentiation in Turbo Pascal.
  • Another participant suggests that the information can be easily found online, providing a link to a resource.
  • A third participant acknowledges the lack of an exponentiation operator in Pascal and proposes using the built-in exp() and ln() functions to achieve exponentiation through the expression exp(y*LN(x)).

Areas of Agreement / Disagreement

There is no consensus on the existence of the ^ operator, as one participant claims it does not exist while another points to online resources for clarification. The discussion remains unresolved regarding the best method for exponentiation in Turbo Pascal.

Contextual Notes

Some assumptions about the availability of certain functions in Turbo Pascal may not be explicitly stated, and the discussion does not clarify the limitations or specific contexts in which these methods apply.

The Grimmus
Messages
199
Reaction score
0
I'm doing a projext for school and I need to know how to use the ^ operator or if it even exists i looked everywhere and couldent find it.
 
Computer science news on Phys.org
thanks
 
Pascal, IIRC, doesn't have an exponentiation operator, but it does have built-in exp() and ln() functions, which can be composed as:

exp(y*LN(x))

which is the same as xy.

- Warren
 

Similar threads

  • · Replies 13 ·
Replies
13
Views
3K
Replies
2
Views
4K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
2
Views
4K
  • · Replies 4 ·
Replies
4
Views
9K
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 15 ·
Replies
15
Views
3K
Replies
3
Views
3K