Skip to content

Commit cd5b7ed

Browse files
Update README.md
1 parent bcff6c6 commit cd5b7ed

File tree

1 file changed

+32
-52
lines changed

1 file changed

+32
-52
lines changed

README.md

Lines changed: 32 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,45 @@
1-
# DeepMath
2-
DeepMath is a lightweight Arduino library by "Hfiz Amanudeen pallimukku"for performing high-precision decimal and large number arithmetic operations without using floating point types (float or double) or external libraries like sprintf, string, or stringstream.
1+
# 📐 DeepMath - High Precision Math for Arduino
32

4-
This library is designed for use in memory-limited microcontrollers (such as ESP32-Wroom,ATmega328, ESP32-CAM, etc.) where standard math functions are not reliable for large or precise decimal operations.
3+
**DeepMath** is a lightweight and dependency-free Arduino library by **Hafiz Amanudeen Pallimukku** for performing **high-precision decimal** and **large-number arithmetic** operations without using `float`, `double`, or complex string-based libraries like `sprintf`, `string`, or `stringstream`.
54

6-
📘 Usage
7-
cpp
5+
> Designed especially for memory-constrained microcontrollers like **ESP32-WROOM**, **ESP32-CAM**, **ATmega328**, etc., where native floating point operations are not reliable or precise for large values.
86
9-
#include <DeepMath.h>
10-
11-
void setup() {
12-
Serial.begin(9600);
13-
14-
long long num = 1234567890123456789LL;
15-
16-
// Convert large number to string
17-
String re
187
---
198

209
## ✨ Features
2110

22-
- Pure logic-based implementation
23-
- Works with very large integers (`long long`, `unsigned long long`)
24-
- Supports:
25-
- Integer to String conversion (up to 20 digits)
26-
- Decimal point insertion without float
27-
- Manual power, division, and addition logic
28-
- Minimal dependencies (`Arduino.h` and `math.h` only)
29-
- No dynamic memory allocation (`malloc`, `new`, etc.)
11+
- Pure logic-based implementation (no floating point math)
12+
- 🔢 Works with very large integers (`long long`, `unsigned long long`)
13+
- 🔧 Manual implementations of:
14+
- Integer-to-string and string-to-integer conversion
15+
- Decimal point handling
16+
- Power, division, addition logic
17+
- 🪶 Minimal dependencies (`Arduino.h`, `math.h`)
18+
- 🚫 No dynamic memory (`malloc`, `new`, etc.)
3019

3120
---
3221

3322
## 🔧 Installation
3423

35-
### Method 1: Manually
24+
### 🔹 Method 1: Manual
3625

37-
1. Download or clone this repository:
38-
2. Move the folder into your Arduino libraries directory:
26+
1. Download or clone this repository.
27+
2. Move the folder into your Arduino `libraries` directory.
3928

40-
### Method 2: Zip Import
29+
### 🔹 Method 2: ZIP Import
4130

42-
1. Go to Arduino IDE → Sketch → Include Library → Add .ZIP Library.
43-
2. Select the zipped DeepMath folder.
31+
1. Open **Arduino IDE****Sketch****Include Library****Add .ZIP Library**.
32+
2. Select the zipped **DeepMath** folder.
4433

4534
---
4635

47-
## 📘 Usage
36+
## 📘 Basic Usage
4837

4938
```cpp
5039
#include <DeepMath.h>
40+
5141
DeepMath math;
42+
5243
void setup() {
5344
Serial.begin(9600);
5445

@@ -61,30 +52,19 @@ void setup() {
6152
// Convert string to large number
6253
Serial.println(math.StoL(result));
6354

64-
// Get total number of digits (including decimals)
65-
Serial.println(math.AnalyseStr("34.567", 'T')); // Output: 6
66-
67-
// Remove decimal point and return pure number
68-
Serial.println(math.AnalyseStr("123.4567", '0')); // Output: 1234567
69-
70-
// Get number of digits before the decimal point
71-
Serial.println(math.AnalyseStr("123.4567", 'F')); // Output: 3
72-
73-
// Get only the integer part (truncate decimal)
74-
Serial.print("Integer part of 1234.567: ");
75-
Serial.println(math.AnalyseStr("1234.567", '#')); // Output: 1234
76-
77-
// Arithmetic operations on large decimal values
78-
Serial.println(math.CALC("35.74537", '*', "1.223538",0)); // Multiplication
79-
Serial.println(math.CALC("36.56776878", '/', "12.234567",5)); // Division
80-
Serial.println(math.CALC("43.23849487", '+', "6.832734",0)); // Addition
81-
Serial.println(math.CALC("68.323327", '-', "43.2367237",0)); // Subtraction
55+
// Analyse string representations
56+
Serial.println(math.AnalyseStr("34.567", 'T')); // Total digits: 6
57+
Serial.println(math.AnalyseStr("123.4567", '0')); // Remove decimal: 1234567
58+
Serial.println(math.AnalyseStr("123.4567", 'F')); // Digits before decimal: 3
59+
Serial.println(math.AnalyseStr("1234.567", '#')); // Integer part: 1234
60+
61+
// Arithmetic operations (without float!)
62+
Serial.println(math.CALC("35.74537", '*', "1.223538", 0)); // Multiplication
63+
Serial.println(math.CALC("36.56776878", '/', "12.234567", 5)); // Division (precision = 5 digits)
64+
Serial.println(math.CALC("43.23849487", '+', "6.832734", 0)); // Addition
65+
Serial.println(math.CALC("68.323327", '-', "43.2367237", 0)); // Subtraction
8266
}
8367

8468
void loop() {
85-
// Your code here
69+
// Optional: continuous tasks
8670
}
87-
88-
89-
90-

0 commit comments

Comments
 (0)