yeah if values are large __gcd might fail thats why I use my own gcd function
why it fails?
You are mistaken, also misleading people without proper proof.
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int a = ((long long int)(1e18));
long long int b = ((long long int)(1e17));
cout << a << ' ' << b << endl;
cout << __gcd(a,b) << endl;
return 0;
}
This code prints the expected output. Inbuilt functions are designed to operate on maximum possible data types.
So, __gcd() works on Long Long int as well.
2 Likes
It’s a joke in 2021, Come on man. any trash shared before dosn’t mean working now