Go to Home Go to Forum
WARNING!!! This website will shutdown soon, please migrate to the newer forum, t2oboard.org

Online Chat


jeff Calc 84

09:17:58am



And the newer forum is slightly slower... just static vs. dynamic webpages

Sumde

07:42:43am



I'm suprised how this is still up

Sumde

07:42:34am



Erm

jeff Calc 84

07:49:07pm



At least there's more users on the new site than on the old site :)

jeff Calc 84

07:48:38pm



Really, this forum is STILL ONLINE?

urlocalceilingfan

12:59:32pm



*comeing

urlocalceilingfan

12:59:24pm



oh wow after soming over here after about 6 months... it looks a little broken, or unfinished. so weird feeling...

Sumde

08:29:38pm



🫨

Jeff Calc 84

09:27:55pm



last days of this website...

Sumde

04:32:34pm



It will be up soon hopefully

Sumde

04:32:23pm



Lol, I forgot about this chat

Jeff Calc 84

09:11:47am



Well, could be that the new site isn't entirely ready yet.

jeff Calc 84

06:00:47am



Final few days before shutdown... I really do hope that the chat features be implemented on the new site.

jeff Calc 84

11:10:09am



SUMDE'S MINECRAFT SERVER IS ON! server address: mc.sumde2.com Official and Cracked accounts are all welcome!

Jeff Calc 84

09:05:49am



fine, no bridge now. Hope the site will get transfered soon :D

jeff Calc 84

07:30:30am



https://t2oboard.org/viewtopic.php?t=9 :D text editor in Axe!

Sumde

08:54:15am



Yep!

jeff Calc 84

08:50:57am



New site expanded!

jeff Calc 84

06:48:33am



Ok, fine, that PM was a joke...

Sumde

06:05:10am



Thanks!

Logged Out!


Hello Guest!





Register for a new account!

Users Online


There are 0 users online! Users:

Giant Number Calc in C

Profile PictureSumde Post Created on: 2025-06-19 04:30:34pm
> 80 posts
> Domain Owner/Founder

Hi everyone! Today, I just finished my new number calculator in C! Instead of taking integers to perform arithmetic on, it instead uses strings! It has 5 main functions right now, setting, adding, subtracting, multiplying, and comparing. The code for this is below:
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> void giantNumberAdder(char* num1, char* num2) { int len1 = strlen(num1); int len2 = strlen(num2); int carry = 0; while (len1<len2) { memmove(num1+1,num1,len1+1); num1[0] = '0'; len1++; } while (len2<len1) { memmove(num2+1,num2,len2+1); num2[0] = '0'; len2++; } for (int i = len1-1; i>=0; i--) { int sum = (num1[i]-'0')+(num2[i]-'0')+carry; num1[i] = (sum%10)+'0'; carry = (sum/10); } if (carry) { memmove(num1+1,num1,len1+1); num1[0] = carry+'0'; } } void giantNumberSubtractor(char* num1, char* num2) { //breaks when num1 is lower than num2 :( int len1 = strlen(num1); int len2 = strlen(num2); int carry = 0; while (len1<len2) { memmove(num1+1,num1,len1+1); num1[0] = '0'; len1++; } while (len2<len1) { memmove(num2+1,num2,len2+1); num2[0] = '0'; len2++; } for (int i = len1-1; i>=0; i--) { int sum = (num1[i]-'0')-(num2[i]-'0')-carry; num1[i] = ((sum+10)%10)+'0'; carry = (sum+10)/10; carry = carry==1 ? 0 : 1; } for (int i = 0; i<len1; i++) { if (num1[0]=='0') { memmove(num1,num1+1,len1); len1--; } else { break; } } } void giantNumberMultiplier(char* num1, char* num2) { //alright alright, had to get extra help for this because this was probably the hardest to make. int* results = calloc(strlen(num1)+strlen(num2),sizeof(int)); for (int i = strlen(num2)-1; i>=0; i--) { int carry = 0; for (int j = strlen(num1)-1; j>=0; j--) { int sumPlace = i+j+1; int carPlace = i+j; int sum = (num2[i]-'0')*(num1[j]-'0')+carry; results[sumPlace] += sum; results[carPlace] += results[sumPlace]/10; results[sumPlace] %= 10; } } int i = 0; int k = 0; char temp[strlen(num1)+strlen(num2)-1]; while (k<strlen(num1)+strlen(num2) && results[k]==0) {k++;} if (k==strlen(num1)+strlen(num2)) {temp[i++];} else { for (; k<strlen(num1)+strlen(num2); k++) { temp[i++] = results[k] + '0'; } } temp[i] = '\0'; //null term cause important strcpy(num1,temp); free(results); } void giantNumberSetter(char* num1, char* num2) { //num1 is dest, num2 is src strcpy(num1,num2); } int giantNumberComparator(char* num1, char* num2) { //0 is equal, 1 is num1>num2, and 2 is num2>num1 int len1 = strlen(num1); int len2 = strlen(num2); while (len1<len2) { memmove(num1+1,num1,len1+1); num1[0] = '0'; len1++; } while (len2<len1) { memmove(num2+1,num2,len2+1); num2[0] = '0'; len2++; } for (int i = 0;i<len1;i++) { int digit1 = num1[i]-'0'; int digit2 = num2[i]-'0'; if (digit1 > digit2) { return 1; } if (digit1 < digit2) { return 2; } } for (int i = 0; i<len1; i++) { if (num1[0]=='0') { memmove(num1,num1+1,len1); len1--; } else { break; } } for (int i = 0; i<len2; i++) { if (num2[0]=='0') { memmove(num2,num2+1,len2); len2--; } else { break; } } return 0; }
Also note that when you use the function, strings are only allowed. It will also return a pointer being num1.
You must be logged in to reply to a post!