Solved

trigonometric functions

Posted on 2000-03-17
4
205 Views
Last Modified: 2010-04-02
Hello experts...

I need some help...
I need to do some trigonometric operations in my program...
I need to know how to do that...
I mean... Are there functions in C++ as to be Sin, Cos?...

Are they in runtime libraries?.... is there some win api to do that?.

Well... I need all posible help about this...

Thank you very much.
0
Comment
Question by:Marsc
4 Comments
 
LVL 1

Accepted Solution

by:
wildy earned 50 total points
ID: 2627209
they are in runtime lib: just include math.h and you get cos, sin, tan, ...
0
 
LVL 33

Expert Comment

by:hongjun
ID: 2630405
Just #include <math.h> and you will be able to use all pre-defined functions.

Open up math.h and you will find all the syntax of using them. You can also refer to any C or C++ text on how to use them.

hongjun
0
 
LVL 2

Expert Comment

by:VEngineer
ID: 2637918
actually, according to the new C++ standard, you should be including:
#include <cmath>
instead of #include <math.h>.  Either one will work now, but the first way is preferable.

once you include that file, you will have access to the following functions:

double sin(double x);
double cos(double x);
double tan(double x);
double asin(double x);
double acos(double x);
double atan(double x);
double pow(double base, double exponent);
double log(double x);

and there are more - you will need to look at the documentation

so usage is easy:  double result = sin(value);

let me know if you need anything else.
0
 
LVL 1

Author Comment

by:Marsc
ID: 2698093
Well...

I forgot to grade this answer before... I'm sorry about that.

VEngineer: I'm sorry for not accepting your answer, but I only can accept one, and wildy was first, and I applied what he told to me and worked just fine.
But I thank to you.
I will keep in mind what you say in my next program :-)

wildy... Thanks

0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now