-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFixedPoint.h
More file actions
executable file
·61 lines (39 loc) · 1.53 KB
/
FixedPoint.h
File metadata and controls
executable file
·61 lines (39 loc) · 1.53 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
/*******************************************************************************************
/* cette version traite le fixed point avec les parametre MontiBit,ExpoBit
/* et represente le nombre de dit avant et apre la vergule
/* realiser par n38
/*
/*
/*
/*******************************************************************************************/
#ifndef FixedPoint_included
#define FixedPoint_included
#include <stdlib.h>
#include <stdio.h>
#define TypeBufferResst 1//0 on retresser avant de multiplier
// 1.2122 *1.7899 -> 1.21 *1.78 4chiffre apre ,
//1 on supose que le buffer resulat est asser long
//on fait la * puis on retreser
#define degMode 0 // 1 affiche le debogage
// 2 faire une pousse getchar() si le resulta est D > DelateRRO
#define DelateRRO 0.01 //test valeur
class FixedPoint{
public:
static int MontiBit , ExpoBit ;
float fSource;
long NSource;
char bitSig;
float getFolat();
long exp2(char i);
FixedPoint(float source=0.0);
FixedPoint(long NNSource,char NbitSig):NSource(NNSource),bitSig(NbitSig)
{fSource=getFolat();};
void showPropBin();
FixedPoint operator+ (FixedPoint f1);
FixedPoint operator- (FixedPoint f1);
FixedPoint operator* (FixedPoint f1);
operator float(){return getFolat();};
int operator< (FixedPoint f1){return (this->getFolat() <f1.getFolat());};
int operator> (FixedPoint f1){return (this->getFolat() >f1.getFolat());};
};
#endif