• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 // Copyright (C) 2008-2018 Lorenzo Caminiti
3 // Distributed under the Boost Software License, Version 1.0 (see accompanying
4 // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
5 // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html
6 
7 //[n1962_sqrt_d
8 // Extra spaces, newlines, etc. for visual alignment with this library code.
9 
10 
11 
lsqrt(long x)12 long lsqrt(long x)
13 in {
14     assert(x >= 0);
15 }
out(result)16 out(result) {
17     assert(result * result <= x);
18     assert((result + 1) * (result + 1) > x);
19 }
20 do {
21     return cast(long)std.math.sqrt(cast(real)x);
22 }
23 
24 
25 
26 
27 
28 
29 
30 
31 // End.
32 //]
33 
34