-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSI.c
41 lines (31 loc) · 867 Bytes
/
SI.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
// SI.c - Main source file
// Copyright (c) 2021-2024 Ercan Ersoy
// This file is written by Ercan Ersoy.
// This file is licensed under MIT License.
// Include header files
#include <math.h>
#include "SI.h"
// Convert lower function
SI_lower SI_convert_lower(long double size, SI_lower_prefix prefix)
{
// Declare the value
SI_lower value;
// Calculate the value and assign the size
value.size = size * pow(10, prefix);
// Assign the prefix
value.prefix = prefix;
// Return the value
return value;
}
// Convert upper function
SI_upper SI_convert_upper(long double size, SI_upper_prefix prefix)
{
// Define the value
SI_upper value;
// Calculate the value and assign the size
value.size = size / pow(10, prefix);
// Assign the prefix
value.prefix = prefix;
// Return the value
return value;
}