Bonjour à tous,
Je travaille avec la bibliothèque de multiprecision "boost".
Pas de problème pour calculer les sinus et cosinus avec cette bibliothèque .
Par contre, impossible de calculer les arcsinus et les arcosinus avec cette même bibliothèque.
Merci pour votre aide.
Marc75
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 #include <boost/multiprecision/cpp_dec_float.hpp> #include <boost/math/constants/constants.hpp> #include <iostream> #include <limits> #include <vector> #include <algorithm> #include <iomanip> #include <iterator> #include <fstream> #include <string> #include <stdio.h> #include <stdlib.h> #include <math.h> #include <sys/time.h> #include <unistd.h> using namespace std; // -------------------------------------------------------------------- int main() { using boost::multiprecision::cpp_dec_float_50; using boost::math::constants::pi; cpp_dec_float_50 p = pi<cpp_dec_float_50>(); int SET_PREC = 50; cpp_dec_float_50 R = cpp_dec_float_50("1.0"); cpp_dec_float_50 C = cpp_dec_float_50("3.0"); cpp_dec_float_50 angle = cpp_dec_float_50(R/C); cpp_dec_float_50 resu = cpp_dec_float_50(asin(angle*p/180)); std::cout << std::setprecision(SET_PREC) << std::fixed << std::showpos << resu << " " << std::endl; }
Partager