lgmp
parent
b81dc33d74
commit
2c8609c99e
|
@ -38,7 +38,7 @@ TODO(for now):
|
|||
|
||||
Depencies -
|
||||
Debian 10:
|
||||
sudo apt install lua-sql-postgres-dev automake gcc libjansson-dev libcurl4-gnutls-dev libiniparser-dev libssl-dev libgd-dev libpng-dev libz3-dev libfreetype6-dev libluajit-5.1-dev liblua5.1-dev
|
||||
sudo apt install lua-sql-postgres-dev automake gcc libjansson-dev libcurl4-gnutls-dev libiniparser-dev libssl-dev libgd-dev libpng-dev libz3-dev libfreetype6-dev libluajit-5.1-dev liblua5.1-dev libgmp-dev
|
||||
Ubuntu(focal):
|
||||
sudo apt-get install -y devscripts build-essential lintian dh-make autoconf lua-sql-postgres-dev automake gcc libjansson-dev libcurl4-gnutls-dev libiniparser-dev libssl-dev libgd-dev libpng-dev libz3-dev libfreetype6-dev liblua5.1-dev libluajit-5.1-dev
|
||||
sudo apt-get install -y devscripts build-essential lintian dh-make autoconf lua-sql-postgres-dev automake gcc libjansson-dev libcurl4-gnutls-dev libiniparser-dev libssl-dev libgd-dev libpng-dev libz3-dev libfreetype6-dev liblua5.1-dev libluajit-5.1-dev libgmp-dev
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
### Debian 10
|
||||
|
||||
`sudo apt install lua-sql-postgres-dev automake gcc liblua5.1-dev libluajit-5.1-dev libjansson-dev libcurl4-gnutls-dev libiniparser-dev libssl-dev libgd-dev libpng-dev libz3-dev libfreetype6-dev`
|
||||
`sudo apt install lua-sql-postgres-dev automake gcc liblua5.1-dev libluajit-5.1-dev libjansson-dev libcurl4-gnutls-dev libiniparser-dev libssl-dev libgd-dev libpng-dev libz3-dev libfreetype6-dev libgmp-dev`
|
||||
|
||||
### Ubuntu Focal
|
||||
`sudo apt-get install -y devscripts build-essential lintian dh-make autoconf lua-sql-postgres-dev automake gcc libjansson-dev libcurl4-gnutls-dev libiniparser-dev libssl-dev libgd-dev libpng-dev libz3-dev libfreetype6-dev liblua5.1-dev libluajit-5.1-dev`
|
||||
`sudo apt-get install -y devscripts build-essential lintian dh-make autoconf lua-sql-postgres-dev automake gcc libjansson-dev libcurl4-gnutls-dev libiniparser-dev libssl-dev libgd-dev libpng-dev libz3-dev libfreetype6-dev liblua5.1-dev libluajit-5.1-dev libgmp-dev`
|
||||
|
|
|
@ -22,6 +22,7 @@ AC_CHECK_LIB([ssl], [main])
|
|||
AC_CHECK_LIB([crypto], [main])
|
||||
AC_CHECK_LIB([gd], [main])
|
||||
AC_CHECK_LIB([png], [main])
|
||||
AC_CHECK_LIB([gmp], [main])
|
||||
AC_CHECK_LIB([z], [main])
|
||||
AC_CHECK_LIB([freetype], [main])
|
||||
CFLAGS="$CFLAGS -g"
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
#include <stdio.h>
|
||||
#include <openssl/bn.h>
|
||||
|
||||
int main (int c, char **v)
|
||||
{
|
||||
if(c != 3) return fprintf(stderr, "%s first second\n", v[0]);
|
||||
//static const
|
||||
//char p_str[] = "82019154470699086128524248488673846867876336512717";
|
||||
|
||||
BIGNUM *first = BN_new();
|
||||
BIGNUM *second = BN_new();
|
||||
BIGNUM * rem = BN_new();
|
||||
BN_CTX* ctx = BN_CTX_new();
|
||||
BN_dec2bn(&first, v[1]);
|
||||
BN_dec2bn(&second, v[2]);
|
||||
BIGNUM * result = BN_new();
|
||||
// BN_mul(result, first,second, ctx);
|
||||
BN_div(result, rem, first, second,
|
||||
ctx);
|
||||
|
||||
char * number_str = BN_bn2dec(rem);
|
||||
printf("%s\n", number_str);
|
||||
|
||||
OPENSSL_free(number_str);
|
||||
BN_free(first);
|
||||
BN_free(second);
|
||||
BN_free(result);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#include<gmp.h>
|
||||
#include<stdio.h>
|
||||
int main(int cn, char**v){
|
||||
if(cn != 3) return fprintf(stderr,"%s a b\n",v[0]);
|
||||
mpf_t x, y, c;
|
||||
mpf_init (c);
|
||||
mpf_init (x); /* use default precision */
|
||||
mpf_init2 (y, 256); /* precision at least 256 bits */
|
||||
mpf_set_str(x, v[1], 10);
|
||||
mpf_set_str(y, v[2], 10);
|
||||
mpf_div(c, x,y);
|
||||
mpf_out_str(stdout, 10, 65535, c);
|
||||
puts("");
|
||||
/* Unless the program is about to exit, do ... */
|
||||
mpf_clear (x);
|
||||
mpf_clear (y);
|
||||
}
|
Loading…
Reference in New Issue