1 /* tradius -- test file for arithmetic of complex ball radii. 2 3 Copyright (C) 2022 INRIA 4 5 This file is part of GNU MPC. 6 7 GNU MPC is free software; you can redistribute it and/or modify it under 8 the terms of the GNU Lesser General Public License as published by the 9 Free Software Foundation; either version 3 of the License, or (at your 10 option) any later version. 11 12 GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY 13 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 more details. 16 17 You should have received a copy of the GNU Lesser General Public License 18 along with this program. If not, see http://www.gnu.org/licenses/ . 19 */ 20 21 #include "mpc-tests.h" 22 23 static int 24 test_sqrt (void) 25 { 26 int64_t n, N, s; 27 28 n = ((int64_t) 1) << 30; 29 /* The following commented line checks all possible inputs n to 30 sqrt_int64 in about 4 minutes on a laptop. */ 31 /* for (n = ((int64_t) 1) << 30; n < ((int64_t) 4) << 30; n++) */ 32 for (n = ((int64_t) 1) << 30; n < ((int64_t) 65) << 24; n++) 33 { 34 N = n << 30; 35 s = sqrt_int64 (n); 36 if (s * s < N || (s-1) * (s-1) >= N) { 37 printf ("n %" PRIi64 ", N %" PRIi64 ", s %" PRIi64 "\n", n, N, s); 38 return 1; 39 } 40 } 41 42 return 0; 43 } 44 45 46 int 47 main (void) 48 { 49 return test_sqrt (); 50 } 51 52