-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.dart
32 lines (22 loc) · 834 Bytes
/
main.dart
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
import ‘dart:math’;
// class to work with Euler’s value
class CalculateEuler{
// method to calculate ‘e’
void calculateEuler(){
// taking a specific constant named special_constant to calculate ‘e’
int special_constant = 99999991726;
// calculating ‘e’ without Math library’s assistance
num calculated_euler = pow((1 + (1/special_constant)),special_constant);
// displaying the calculated (approximate) ‘e’
print(“My Calculation: ” + calculated_euler.toString());
}
}
void main() {
// taking an instance of CalculateEuler class
CalculateEuler euler = CalculateEuler();
// calling the method on the instance
euler.calculateEuler();
// displaying the original value of ‘e’ from Dart’s Math library
print(“Actual e: ” + e.toString());
// print(exp(1)) displays the same value of ‘e’
}