-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFLOAT.C
executable file
·52 lines (38 loc) · 980 Bytes
/
FLOAT.C
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
#include "gcomm.h"
#include "majorbbs.h"
#include "mbbsemu.h"
#include "submod.h"
static int floatInputHandler() {
return 1;
}
double addDoubles(double x, double y) {
return x + y;
}
float addFloats(float x, float y) {
return x + y;
}
float subtractFloats(float x, float y) {
return x - y;
}
float multiplyFloats(float x, float y) {
return x * y;
}
float divideFloats(float x, float y) {
return x / y;
}
static int floatEntryHandler() {
char buf1[16];
char buf2[16];
sprintf(buf1, "%f", addFloats(1.5f, 2.2f));
sprintf(buf2, "%lf", addDoubles(1.5, 2.2));
prfmsg(FLTOUT, buf1, buf2);
outprf(usrnum);
return popSubModule();
}
void initFloatSubModule() {
SubModule subModule;
memset(&subModule, 0, sizeof(subModule));
subModule.onEnter = floatEntryHandler;
subModule.onInput = floatInputHandler;
registerSubModule(SUBMODULE_FLOAT, &subModule);
};