Add macros for percentage related units, with basis points defined as
1/100th of a percent. Basis points are commonly used in finance and
engineering to express small percentage changes with precision.
Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
---
v5 Changes:
* Included PERCENT macro along with BASIS_POINTS.
* Adjusted commit description and comment in the code to add more context and
examples.
v4 Changes:
* New patch.
---
include/linux/units.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/linux/units.h b/include/linux/units.h
index 00e15de33eca..9c2fbcf04c81 100644
--- a/include/linux/units.h
+++ b/include/linux/units.h
@@ -21,6 +21,20 @@
#define PICO 1000000000000ULL
#define FEMTO 1000000000000000ULL
+/*
+ * Percentage and basis point units
+ *
+ * Basis points are 1/100th of a percent (1/100), commonly used in finance,
+ * engineering or other applications that require precise percentage
+ * calculations.
+ *
+ * Examples:
+ * 100% = 10000 basis points = BASIS_POINTS
+ * 1% = 100 basis points = PERCENT
+ */
+#define PERCENT 100UL
+#define BASIS_POINTS 10000UL
+
#define NANOHZ_PER_HZ 1000000000UL
#define MICROHZ_PER_HZ 1000000UL
#define MILLIHZ_PER_HZ 1000UL
--
2.34.1