Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,22 @@ Tests are located in `demo/` and can be built in two flavors.
* `make test` creates a test binary that is intended to be run against `mtest`. `mtest` can be built with `make mtest` and test execution is done like `./mtest/mtest | ./test`. `mtest` is creating test vectors using an alternative MPI library and `test` is consuming these vectors to verify correct behavior of ltm
* `make test_standalone` creates a stand-alone test binary that executes several test routines.

[Valgrind](http://valgrind.org/) does not support `long double` but does not reset the limits in `float.h` accordingly. Please build `demo.c` with the additional compiler flag `-DLTM_MEMCHECK_VALGRIND`, e.g.:
[Valgrind](http://valgrind.org/) does not support `long double` but does not reset the limits in `float.h` accordingly.
Please build `test.c` with the additional compiler flag `-DLTM_MEMCHECK_VALGRIND`, e.g.:

`CFLAGS=" -DLTM_MEMCHECK_VALGRIND " make test_standalone`
```
CFLAGS=" -DLTM_MEMCHECK_VALGRIND " make test_standalone
````

It will skip the tests for `long double` and prints a reminder to compile and run the tests without that flag to assure numerical correctness.

In case your platform doesn't provide Valgrind at all and the auto-detection fails, please build `test.c` with the additional compiler flag `-DLTM_NO_VALGRIND`, e.g.:

```
CFLAGS=" -DLTM_NO_VALGRIND " make test_standalone
````


## Building and Installing

Building is straightforward for GNU Linux only, the section "Building LibTomMath" in the documentation in `doc/bn.pdf` has the details.
2 changes: 1 addition & 1 deletion bn_mp_set_long_double.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ int mp_set_long_double(mp_int *a, long double b)
double _b = (double) b;
return mp_set_double(a, _b);
}
/*
/*
The "long double" on a Sparc64 is either a quad-precision float with LDBL_MANT_DIG = 113
and LDBL_MAX_EXP = 16384, although in software only.
*/
Expand Down
8 changes: 4 additions & 4 deletions demo/main.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "shared.h"

int mtest_opponent(void);
int unit_tests(void);
int unit_tests(int argc, char **argv);

void ndraw(mp_int* a, const char* name)
void ndraw(mp_int *a, const char *name)
{
char *buf;
int size;
Expand All @@ -24,7 +24,7 @@ void ndraw(mp_int* a, const char* name)
free(buf);
}

int main(void)
int main(int argc, char **argv)
{
srand(LTM_DEMO_RAND_SEED);

Expand All @@ -48,7 +48,7 @@ int main(void)
if (LTM_DEMO_TEST_VS_MTEST) {
return mtest_opponent();
}
return unit_tests();
return unit_tests(argc, argv);
}

/* ref: $Format:%D$ */
Expand Down
2 changes: 1 addition & 1 deletion demo/opponent.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ int mtest_opponent(void)
printf("\n");
return 0;

LBL_ERR:
LBL_ERR:
mp_clear_multi(&a, &b, &c, &d, &e, &f, NULL);
printf("\n");
return EXIT_FAILURE;
Expand Down
Loading