Go to Home Go to Forum

Online 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!

jeff Calc 84

05:51:52am



So far the new site is stable and running... Nice work!

Sumde

07:21:48pm



Alright, t2oboard.org is up! Feel free to go on t2oboard.org and make an account! I'll make a post about this.

Sumde

07:21:17pm



Unfortunately not :(

jeff Calc 84

06:29:04pm



Is IRC linked to the new site :P ?

jeff Calc 84

06:21:26pm



:) nice

Sumde

09:39:12am



It is up right now, but I wouldn't recommend registering a new account because it's still in development!

Sumde

07:18:47am



Yeah well in a couple of days T2Oboard.org will be set up so I wouldn't even bother.

Jeff Calc 84

01:00:59am



Uhh, looking good :) just that the links on the top of the page ("Go to Home" and "Go to Fourm") aren't very obvious at first glance. maybe remake them into icons?

Sumde

06:14:34am



Yep! https://sumde2.com/T2Oboard/viewThread.php?post_id=10

jeff Calc 84

12:20:29am



Hmm, seems like sumde changed the background...

[IRC] sumde2

08:23:57am



Bye! Have a nice break!

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!