-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
49 lines (42 loc) · 1001 Bytes
/
main.cpp
File metadata and controls
49 lines (42 loc) · 1001 Bytes
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 <cstdio>
#include <cmath>
#include <cstdint>
#include <iostream>
#include "fixed.h"
int main()
{
fixed f1(0.8);
while(f1 < 1.2)
{
f1 += 0.001;
std::cout << f1.toString(1) << " " << f1.toFloat() << std::endl;
}
/*
fixed f12 = (1 + f1 * 2);
f12 = (f12 * -4.1) + "20.5";
f12++;
f12 -= fixed(7);
std::cout << std::setprecision(8) << f12 << std::endl;
if(f1 > 12)
{
std::cout << std::setprecision(8) << f1 << " больше" << f12 << std::endl;
}
fixed f2(731.4f);
std::cout << std::setprecision(8) << f2 << std::endl;
fixed f3(-160.0314f);
std::cout << std::setprecision(8) << f3 << std::endl;
fixed f5(-0.25f);
std::cout << std::setprecision(8) << f5 << std::endl;
try
{
fixed f4(1.1f); // ??
std::cout << std::setprecision(8) << f4 << std::endl;
std::cout << std::setprecision(8) << fixed::fromString("-23l.5") << std::endl;
}
catch(std::string ex)
{
std::cout << ex << std::endl;
}
*/
return 0;
}