2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-12-01 22:16:27 +00:00
rules_foreign_cc/examples/configure_mpc/mpc_test.c
Justin King aeb5a4e35d
Support running autogen.sh and autoreconf (#403)
Co-authored-by: Justin King <jcking@google.com>
2020-06-08 19:01:21 +02:00

27 lines
559 B
C

#include "mpc.h"
#include <stdio.h>
int main(int argc, char** argv) {
mpc_t x;
mpc_t y;
mpc_t z;
mpc_init2(x, 64);
mpc_init2(y, 64);
mpc_init2(z, 64);
mpc_set_ui_ui(x, 2, 3, MPC_RNDNN);
mpc_set_ui_ui(y, 3, 2, MPC_RNDNN);
mpc_add(z, x, y, MPC_RNDNN);
mpc_out_str(stdout, 10, 0, x, MPC_RNDNN);
fprintf(stdout, " + ");
mpc_out_str(stdout, 10, 0, y, MPC_RNDNN);
fprintf(stdout, " = ");
mpc_out_str(stdout, 10, 0, z, MPC_RNDNN);
fprintf(stdout, "\n");
fflush(stdout);
mpc_clear(x);
mpc_clear(y);
mpc_clear(z);
return 0;
}