[Question]
  [
The challenge is to implement a program or function (subsequently referred to as "program") that takes a nonnegative integer \$n\$ as input and returns \$n\over\sqrt{2}\$ (the input divided by the square root of two) as output, rounded to a nonnegative integer.
You may take your input and output in any reasonable format; for example stdin/stdout, files, or arguments/return values would all be acceptable.
You are required to use, at minimum, the largest fixed-size integer type offered by your language, and if an **unsigned** variant of this is available, you must use it. If your language has no built-in integer type (e.g. JavaScript) you are allowed to use its default numerical type (e.g. floating point); for languages with no concept of a number (e.g. regex), input and output can be e.g. the length of a string.
It is not required to reject negative integers; a submission that returns correct answers for negative inputs is allowed, but not required. Undefined behavior with negative inputs is allowed.
You are allowed and encouraged to use arbitrary-precision integer types if you so desire, but the type must either be a built-in, part of a standard library, or implemented from scratch in your program. As such, there are two categories of competition in this challenge:
1. Precision limited by built-in types (fixed-size integer, floating point, etc.)
2. Arbitrary precision (recursion and memory allocation, if used, can be assumed to be unlimited, where appropriate to the language in question)
Despite what the title might imply, you may use any rounding algorithm you want (floor, ceiling, nearest half up, nearest half even, arbitrary, or even random), as long as the difference between the integer returned value and the theoretical exact (irrational) value is always less than \$1\$ for all inputs that fit in your chosen integer type (but exactly 0 for an input of 0). All inputs up to the maximum representable value must return a correct output.
In a way, the job of this program is to calculate the irrational number \$\sqrt{2}\$ to the requested precision, presenting it in the form of an integer. This is why solutions using arbitrary-precision types are encouraged, but not required.
This is a [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") challenge. Standard loopholes are denied. The program with the least number of bytes wins. That said, this challenge is not only about which answer wins overall; it's also about seeing how concisely the challenge can be solved in each language, seeing how each language "prefers" to handle rounding, and how hard it is to solve in esoteric languages. And for those submissions that choose to use arbitrary precision, it's about seeing how concisely this can be done in the language.
# Test cases
Within the Precision-limited category, only the cases that are in range of the language's capability are required to pass.
If your solution is too slow to demonstrably pass the larger inputs (or runs out of memory/stack), it becomes all the more important to explain it sufficiently well, so that it can be understood that it would pass.
```
Input ‚Üí Floor or Ceiling
0 ‚Üí 0 (this is the only input that can only result in one valid output)
1 ‚Üí 0 or 1
2 ‚Üí 1 or 2
3 ‚Üí 2 or 3
4 ‚Üí 2 or 3
5 ‚Üí 3 or 4
10 ‚Üí 7 or 8
32 ‚Üí 22 or 23
500 ‚Üí 353 or 354
1000 ‚Üí 707 or 708
1000000 ‚Üí 707106 or 707107
186444716 ‚Üí 131836322 or 131836323
1000000000 ‚Üí 707106781 or 707106782
2147483647 ‚Üí 1518500249 or 1518500250
3037000499 ‚Üí 2147483647 or 2147483648
4294967295 ‚Üí 3037000499 or 3037000500
4503599627370496 ‚Üí 3184525836262886 or 3184525836262887
9223372036854775807 ‚Üí 6521908912666391105 or 6521908912666391106
18446744073709551615 ‚Üí 13043817825332782211 or 13043817825332782212
10000000000000000000000000000000000000 ‚Üí 7071067811865475244008443621048490392 or 7071067811865475244008443621048490393
956287480911872131784896176254337633353980911149964074434383 ‚Üí 676197362516585909969655173274459790030028262421622111830069 or 676197362516585909969655173274459790030028262421622111830070
```
  
[Answer]
# Regex (ECMAScript+`(?*)`), ~~1169~~ ~~929~~ ~~887~~ ~~853~~ ~~849~~ 708 bytes
*-141 bytes by using the second form of shortened division, where \$A^2 > C\$*
Regex was never designed to do mathematics. It has no concept of arithmetic. However, when input is taken in the form of [bijective unary](https://en.wikipedia.org/wiki/Unary_numeral_system), as a sequence of identical characters in which the length represents a natural number, it is possible to do a wide range of operations, building up from the simple primitives available, which basically amount to addition, comparison, multiplication by a constant, and modulo. Everything must fit inside the input; it isn't possible to directly operate on numbers larger than that.
In ECMAScript regex, it's especially difficult (and therefore interesting) to do even some of the simplest of operations, because of the limitation that all backrefs captured in a loop are reset to empty at the beginning of each iteration ‚Äì which makes it impossible to count anything directly. It's nevertheless possible to match prime numbers, powers of N, Nth powers, arbitrary multiplication and exponentiation, Fibonacci numbers, factorial numbers, abundant numbers, and more, much of which is demonstrated in my other answers.
One of the operations that turns out to be far more verbose than the rest is to "calculate an irrational number". I initially discussed this with teukon [back in 2014](https://gist.github.com/Davidebyzero/9735222#gistcomment-1209356). The only known way to do this is to *emulate* operations on numbers larger than the input, and probably the simplest way to do this is by working in a number base chosen based on what can fit into the input.
It wasn't until late 2018 that I finally set about to implementing the theory I had sketched in 2014. Implementing it involved adapting the multiplication algorithm to work with factors of 0, which turned out to golf rather elegantly. (The underlying multiplication algorithm is explained [in this post](https://codegolf.stackexchange.com/questions/179239/find-a-rocco-number/179420#179420).) The basic algorithm is this:
For input \$N\$, we want to calculate \$M=\lfloor{N\over\sqrt2}\rfloor\$. So we want the largest \$M\$ such that \$2M^2\le N^2\$.
If we take the "number base" to be \$k=\lceil\sqrt N\rceil\$ or \$\lfloor\sqrt N\rfloor\!+\!1\$, all multiplication operations \$m\cdot n\$ on \$0\leq m,n<k\$ are guaranteed to fit in the available space.
So if \$N=A k+B\$, where \$0\leq A,B\lt k\$, we can calculate \$N^2\$:
$$N^2=(A k+B)^2=A^2 k^2+2 A B k+B^2$$
We must then do division, modulo, and carry to bring \$A^2\$, \$2 A B\$, and \$B^2\$ back into the range of a base \$k\$ "digit". A similar operation is then done to calculate \$2 M^2\$ iterated over the decreasing consecutive possible values of \$M\$, using digit-by-digit comparison to test for \$2M^2\le N^2\$, until the first \$M\$ is found that passes the test.
So while the basic concept is simple enough, it adds up to a lot of calculations, and the regex is huge! And this is probably the *simplest* calculation of an irrational number that can be done in ECMAScript regex. (It is still unknown whether it's possible to calculate a transcendental number to arbitrary precision in regex.)
This regex uses **molecular lookahead**, a.k.a. non-atomic lookahead, represented as `(?*`...`)`. Without this feature, it would be much harder (or at least much more verbose) to implement.
A choice I made early on, to depart from pure code golf by going for mathematical aesthetics, turned out to be a very interesting. I chose to use \$k=\lceil\sqrt N\rceil\$ because it has the very neat property of making the calculations fit perfectly into \$N\$ if \$N\$ is a perfect square, whereas \$k=\lfloor\sqrt N\rfloor\!+\!1\$ is basically chaotic for all inputs. They both yield the same final outputs, but the former is just cleaner. A few golfs later, this choice ended up net increasing the total length of the regex by **8 bytes**, so I figured it was worth it. (This change is [in the git version history](https://github.com/Davidebyzero/RegexGolf/commit/b005d2f3713900212c0b2451c4912e3c2c1b605b).) But another golf later that day, unbeknownst to me, was actually dependent on that decision! The [skipping of a divisibility check in a division calculation](https://github.com/Davidebyzero/RegexGolf/commit/711a514cd6034ab099ce24870afbe82b09ea9c2a) makes \$N=25\$ return the incorrect output of \$M=11\$ instead of \$M=17\$ if \$k=\lfloor\sqrt N\rfloor\!+\!1\$, but works perfectly for all inputs if \$k=\lceil\sqrt N\rceil\$. So the *actual* net change in byte length was zero! It was a purely aesthetic decision for over two years.
At the time I did not understand why that division optimization worked, but [this is now fully explained thanks to H.PWiz](https://codegolf.stackexchange.com/questions/114003/division-and-remainder/222932#222932). The shortened form of division ~~used at the beginning of the calculation of \$M^2\$~~ gives the correct quotient \$B\$ when \$A+2 < 4B\$, where \$C\$ is the dividend and \$A\$ is the divisor. Previously I believed that it was only guaranteed to work when \$A \le B\$. [This is no longer used, due to the number base switch.]
And now, with the discovery of a second shortened form of division that gives the correct quotient when \$A^2 > C\$, I found a *major* opportunity to use it in this regex! It *only* works when \$k=\lfloor\sqrt N\rfloor\!+\!1\$, so now I've switched back to that number base. It's saving *141 bytes!* It's oddly convenient that this just happened to exist and works perfectly for this exact use.
`(?=(x(x*)).*(?=\1*$)\2+$)(?=(x\1)+(x?(x*)))(?=\4(x(x*?))\1+$)(?=.*(?=(?=\4*$)\4\5+$)(x*?)(?=\3*$)(x?(x*?))(\1+$|$\9))(?=.*(?=(?=\4*$)(?=\6*$)(?=\4\7+$)\6\5+$|$\4)(x*?)(?=\3*$)(x?(x*?))(\1+$|$\13))(?=.*(?=\12\12\9$)(x*?)(?=\3*$)(x?(x*?))(\1+$|$\17))(?*.*?(?=((?=\3*(x?(x*)))\21(x(x*?))\1+$)))(?=.*(?=\23*$)(\23\24+$))(?=.*(?=(?=\21*$)\21\22+$)(x*?)(?=\3*$)(x?(x*?))(\1+$|$\27))(?=.*(?=(?=\21*$)(?=\23*$)(?=\21\24+$)\23\22+$|$\21)(x*?)(?=\3*$)(x?(x*?))(\1+$|$\31))(?=.*(?=\30\30\27$)(x*?)(?=\3*$)(x?(x*?))(\1+$|$\35))(?=.*(?=\26\26)(?=\3*(x*))(\1(x)|))(?=.*(?=\34\34\40)(?=\3*(x*))(\1(x)|))(?=(?=(.*)\13\13\17(?=\6*$)\6\7+$)\44(x+|(?=.*(?!\16)\41|(?!.*(?!\38)\8).*(?=\16$)\41$))(\25\31\31\35){2}\43$)\20|xx?\B|`
[Try it on repl.it](https://repl.it/@Davidebyzero/regex-Shift-left-half-a-bit-ECMAScript)
This regex is [on GitHub](https://github.com/Davidebyzero/RegexGolf/blob/master/regex%20for%20dividing%20by%20sqrt2%2C%20with%20molecular%20lookahead.txt) with a [full version history](https://github.com/Davidebyzero/RegexGolf/commits/master/regex%20for%20dividing%20by%20sqrt2%2C%20with%20molecular%20lookahead.txt).
```
# Given an input number N in the domain ^x*$, this regex returns floor(N / sqrt(2))
(?=
    (x(x*))                    # \1 = will be the square root of the main number, rounded down; \2 = \1 - 1
    .*(?=\1*$)
    \2+$
)
# Step 1: Calculate N*N in base floor(sqrt(N))+1. Thanks to this choice of number base to work in, we'll be able to use the
# second shortened form of division in all places where the number base is the divisor, because it's guaranteed to give the
# correct quotient when the dividend is less than the squared divisor, and N itself is less than this. This form of division
# can be recognized by its lazy rather than greedy matching of the quotient, and only one divisibility test following that.
(?=(x\1)+(x?(x*)))             # \3 = \1+1 = floor(sqrt(N))+1, the number base to work in; \4 = N % \3; \5 = \4-1, or 0 if \4==0
(?=
    \4
    (x(x*?))                   # \6 = floor(N / \3); \7 = \6-1
    \1+$
)
(?=
    .*
    (?=
        (?=\4*$)               # tail = \4 * \4
        \4\5+$
    )
    (x*?)(?=\3*$)              # \8 =       (\4 * \4) % \3, the base-\3 digit in place 0 of the result for N*N
    (x?(x*?))                   # \9 = floor((\4 * \4) / \3); \10 = \9-1, or 0 if \9==0
    (
        \1+$
    |
        $\9                    # must make a special case for \9==0, because \1 is nonzero
    )
)
(?=
    .*
    (?=
        (?=\4*$)               # tail = \4 * \6; must do symmetric multiplication, because \4 is occasionally 1 larger than \6
        (?=\6*$)
        (?=\4\7+$)
           \6\5+$
    |
        $\4                    # must make a special case for \4==0, because \6 might not be 0
    )
    (x*?)(?=\3*$)              # \12 =       (\4 * \6) % \3
    (x?(x*?))                  # \13 = floor((\4 * \6) / \3); \14 = \13-1, or 0 if \13==0
    (
        \1+$
    |
        $\13                   # must make a special case for \13==0, because \1 is nonzero
    )
)
(?=
    .*(?=\12\12\9$)            # tail =       2 * \12 + \9
    (x*?)(?=\3*$)              # \16 =       (2 * \12 + \9) % \3, the base-\3 digit in place 1 of the result for N*N
    (x?(x*?))                  # \17 = floor((2 * \12 + \9) / \3); \18 = \17-1, or 0 if \17==0
    (
        \1+$
    |
        $\17                   # must make a special case for \17==0, because \1 is nonzero
    )
)                              # {\6*\6 + 2*\13 + \17} = the base-\3 digit in place 2 of the result for N*N, which is allowed to exceed \3 and will always do so;
                               # Note that it will be equal to N iff N is a perfect square, because of the choice of number base.
# Step 2: Find the largest M such that 2*M*M is not greater than N*N
# Step 2a: Calculate M*M in base \3
(?*
    .*?                        # Determine value of M with backtracking, starting with largest values first
    (?=
        (                      # \20 =       M
            (?=\3*(x?(x*)))\21 # \21 =       M % \3; \22 = \21-1, or 0 if \21==0
            (x(x*?))           # \23 = floor(M / \3); \24 = \23-1
            \1+$
        )
    )
)
(?=
    .*
    (?=\23*$)
    (\23\24+$)                 # \25 = \23 * \23
)
(?=
    .*
    (?=
        (?=\21*$)              # tail = \21 * \21
        \21\22+$
    )
    (x*?)(?=\3*$)              # \26 =       (\21 * \21) % \3, the base-\3 digit in place 0 of the result for M*M
    (x?(x*?))                  # \27 = floor((\21 * \21) / \3); \28 = \27-1, or 0 if \27==0
    (
        \1+$
    |
        $\27                   # must make a special case for \27==0, because \1 is nonzero
    )
)
(?=
    .*
    (?=
        (?=\21*$)              # tail = \21 * \23; must do symmetric multiplication, because \21 is occasionally 1 larger than \23
        (?=\23*$)
        (?=\21\24+$)
           \23\22+$
    |
        $\21                   # must make a special case for \21==0, because \23 might not be 0
    )
    (x*?)(?=\3*$)              # \30 =       (\21 * \23) % \3
    (x?(x*?))                  # \31 = floor((\21 * \23) / \3); \32 = \31-1, or 0 if \31==0
    (
        \1+$
    |
        $\31                   # must make a special case for \31==0, because \1 is nonzero
    )
)
(?=
    .*(?=\30\30\27$)           # tail =       2 * \30 + \27
    (x*?)(?=\3*$)              # \34 =       (2 * \30 + \27) % \3, the base-\3 digit in place 1 of the result for M*M
    (x?(x*?))                  # \35 = floor((2 * \30 + \27) / \3); \36 = \35-1, or 0 if \35==0
    (
        \1+$
    |
        $\35                   # must make a special case for \35==0, because \1 is nonzero
    )
)                              # {\25 + 2*\31 + \35} = the base-\3 digit in place 2 of the result for M*M, which is allowed to exceed \3 and will always do so
# Step 2b: Calculate 2*M*M in base \3
(?=
    .*
    (?=\26\26)                 # tail =       2*\26
    (?=\3*(x*))                # \38 =       (2*\26) % \3, the base-\3 digit in place 0 of the result for 2*M*M
    (\1(x)|)                   # \40 = floor((2*\26) / \3) == +1 carry if {2*\26} does not fit in a base \3 digit
)
(?=
    .*
    (?=\34\34\40)              # tail =       2*\34 + \40
    (?=\3*(x*))                # \41 =       (2*\34 + \40) % \3, the base-\3 digit in place 1 of the result for 2*M*M
    (\1(x)|)                   # \43 = floor((2*\34 + \40) / \3) == +1 carry if {2*\34 + \40} does not fit in a base \3 digit
)                              # 2*(\25 + 2*\31 + \35) + \43 = the base-\3 digit in place 2 of the result for 2*M*M, which is allowed to exceed \3 and will always do so
# Step 2c: Require that 2*M*M <= N*N
(?=
    (?=
        (.*)                   # \44
        \13\13\17
        (?=\6*$)               # tail = \6 * \6
        \6\7+$
    )
    \44                        # tail = {\6*\6 + 2*\13 + \17}; we can do this unconditionally because our digits in place 2 are always greater than those in places 0..1
    (
        x+
    |
        (?=
            .*(?!\16)\41       # \41 < \16
        |
            (?!.*(?!\38)\8)    # \38 <= \8
            .*(?=\16$)\41$     # \41 == \16
        )
    )
    (\25\31\31\35){2}\43$      # 2*(\25 + 2*\31 + \35) + \43
)
\20
|xx?\B|                        # handle inputs in the domain ^x{0,4}$
```
---
# Regex (ECMAScript 2018), ~~861~~ 720 bytes
This is a direct port of the ~~849~~ 708 byte molecular lookahead version, using variable length lookbehind.
`(?=(x(x*)).*(?=\1*$)\2+$)(?=(x\1)+(x?(x*)))(?=\4(x(x*?))\1+$)(?=.*(?=(?=\4*$)\4\5+$)(x*?)(?=\3*$)(x?(x*?))(\1+$|$\9))(?=.*(?=(?=\4*$)(?=\6*$)(?=\4\7+$)\6\5+$|$\4)(x*?)(?=\3*$)(x?(x*?))(\1+$|$\13))(?=.*(?=\12\12\9$)(x*?)(?=\3*$)(x?(x*?))(\1+$|$\17))(?=.*?(?=((?=\3*(x?(x*)))\21(x(x*?))\1+$))(?<=(?=(?=.*(?=\23*$)(\23\24+$))(?=.*(?=(?=\21*$)\21\22+$)(x*?)(?=\3*$)(x?(x*?))(\1+$|$\27))(?=.*(?=(?=\21*$)(?=\23*$)(?=\21\24+$)\23\22+$|$\21)(x*?)(?=\3*$)(x?(x*?))(\1+$|$\31))(?=.*(?=\30\30\27$)(x*?)(?=\3*$)(x?(x*?))(\1+$|$\35))(?=.*(?=\26\26)(?=\3*(x*))(\1(x)|))(?=.*(?=\34\34\40)(?=\3*(x*))(\1(x)|))(?=(?=(.*)\13\13\17(?=\6*$)\6\7+$)\44(x+|(?=.*(?!\16)\41|(?!.*(?!\38)\8).*(?=\16$)\41$))(\25\31\31\35){2}\43$))^.*))\20|xx?\B|`
[Try it online!](https://tio.run/##hVTdbtowFL7vU1CEGpuUKHYCtKQh0qRe9KYX2@W8qRGY4Ck4mWPaSITbPcAecS/Cjh0ymNYJ6Ui2z/m@7/zYybf0Na0WSpR6JIslP1Q6VZovYz9S8UeePdYl@qSVkJmn0reXA0piVKN6iLE3hD0jwwFm1B1gG2AEu6hObNx4WGjBCcaMtBjLshFDDNnYuA3C@IKhOSQtAxlKM2D3@B@eWSfHNWRTkGATowTo8IIaCU5yjFBj95cqINMjJzE1tLA/XTJK/uoRkA9xW2ubhFpNWBgN2/ipGdqOjzBKL86BTt/hnhJYT5vC5qItiVxQDcjZPALfGJ1eKiUYn5HoBAx3UxlaFKpxc64bGgv9/6GMeUOYX2Bt2t0v3Kq93BCekdsc5a4ZmYCLwPm6PQd3mN1173Fi8MTMmdExtGdtjHd0z8IA3F8hEUzIb@o6YR@aw4tX5WLBEbkdwSgixb9vheLIUTxd5kJyB3sL2Gv@JDVXqxSgOyHLrZ6VqljwqvIqvRRyj71CIscybvN4vsvi3KvKXGjkjBwciRVCMs68nMtMr/GcNo2ontNnJOIyVZVRR9ln/wvGXYCfB@ScJGRmwlivVfHWf5KvaS6WPZXKjM96fTePVoVCkXiIeSRcF0PCTdyv@57iJZSPBPY2qV6skcJ4d/zIb27Oeii22ntTQkPvTELF3Y@ARO@ChOv0fv342XPcDZTd9RXt9/jgj4jvX9GxfzWGFfZ24/8G "JavaScript (Node.js) ‚Äì Try It Online")
This regex is [on GitHub](https://github.com/Davidebyzero/RegexGolf/blob/master/regex%20for%20dividing%20by%20sqrt2%2C%20with%20variable-length%20lookbehind.txt).
```
# Given an input number N in the domain ^x*$, this regex returns floor(N / sqrt(2))
(?=
    (x(x*))                    # \1 = will be the square root of the main number, rounded down; \2 = \1 - 1
    .*(?=\1*$)
    \2+$
)
# Step 1: Calculate N*N in base floor(sqrt(N))+1. Thanks to this choice of number base to work in, we'll be able to use the
# second shortened form of division in all places where the number base is the divisor, because it's guaranteed to give the
# correct quotient when the dividend is less than the squared divisor, and N itself is less than this. This form of division
# can be recognized by its lazy rather than greedy matching of the quotient, and only one divisibility test following that.
(?=(x\1)+(x?(x*)))             # \3 = \1+1 = floor(sqrt(N))+1, the number base to work in; \4 = N % \3; \5 = \4-1, or 0 if \4==0
(?=
    \4
    (x(x*?))                   # \6 = floor(N / \3); \7 = \6-1
    \1+$
)
(?=
    .*
    (?=
        (?=\4*$)               # tail = \4 * \4
        \4\5+$
    )
    (x*?)(?=\3*$)              # \8 =       (\4 * \4) % \3, the base-\3 digit in place 0 of the result for N*N
    (x?(x*?))                  # \9 = floor((\4 * \4) / \3); \10 = \9-1, or 0 if \9==0
    (
        \1+$
    |
        $\9                    # must make a special case for \9==0, because \1 is nonzero
    )
)
(?=
    .*
    (?=
        (?=\4*$)               # tail = \4 * \6; must do symmetric multiplication, because \4 is occasionally 1 larger than \6
        (?=\6*$)
        (?=\4\7+$)
           \6\5+$
    |
        $\4                    # must make a special case for \4==0, because \6 might not be 0
    )
    (x*?)(?=\3*$)              # \12 =       (\4 * \6) % \3
    (x?(x*?))                  # \13 = floor((\4 * \6) / \3); \14 = \13-1, or 0 if \13==0
    (
        \1+$
    |
        $\13                   # must make a special case for \13==0, because \1 is nonzero
    )
)
(?=
    .*(?=\12\12\9$)            # tail =       2 * \12 + \9
    (x*?)(?=\3*$)              # \16 =       (2 * \12 + \9) % \3, the base-\3 digit in place 1 of the result for N*N
    (x?(x*?))                  # \17 = floor((2 * \12 + \9) / \3); \18 = \17-1, or 0 if \17==0
    (
        \1+$
    |
        $\17                   # must make a special case for \17==0, because \1 is nonzero
    )
)                              # {\6*\6 + 2*\13 + \17} = the base-\3 digit in place 2 of the result for N*N, which is allowed to exceed \3 and will always do so;
                               # Note that it will be equal to N iff N is a perfect square, because of the choice of number base.
# Step 2: Find the largest M such that 2*M*M is not greater than N*N
# Step 2a: Calculate M*M in base \3
(?=
    .*?                            # Determine value of M with backtracking, starting with largest values first
    (?=
        (                          # \20 =       M
            (?=\3*(x?(x*)))\21     # \21 =       M % \3; \22 = \21-1, or 0 if \21==0
            (x(x*?))               # \23 = floor(M / \3); \24 = \23-1
            \1+$
        )
    )
    (?<=
        (?=
            (?=
                .*
                (?=\23*$)
                (\23\24+$)                 # \25 = \23 * \23
            )
            (?=
                .*
                (?=
                    (?=\21*$)              # tail = \21 * \21
                    \21\22+$
                )
                (x*?)(?=\3*$)              # \26 =       (\21 * \21) % \3, the base-\3 digit in place 0 of the result for M*M
                (x?(x*?))                  # \27 = floor((\21 * \21) / \3); \28 = \27-1, or 0 if \27==0
                (
                    \1+$
                |
                    $\27                   # must make a special case for \27==0, because \1 is nonzero
                )
            )
            (?=
                .*
                (?=
                    (?=\21*$)              # tail = \21 * \23; must do symmetric multiplication, because \21 is occasionally 1 larger than \23
                    (?=\23*$)
                    (?=\21\24+$)
                       \23\22+$
                |
                    $\21                   # must make a special case for \21==0, because \23 might not be 0
                )
                (x*?)(?=\3*$)              # \30 =       (\21 * \23) % \3
                (x?(x*?))                  # \31 = floor((\21 * \23) / \3); \32 = \31-1, or 0 if \31==0
                (
                    \1+$
                |
                    $\31                   # must make a special case for \31==0, because \1 is nonzero
                )
            )
            (?=
                .*(?=\30\30\27$)           # tail =       2 * \30 + \27
                (x*?)(?=\3*$)              # \34 =       (2 * \30 + \27) % \3, the base-\3 digit in place 1 of the result for M*M
                (x?(x*?))                  # \35 = floor((2 * \30 + \27) / \3); \36 = \35-1, or 0 if \35==0
                (
                    \1+$
                |
                    $\35                   # must make a special case for \35==0, because \1 is nonzero
                )
            )                              # {\25 + 2*\31 + \35} = the base-\3 digit in place 2 of the result for M*M, which is allowed to exceed \3 and will always do so
            # Step 2b: Calculate 2*M*M in base \3
            (?=
                .*
                (?=\26\26)                 # tail =       2*\26
                (?=\3*(x*))                # \38 =       (2*\26) % \3, the base-\3 digit in place 0 of the result for 2*M*M
                (\1(x)|)                   # \40 = floor((2*\26) / \3) == +1 carry if {2*\26} does not fit in a base \3 digit
            )
            (?=
                .*
                (?=\34\34\40)              # tail =       2*\34 + \40
                (?=\3*(x*))                # \41 =       (2*\34 + \40) % \3, the base-\3 digit in place 1 of the result for 2*M*M
                (\1(x)|)                   # \43 = floor((2*\34 + \40) / \3) == +1 carry if {2*\34 + \40} does not fit in a base \3 digit
            )                              # 2*(\25 + 2*\31 + \35) + \43 = the base-\3 digit in place 2 of the result for 2*M*M, which is allowed to exceed \3 and will always do so
            # Step 2c: Require that 2*M*M <= N*N
            (?=
                (?=
                    (.*)                   # \44
                    \13\13\17
                    (?=\6*$)               # tail = \6 * \6
                    \6\7+$
                )
                \44                        # tail = {\6*\6 + 2*\13 + \17}; we can do this unconditionally because our digits in place 2 are always greater than those in places 0..1
                (
                    x+
                |
                    (?=
                        .*(?!\16)\41       # \41 < \16
                    |
                        (?!.*(?!\38)\8)    # \38 <= \8
                        .*(?=\16$)\41$     # \41 == \16
                    )
                )
                (\25\31\31\35){2}\43$      # 2*(\25 + 2*\31 + \35) + \43
            )
        )
        ^.*
    )
)
\20
|xx?\B|                        # handle inputs in the domain ^x{0,4}$
```
---
# Regex (ECMAScript)
I have not yet ported this algorithm to basic ECMAScript. One way to do it would be to use \$k=\lceil\sqrt[\uproot{1}3]N\rceil\$ as the number base, and calculate:
$$N^2=(A k^2+B k+C)^2=A^2 k^4 + 2 A B k^3 + (2 A C + B^2)k^2 + 2 B C k + C^2$$
Another way would be to stick with \$k=\lceil\sqrt N\rceil\$, capture \$M\$ encoded into two or more backrefs, and emulate the existing calculations within the smaller available space. I'm not sure which way would be more concise. Either way, I expect the regex would roughly double in length.
[Answer]
# Python 3, ~~19~~ 17 bytes
A different python answer
```
lambda x:x//2**.5
```
*-2 bytes* thanks to @Mukundan
[try it online](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUaHCqkJf30hLS8/0f0FRZl6JRpqGoYGm5n8A)
[Answer]
# Scratch 3.0, ~~7~~ 5 blocks/~~62~~ 36 bytes
[![enter image description here](https://i.stack.imgur.com/xE8Ez.png)](https://i.stack.imgur.com/xE8Ez.png)
[Try it on~~line~~ Scratch!](https://scratch.mit.edu/projects/455881031/)
As SB Syntax:
```
define(n
say(round((n)/([sqrt v]of(2
```
It's always fun to usual visual languages! At least I have built-ins this time.
*-26 bytes thanks to @att*
[Answer]
## JavaScript (ES6), 12 bytes
```
i=>i/2**.5|0
```
Uses a binary or to truncate the result
[Try it online!](https://tio.run/##dc5JCoAgFAbgfSfJIHN4Dpu6S0SFIRkZrrq7rePp9oN/OOY0x@V219Mnm7cxu3Fyg@g6ql6Wl3DG4Ffqw95uLSOk@QtHIpBIJIBE4WY8JnG3YoVPrIJFtxoADNe1RCkkOBiwUoMhJH8)
[Answer]
# 8087 FPU machine code, 11 bytes
Unassembled listing:
```
D9 E8   FLD1                    ; load a 1 constant (need to make a 2)
D8 C0   FADD ST, ST(0)          ; ST = 1+1 = 2 
D9 FA   FSQRT                   ; ST = SQRT(2) 
DE F9   FDIVP ST(1), ST         ; ST = N / ST 
DF 1F   FISTP QWORD PTR [BX]    ; *BX = ROUND(ST)
C3      RET                     ; return to caller
```
Input in `ST0`, as a 80-bit extended precision value, output to `QWORD PTR [BX]`.
Floating point operations done in x87 math coprocessor hardware with 80-bit extended precision. Correctly calculates values of `N` up to `13043817825332782211`, after which the result will exceed \$2^{63}-1\$ (overflowing a 64-bit signed integer return variable).
Example test program with I/O:
[![enter image description here](https://i.stack.imgur.com/ygVz3.png)](https://i.stack.imgur.com/ygVz3.png)
(Test program now with 64 bit I/O routines thx to suggestions from @PeterCordes)
Thanks to @PeterCordes for the suggestion take input in `ST(0)`, saving 2 bytes.
[Answer]
# Java 8, 18 bytes
```
n->n/=Math.sqrt(2)
```
Limited to a maximum of \$9{,}223{,}372{,}036{,}854{,}775{,}807\$ (signed 64-bit integer).
[Try it online.](https://tio.run/##PZDBcoIwEIbvPsWOJxiRhiQkRMc@QfTi0fGQItpYDBainY7Ds9MFtJfd7Ld/9s/mbO5mfj58dXlpmgbWxrrHBMA6X9RHkxew6UuAsnInyIMhuXCJrJ1gaLzxNocNOFhB5@bv7m21Nv4zbr5rH9CwW/aq6@2jRNVTfK/sAS5oFGx9bd1ptwcTji7Hqh4tLCzAFT@D7W7/IDpKdER1xHTEdZRiiYghSEnfI684HjLBOZeJ@GcDpgmXPGOCS7xKmETIlcKBVHElJFU4lqeEpUoJKrGPVEeKUsYkJUxkKZcyzYjUbTi8FmD72/jiElc3H19xFV@6wM6mC5jOXJwHNnx@VNv9AQ)
**Explanation:**
```
n->                // Method with long as both parameter and return-type
  n/=              //  Divide the input by:
     Math.sqrt(2)  //   The square-root of 2
// The `/=` sets the divided result back to `n`, which implicitly casts the resulting double
// back to long. This saves bytes in comparison to `n->(long)(n/Math.sqrt(2))`
```
# Java 9, ~~76~~ 74 bytes
```
n->n.divide(n.valueOf(2).sqrt(new java.math.MathContext(n.precision())),4)
```
-2 bytes thanks to *@OlivierGr√©goire*.
Arbitrary I/O and precision.
[Try it online.](https://tio.run/##fVFNbxshEL3nV4z2BApBfAywNEoOaa9JDzlWOdD1OsFds84udltV@e3u2HHVqKrCYRCP4b3HvFXapYvV4tu@G9I8w23K5dcZQC61n5ap6@HucARYUZ9cp/okb/Ljp77L6zRAx/4LF35Jb17OqMw11dzBHRS4gn25uC5ykXd50bMid2nY9p@XzHA5P0@Vlf77G5lbKh9HsvGDbuRmIu45j4VxzgXy/eWBfbP9OhD7SWQ35gWs6QPsvk65PH55gMRf3S/H6QRChg/QKKGFEVagcEIrYY1wijB1Kse99YgYtP@DHECjMWBrPQZhlQ0EYYwCTcTog4lOoFPWxehNoFsCRTTG2mCU9a3DEFyrAlEj@oCoDk3ROe21e6Py3hLRedOSBxW1boPRVocW2@h18MYhSXlrrbPx2KDJnScZRIu2tY2cN0OurBEN58e5ANz/nGu/luO20owp9aGwfN7QiM6L7P6J5G/ELFMMryG/7H8D)
**Explanation:**
```
n->               // Method with BigDecimal as both parameter and return-type
  n.divide(       //  Divide the input by:
    n.valueOf(2)  //   Push a BigDecimal with value 2
     .sqrt(       //   Take the square-root of that
           new java.math.MathContext(n.precision())),
                  //   with the same precision as the input
    4)            //  With rounding mode HALF_UP
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 15 bytes
```
¬≥¬≤:2_¬≤:·∫∏¬°:2+¬µ∆¨·π™
```
[Try it online!](https://tio.run/##Hcq9DYNADAbQgWiwP59/WCZVGnQLME7aiAqElKS8InvcJAbRvOrNz1qXzLa3beLHRf992mvioR3/tX/fmRlF2U18DCI3JpC5eCiZchHAFEBB3IEkQmU0EQgcJw "Jelly ‚Äì Try It Online")
An arbitrary precision Jelly answer that uses the [Newton-Raphson](https://en.wikipedia.org/wiki/Newton's_method) method to find the correct answer. Uses only integer arithmetic operations so the intermediate values are all Python big ints rather than getting cast as floats which would lose precision. The integer result equates to the floor of what would be the floating point answer.
A full program that takes a (possibly negative) integer as its argument and returns an integer. 
Now correctly handles inputs of 0 and 1; previously threw an error because of division of 0 by 0 being impermissible for integers.
Useful comment from @PeterCordes about efficiency of this method and some detail on Python‚Äôs big integer implementation:
> 
> Newton-Raphson converges quickly, like twice as many correct bits per iteration, given a decent first estimate. e.g. [one step refines a 12-bit-precision rsqrtps(x) FP result into nearly 24-bit.](https://stackoverflow.com/q/14752399) (In this case apparently the original input is close enough). You only pay Python interpreter overhead per operation, not per limb (aka chunk) of a very long number; extended-precision division is not cheap but it is implemented in C on chunks of 2^30 stored in an array of 32-bit integers. (I forget if Python uses 64-bit on 64-bit machines.)
> 
> 
> 
## Explanation
```
            ¬µ∆¨   | Do the following as a monad until no new values seen, collecting up the intermediate values:
¬≥                | - Original argument to program
 ¬≤               | - Squared
  :2             | - Integer divide by 2
    _¬≤           | - Subtract current estimate squared
      ·∫∏¬°         | - If non-zero:
        :        |   - Integer divide by current estimate
         :2      | - Integer divide by 2
           +     | - Add to current estimate
              ·π™  | Finally, take the tail of the list of estimates
```
Note `·∫∏¬°` is literally repeat the number of times indicated by applying the any function to current value, but it is effectively used here to mean if non-zero. 
A much shorter answer that is only accurate to float precision is:
# [Jelly](https://github.com/DennisMitchell/jelly), 4 bytes
```
2¬Ω:@
```
[Try it online!](https://tio.run/##y0rNyan8/9/o0F4rh////xsaGZsAAA "Jelly ‚Äì Try It Online")
[Answer]
# Regex (.NET), ~~106~~ 90 bytes
`(?=(x*)(\1x?))(x*).*$(?<=(?=(?<-5>x)*\1(?<=\3))^\2((?<=(?=\6?(\3)*(?<=(?=\3$)(x*))).*)x)*)`
[Try it online!](https://tio.run/##ZVJda9swFH3fr1BDwVJiC9uhe4iieBDGGLR0LIU9NB2ojpIIZMmR7MyNm9e@b2Nv@3X5I5lsJ2VQP92rcz/OOdepDVJt@FGxjNucpRzMnmzBs7q0Qq3AlE61slpy0uV3vCrwV74qJTMfq9xwa4UrIKlk1oKstgUrRAq2WizADRMKQFRvmQGWfugdYUJh1UdwHlUJQk2I@5cwGdMGSMbB1aRC/XnUvMyHCH2fx/CEzt8n0D31z@nwsm1HbgByPejYI80WQxX/ARw9XkGLZ@WjLYxjDSPf4muuVsU6iJHf4rd50RDHU53lQvIFIgtdPkoONjG9YcUazzamgPgKkW4GkGSpDRSqAIqGBEo6dT6wxbVQHCJ0QVUpJVE0QrVYQjUJ0RR/M6LgXUFLL6cSz3IpCugFHiLNLOFz8s415Cd@k/j5@cIB@M48fWHGcpjfhw@@Ll0pegud24Koq@HovBb2Pqstk@4MhqkVH4E63Pd8iQiXlrcnqVqzZp1DXuX5Ar1K3DmJYkw5EYOBXw2og1HtbEnXIKMGtxGsnIQlzJzPaer@g1b47o3wHY2cQjdT0wx/MrrM7f3w4cTbBxvaLERQ9DfuNGDzfz4IG//Bq6I63jcywOHlF6gjJ0f42teUbhLv8PLbGzXhIGqSn97IO/z940zed98xDOIw/Ac "C# (.NET Core) ‚Äì Try It Online")
Takes its input in unary, as a sequence of `x` characters whose length represents the number. Returns its output in group `\3`.
By the very nature of this solution, its best-golfed form rounds arbitrarily ‚Äì sometimes up, sometimes down. As such, it's more complicated to explain why it works, so I suggest reading the explanation of the **104 byte** always-round-down solution below first. (This is oddly appropriate, given the order of operations in regexes that use right-to-left evaluated variable-length lookbehind.)
Compared to the always-round-down solution, this regex takes a shortcut. Instead of counting the number of times the anti-remainder was subtracted, it uses \$\lfloor{N\over 2}\rfloor\$ in place of that count. For even values of \$N\$ this is \$1\$ greater than the actual number of times the anti-remainder was subtracted (since it's never subtracted on the first iteration, and always subtracted on each subsequent iteration). As such, sometimes it doesn't change the resulting returned value \$M\$, but sometimes it results in finding an \$M\$ that is \$1\$ greater than the value it would otherwise have, i.e. \$\lceil{N\over\sqrt 2}\rceil\$ instead of \$\lfloor{N\over\sqrt 2}\rfloor\$.
For odd values of \$N\$, adding \$1\$ to that count effectively simulates the extra loop iteration done on \$\lfloor{N\over 2}\rfloor\$ in the always-round-down regex. The thing is, without actually doing that, we don't know whether the final value of the anti-remainder was greater than \$\lfloor{N\over 2}\rfloor\$ or not. Iff it was greater, then the anti-remainder subtraction count wouldn't have been incremented by \$1\$. Thus, by unconditionally effectively adding that \$1\$, we're doing the same thing for odd \$N\$ as we are for even \$N\$ ‚Äì giving a return value of \$M\$ that is arbitrarily rounded up or down.
```
                # tail = N = input number
(?=
    (x*)        # \1 = floor(N / 2)
    (\1x?)      # \2 =  ceil(N / 2)
)
(x*)            # \3 = guessed value of round(sqrt(N*N/2)) - may be rounded up or down
.*$             # tail = 0; head = N
(?<=
                          # head = 0
    (?=
        (?<-5>x)*         # head += \5.capture_count
        \1                # head += \1; this is 1 more than the actual number of times
                          # \6 was subtracted, which will change the \3 result for some
                          # even values of N from rounded-down to rounded-up. But for
                          # odd values of N, it simulates subtracting \6 from the last
                          # half-chunk, which is not covered in the loop we did. Note
                          # that depending on the final value of \6, it may be <= \1,
                          # in which case we'll get a rounded-down \3, or > \1, in which
                          # case we'll get a rounded-up \3.
        (?<=\3)           # assert head ‚â• \3
    )
    ^\2                   # force the loop below to iterate \1 times; head = 0
    (
        (?<=
                          # tail = N
            (?=
                \6?       # tail -= \6, if \6 is set
                (\3)*     # X = floor(tail / \3); tail -= \3*X; \5.capture_count += X;
                          # note that in practice, 0 ‚â§ X ‚â§ 1;
                          # Y = tail = remainder
                (?<=
                    (?=\3$)   # assert tail == \3
                    (x*)      # \6 = \3 - Y
                )
            )
            .*            # tail = N
        )
        x                 # head -= 1; tail += 1
    )*
)
```
# Regex (.NET), ~~166~~ ~~104~~ 99 bytes
`(?=(x*)(\1x?))(x*).*$(?<=(?=(?<-5>x)*(?<=\3))^\1(x(?<=(?=(\6)?(?<5>\3)*(?<=(?=\3$)(x*)))(.+\2)?))*)`
[Try it online!](https://tio.run/##ZVLRatswFH3fV6ihYMmxhe2QPdRRPAhjDFo2lsIe6g5UR0kEsmxLcufGzWs/YGNv@7r8SCbbSRlUT/fqXJ17z7nKtJ8Vih0lzZkuacbA8kkblre15nIDFmRRSF0IFg/5LWsM/sY2taDqY1MqpjW3BXEmqNYgb7WhhmfgseArcEO5BBC1j1QBTT6MjjAhsHERTMMmQagLsXsJkxnpgGTmT@cNcrs8nSD0Iw1hcwbT9yix8XRuEfd0mU4uew7LhMdphCyli46juGuniGQ/gZ2TNVDjZf2gjbLjw9DT@JrJjdn6EfJ6/EtpOgV4UeQlF2yF4lVRPwgGqojcULPFy0oZiKcoHjiAiNeFglwaIEkQQ0EW1hC6uuaSQYQuiKyFiCUJUcvXUM4DtMDfFTdsKOjHK4nAy1JwAx3fQXHHxT0Wv7MPytN88@j5@cIC@FY9faVKM1jeBfdeUdtS9BY6P/PDoYahc1s4@iwfqbD7UFRu2BVog/3IEyhmQrN@N01v1nJwyGkcj6NXiTsrkc8Ii/l47DVjYmHUWluyLciJwn0EGythDXPrc5bZD9EL370RviOhVWg5C5LjT6qoS303uT/N7YGKdA0R5G5lVwOq//Nx0PkPXhW10b6TAQ4vv0AbWjncK7yCkCpxDi@/nSvn8PeP9XU/nGPgR0HwDw "C# (.NET Core) ‚Äì Try It Online")
Takes its input in unary, as a sequence of `x` characters whose length represents the number. Returns its output in group `\3`.
This solution always rounds down, returning \$M=\lfloor{N\over\sqrt 2}\rfloor\$. It accomplishes this by calculating \$M=\lfloor\sqrt{N^2\over 2}\rfloor\$, which is done by searching for the largest value of \$M\$ for which \$\lfloor{{N^2\over 2}/M}\rfloor\ge M\$. A regex can't directly operate on values larger than the input, so this must be done by looping multiple times over \$N\$ instead of directly operating on \$N^2\$.
For even values of \$N\$ this is straightforward enough; we just loop over \$N/2\$ copies of \$N\$, subtracting \$M\$ from it as many times as will fit (which will be \$0\$ or \$1\$), taking note of the remainder, and then subtracting the corresponding "anti-remainder" (the remainder's difference from \$M\$) at the beginning of the next loop iteration. Then the value of \$\lfloor{{N^2\over 2}/M}\rfloor\$ is the sum of the number of times \$M\$ was subtracted and the number of times the anti-remainder was subtracted. This works because for even \$N\$, we have \$\lfloor{N^2\over 2}\rfloor = \lfloor{N\over 2}\rfloor N\$.
For odd values of \$N\$, we do the above, but then do \$1\$ extra loop iteration, subtracting from \$\lfloor{N\over 2}\rfloor\$ instead of \$N\$. This works because for odd \$N\$, we have \$\lfloor{N^2\over 2}\rfloor = \lfloor{N\over 2}\rfloor N + \lfloor{N\over 2}\rfloor\$.
The number of times \$M\$ and the anti-remainder were subtracted are counted using the .NET feature of balanced groups, with `(?<-5>x)*` below.
```
                # tail = N = input number
(?=
    (x*)        # \1 = floor(N / 2)
    (\1x?)      # \2 =  ceil(N / 2)
)
(x*)            # \3 = guessed value of floor(sqrt(N*N/2))
.*$             # tail = 0; head = N
(?<=
                          # head = 0
    (?=
        (?<-5>x)*         # head += \5.capture_count
        (?<=\3)           # assert head ‚â• \3
    )
    ^\1                   # force the loop below to iterate \2 times; head = 0
    (
        x                 # head -= 1; tail += 1
        (?<=
                          # tail = \1 if N is odd and this is the last iteration, or N otherwise
            (?=
                (\6)?     # if \6 is set: tail -= \6; \5.capture_count += 1
                (?<5>\3)* # X = floor(tail / \3); tail -= \3*X; \5.capture_count += X;
                          # note that in practice, 0 ‚â§ X ‚â§ 1;
                          # Y = tail = remainder
                (?<=
                    (?=\3$)   # assert tail == \3
                    (x*)      # \6 = \3 - Y
                )
            )
            (.+\2)?       # unless N is odd and this is the last iteration: head = 0; tail = N;
                          # else: head = \2; tail = \1
        )
    )*
)
```
This algorithm would not work on a regex flavor lacking variable-length lookbehind (and lookinto), because to loop more than once with a count that scales with \$N\$, the regex needs to subtract at least \$1\$ from \$tail\$ on each iteration (a zero-width loop iteration would result in terminating the loop). Without lookbehind/lookinto, it would be impossible to operate directly on \$N\$ after the first iteration. And once the current value of \$tail\$ went below the currently tested value of \$M\$, it would no longer be possible to operate on the value of \$M\$ in any way. Thus forward-declared backreferences, while required by this algorithm, aren't enough on their own.
So, a regex flavor with forward-declared backreferences but no variable-length lookbehind (or lookinto) could probably use an algorithm based on this one, but additional tricks would have to be used to emulate operating on larger numbers. I'm pretty sure it would not have to use the full-fledged algorithm of my [ECMAScript solution](https://codegolf.stackexchange.com/a/198428/17216), but I haven't worked out the details yet.
# Regex (PCRE+`(?^=)`[RME](https://github.com/Davidebyzero/RegexMathEngine)), 81 bytes
```
(?=(x*)(\1x?))(x*)(?^1=(x(?^=\8?(\3(?^=(\6?x)))*(x*)(?^3=\7(x*))))*)(?^3!\6?+\1x)
```
[Try it on replit.com!](https://replit.com/@Davidebyzero/regex-Shift-left-half-a-bit-PCRE-round-any)
This is a port of the 90 byte .NET regex that rounds arbitrarily. It uses features available in PCRE, in addition to **lookinto**, a feature just added to [RegexMathEngine](https://github.com/Davidebyzero/RegexMathEngine/). The fact that even after converting the use of .NET balancing groups to group-building, this regex is still 9 bytes smaller than the .NET version, demonstrates just how much expressibility is available with lookinto. The regex is also much easier understand in this form. (Lookinto is equal in power to variable-length lookbehind, i.e. there's nothing one can do that the other can't.)
```
            # tail = N = input number
(?=
    (x*)    # \1 = floor(N / 2)
    (\1x?)  # \2 =  ceil(N / 2)
)
(x*)        # \3 = guess for round(sqrt(N*N/2)) - may be rounded up or down
(?^1=       # Lookinto: tail = \1
    (
        x          # tail -= 1
        (?^=       # Atomic lookinto: tail = N
            \8?        # tail -= \8, if \8 is set
            # X = floor(tail / \3); tail -= \3*X; \6 += X;
            # Note that in practice, 0 ‚â§ X ‚â§ 1
            (
                \3           # Assert tail ‚â• \3; tail -= \3
                (?^=
                    (        # \6 = sum of the following:
                        \6?  # previous value of \6 if set, 0 otherwise
                        x    # 1
                    )
                )
            )*         # Match the above as many times as possible, minimum 0
            (x*)       # \7 = tail = remainder = dividend % \3
            (?^3=      # Atomic lookinto: tail = \3
                \7     # tail -= \7
                (x*)   # \8 = tail = \3 - \7
            )
        )
    )*            # Iterate as many times as possible, which will be exactly \1
)
(?^3!       # Negative lookinto: tail = \3
    # Assert \3 ‚â§ \6 + \1 (outside the negative lookinto), by asserting here
    # that tail ‚â• \6 + \1 + 1.
    \6?+          # Take advantage of the fact that it is guaranteed \6 ‚â§ \3,
                  # meaning we don't have to use "(?(6)\6)".
    \1x
    # Note that \6 + \1 is 1 more than the actual number of times \8 was
    # subtracted, which will change the \3 result for some even values of N
    # from rounded-down to rounded-up. But for odd values of N, it simulates
    # subtracting \8 from the last half-chunk, which is not covered in the loop
    # we did. Note that depending on the final value of \8, it may be ‚â§ \1, in
    # which case we'll get a rounded-down \3, or > \1, in which case we'll get
    # a rounded-up \3.
)
```
# Regex (PCRE+`(?^=)`[RME](https://github.com/Davidebyzero/RegexMathEngine)), ~~123~~ ~~113~~ ~~96~~ 95 bytes
`(?=(x*)(\1x?))(x*)(?^=((?=(\2$|))x(?^=((?^=(\7?x))(^\10|\3))*\5(x*)(?^3=\9(x*))))*\1(?^7=\3)|$)`
[Try it on replit.com!](https://replit.com/@Davidebyzero/regex-Shift-left-half-a-bit-PCRE-round-down)
This is a port of the 99 byte .NET regex that rounds down.
```
               # tail = N = input number
(?=
    (x*)       # \1 = floor(N / 2)
    (\1x?)     # \2 =  ceil(N / 2)
)
(x*)           # \3 = guess for floor(sqrt(N*N/2))
(?^=           # Atomic lookinto: tail = N
    (
        (?=(\2$|)) # \5 = \2 if tail == \2, 0 otherwise;
                   # Note that if tail==\2, it means this is the last iteration
                   # if N is odd ‚Äì but if N is even, this iteration will fail to
                   # match, as the last iteration will have already finished.
        x          # tail -= 1
        (?^=       # Atomic lookinto: tail = N
            # if \10 is set: tail -= \10; \7 += 1;
            # X = floor((tail - \5) / \3); tail -= \3*X; \7 += X;
            # Note that in practice, 0 ‚â§ X ‚â§ 1
            (
                (?^=
                    (        # \7 = sum of the following:
                        \7?  # previous value of \7 if set, 0 otherwise
                        x    # 1
                    )
                )
                (
                    ^\10   # On the first iteration, if \10 is set, tail -= \10
                |
                    \3     # Assert tail ‚â• \3; tail -= \3
                )
            )*         # Match the above as many times as possible, minimum 0
            \5         # tail -= \5
            (x*)       # \9 = tail = remainder = dividend % \3
            (?^3=      # Atomic lookinto: tail = \3
                \9     # tail -= \9
                (x*)   # \10 = tail = \3 - \9
            )
        )
    )*
    \1          # Assert tail ‚â• \1, forcing the loop above to iterate \2 times
    (?^7=       # Lookinto: tail = \7
        \3      # Assert \3 ‚â§ tail, i.e. \3 ‚â§ \7
    )
|
    $       # or N == 0, in which case the output = the input; this needs to be
            # a special case because "(?^7=...)" cannot match if \7 is unset.
)
```
[Answer]
# [dc](https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html), 5 bytes
```
d*2/v
```
[Try it online!](https://tio.run/##HcrJEYAwDAPAfvgQWfJVDymAV9o3M@x79zPtYZWq1UClgchSdSDDXGQGSWf/AeoOrZQoFmdfdp955wM "dc ‚Äì Try It Online")
Takes input and leaves output on the stack.
dc automatically uses arbitrary-precision integers, and supports a precision of 0 decimal places by default, thus automatically "rounding". So taking the square-root of 2 will yield 1. Instead, this solution squares the input, by `d`uplicating it and `*` multiplying both the items at the top of the stack, `/` dividing it by `2` (reverse-polish) and takes the `v` square root of that.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 3 bytes
```
2t√∑
```
[Try it online!](https://tio.run/##yy9OTMpM/f/fqOTw9v//DQ0A "05AB1E ‚Äì Try It Online")
-1 byte thanks to @Grimmy
Yet another port of my Keg answer for the sake of completion.
## Explained
```
2t√∑
2t  # Push the square root of two
  √∑ # Integer division
```
üçüüçÖ
Still no ketchup.
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 3 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
z2q
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=ejJx&input=NTAw)
`z` is the floor division method and `q` is the nth-root method, defaulting to square root when it's not passed an argument.
[Answer]
# Mathematica, ~~17~~ ~~14~~ 13 bytes / ~~12~~ 7 characters
```
‚åä#/‚àö2‚åã&
```
[Try it online](https://tio.run/##y00syUjNTSzJTE78n2b7Pyi/NC8lWln/Uccso1i1/wFFmXkl0WnRhgbEgNjY/wA)
-3 bytes because Mathematica accepts the char ‚àö, which I copied from [this](https://codegolf.stackexchange.com/a/198438/75323) MathGolf answer.
-1 byte, -5 characters, as per @Mark S. suggestion, by using `‚åä‚åã`. 
For just one more byte (but 5 more characters) I can always round to the nearest integer with
```
Round[#/‚àö2]&
```
[Answer]
# TI-BASIC, 5 bytes
```
int(Ans‚àö(2‚Åª¬π
```
Built-ins are great.  
Input is a number in `Ans`.  
Output is what is specified in the challenge.
**Explanation:**
```
       ‚àö(2‚Åª¬π   ;get the square root of 1/2
    Ans        ;get the input (Ans)
               ;implicit multiplication
int(           ;truncate
               ;implicit print of Ans
```
---
**Note:** TI-BASIC is a tokenized language. Character count does *not* equal byte count.
[Answer]
# [C (gcc)](https://gcc.gnu.org/) -lm, ~~23~~ \$\cdots\$ ~~50~~ 27 bytes
Saved 6 bytes thanks to [a'\_'](https://codegolf.stackexchange.com/users/85052/a)!!!  
Added 38 bytes to fix type error kindly pointed out by [S.S. Anne](https://codegolf.stackexchange.com/users/89298/s-s-anne).  
Saved 3 bytes thanks to [rtpax](https://codegolf.stackexchange.com/users/85545/rtpax)!!!  
```
#define f(n)ceil(n/sqrt(2))
```
[Try it online!](https://tio.run/##fVJtb4IwEP7ur7iwmIDWWEpLIc59WfYrpllMKY4Mq6OYkRn/@tjxInFLlISj99xz1@fuULOtUnX9kOg0MxpS13hKZ7lr5vazKF3mefVukxnXg9MI8Dkam22NTiDfm21nSm3LN/O6hiXGT5SAT4ARCAhwAgJdhAIEBG1i9GK7QxRyzqUfDlgLM59LHgUhl5hKA4kgj2MsyGIeh5LFWJYLGog4DpnEOKLnxS2BujpoVeqklfhHYKcxIgCs8QQ6kjaupNKneDn4gY86gibcYqGMWAMLP8J@mLgWGw1i21YxkwsmMMJCFkUXgep9U0zQavWhi06Ss6pe2KqKn/EVDoFrP3D6vHRfgJuZEjKT6ArT6KI/PoLNvvU@dS@NevMemAzIAqbTln1Z5I1ZGSzcL7Slrxf32BbZzS9zl6SRNKzgf9FDgS2lrjPO8yPMnqD9ju3K4BgMAUuGSdnlUq/7m86jc/2j0nyztfUs39Wzr18 "C (gcc) ‚Äì Try It Online")
[Answer]
# [Brainlove](https://esolangs.org/wiki/Brainlove), 73 70 74 61 35 bytes
### Because brainfuck is too hard
-3 bytes by myself, rearranging the memory and fixing some bugs
+4 bytes by myself, fixing an error
-13 bytes by myself
-26 bytes by myself, actually using the Brainlove features properly.
```
[$[->+<]!-]+>[<$[>[-~]<-]!++>>+<]>-
```
[Try it online](https://tio.run/##lYwxCsNAEAPfYnDhQ2xeIPQRsUUCKQIhgRQp7@uX9RncZ6odidXtc328nu/vfWAyvDoE5hIJmavl6MnIBdBeKAYdKWyEorcwLJw4GJviRJKVMJM0DuOhyd5UQ3VJUY81qJlbO1UUPadsQG/GX9SYL8zxAw)
First computes the sum $$ S = \sum\_{i=1}^n i = \frac{n(n+1)}{2} $$ and then the square root by finding the largest n for which $$ \sum\_{i=1}^n 2i-1 = n^2 < S $$ The error is always $$ E= \sqrt{\frac{n(n+1)}{2}}- \frac{n}{\sqrt{2}} < \sqrt{\frac{(n+\frac{1}{2})^2}{2}} - \frac{n}{\sqrt{2}} = \frac{n+\frac{1}{2}-n}{\sqrt{2}} = \frac{\sqrt{2}}{4} $$ and it is counteracted by rounding down. It is not very golfed, since I'm not very familiar with golfing in Brainlove/brainfuck, any improvements welcome (or a bf version). It should theoretically work for unbound cells (arbitrary precision), but I didn't have an option to test that. The input and output are on position 0 and 2 on tape, respectively.
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 5 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
Full program. Prompts stdin for zero or more numbers.
```
‚åà‚éï√∑‚àö2
```
[Try it online!](https://tio.run/##NcuxDcIwFATQPlP8BSLZ3/f94wWoIzaIFIsmghQU0COIBEI0NCzCAGziRYwTwRV30pOuG4e6P3bDblPHwz5u@9jndH@u1un8sNwopeuJCrRtAYcqTZcxp9tU6PNO04tzkUxLxsqQJSZHICFryDGJKWZ@tWzjAaj1f5mRLRSN81ACBwSvHIQgxkkIntWpKVi@gFfAzBBErLdCXw "APL (Dyalog Extended) ‚Äì Try It Online")
`‚åà` ceiling of
`‚éï`‚ÄÉconsole input
`√∑`‚ÄÉdivided by
`‚àö`‚ÄÉthe square root of
`2`‚ÄÉtwo
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 6 bytes
The division *auto-casts* the number to a decimal!? (In seriousness, is there a square root function in Pyth?)
```
/Q@2 2
```
[Try it online!](https://tio.run/##K6gsyfj/Xz/QwUjB6P9/UwMDAA "Pyth ‚Äì Try It Online")
# Explanation
```
  @2   2 to the power of
     2 1/2 (effectively calculates math.sqrt(2))
/Q     Divide the (evaluated) input by that number
```
[Answer]
# [Whitespace](https://web.archive.org/web/20150618184706/http://compsoc.dur.ac.uk/whitespace/tutorial.php), ~~122~~ 103 bytes
```
[S S T  T   N
_Push_-1][S S S N
_Push_0][S N
S _Dupe_0][T    N
T   T   _Read_STDIN_as_integer][T   T   T   _Retrieve_input][S N
S _Dupe_input][N
T   S T N
_If_0_Jump_to_Label_ZERO][N
S S N
_Create_Label_LOOP][S N
T   _Swap_top_two][S S S T  N
_Push_1][T  S S S _Add][S N
T   _Swap_top_two][S N
S _Dupe_input][S N
S _Dupe_input][T    S S N
_Multiply][S T  S S T   S N
_Copy_0-based_2nd_n][S N
S _Dupe_n][T    S S N
_Multiply][S S S T  S N
_Push_2][T  S S N
_Multiply][S N
T   _Swap_top_two][T    S S T   _Subtract][N
T   T   N
_If_neg_Jump_to_Label_LOOP][S N
T   _Swap_top_two][N
S S T   N
_Create_Label_ZERO][T   N
S T _Print_as_integer]
```
Letters `S` (space), `T` (tab), and `N` (new-line) added as highlighting only.  
`[..._some_action]` added as explanation only.
[Try it online](https://tio.run/##LYvRCYBADEO/kykywjmSyIH3Jyg4fm1aUygvJHnP9cz72o8ZIQGUxDwQlhlpqCY5kDuO3PsfemVXBj1ADWBkYXYitlH6AA) (with raw spaces, tabs and new-lines only).
Output is rounded up.
Inspired by the following mentioned in [*@Deadcode*'s Regex answer](https://codegolf.stackexchange.com/a/198428/52210):
> 
> For input \$N\$, we want to calculate \$M=\left\lfloor\frac{N}{\sqrt2}\right\rfloor\$. So we want the largest \$M\$ such that \$2M^2<N^2\$.
> 
> 
> 
EDIT: My program now implements \$2M^2\leq N^2\$ instead to save 19 bytes (\$\lt\$ vs \$\leq\$ is irrelevant, otherwise \$\sqrt{2}\$ would be rational). Although I see *@Deadcode* edited his Regex answer and he's actually using \$\leq\$ as well.
**Explanation in pseudo-code:**
```
Integer n = -1
Integer input = STDIN as integer
Start LOOP:
  n = n + 1
  If(n*n*2 - input*input < 0):
    Go to next iteration of LOOP
  Print n
  (exit program with error since no exit is defined)
```
**Example program flow ([input `4`](https://tio.run/##LYvRCcBADEK/dQqH6EKlHFz/Dq7Q8dOYNEJ4or7zfsZe5zUiJICSmALhMyMN1SQHcseRe/9Dr@zKoAeoAYwszE7E8QE)):**
```
Command  Explanation                  Stack         Heap     STDIN  STDOUT  STDERR
SSTTN    Push -1                      [-1]
SSSN     Push 0                       [-1,0]
SNS      Duplicate 0                  [-1,0,0]
TNTT     Read STDIN as integer        [-1,0]        [{0:4}]  4
TTT      Retrieve from heap #0        [-1,4]        [{0:4}]
SNS      Duplicate 4                  [-1,4,4]      [{0:4}]
NTSTN    If 0: Jump to Label ZERO     [-1,4,4]      [{0:4}]
         (^ workaround for input=0, since it would otherwise output -1)
NSSSN    Create Label LOOP            [-1,4]        [{0:4}]
SNT       Swap top two                [4,-1]        [{0:4}]
SSSTN     Push 1                      [4,-1,1]      [{0:4}]
TSSS      Add top two: -1+1           [4,0]         [{0:4}]
SNT       Swap top two                [0,4]         [{0:4}]
SNS       Duplicate 4                 [0,4,4]       [{0:4}]
SNS       Duplicate 4                 [0,4,4,4]     [{0:4}]
TSSN      Multiply top two: 4*4       [0,4,16]      [{0:4}]
STSSTSN   Copy 0-based 2nd            [0,4,16,0]    [{0:4}]
SNS       Duplicate 0                 [0,4,16,0,0]  [{0:4}]
TSSN      Multiply top two: 0*0       [0,4,16,0]    [{0:4}]
SSSTSN    Push 2                      [0,4,16,0,2]  [{0:4}]
TSSN      Multiply top two: 0*2       [0,4,16,0]    [{0:4}]
SNT       Swap top two                [0,4,0,16]    [{0:4}]
TSST      Subtract top two: 0-16      [0,4,-16]     [{0:4}]
NTTN      If neg: Jump to label LOOP  [0,4]         [{0:4}]
SNT       Swap top two                [4,0]         [{0:4}]
SSSTN     Push 1                      [4,0,1]       [{0:4}]
TSSS      Add top two: 0+1            [4,1]         [{0:4}]
SNT       Swap top two                [1,4]         [{0:4}]
SNS       Duplicate 4                 [1,4,4]       [{0:4}]
SNS       Duplicate 4                 [1,4,4,4]     [{0:4}]
TSSN      Multiply top two: 4*4       [1,4,16]      [{0:4}]
STSSTSN   Copy 0-based 2nd            [1,4,16,1]    [{0:4}]
SNS       Duplicate 1                 [1,4,16,1,1]  [{0:4}]
TSSN      Multiply top two: 1*1       [1,4,16,1]    [{0:4}]
SSSTSN    Push 2                      [1,4,16,1,2]  [{0:4}]
TSSN      Multiply top two: 1*2       [1,4,16,2]    [{0:4}]
SNT       Swap top two                [1,4,2,16]    [{0:4}]
TSST      Subtract top two: 2-16      [1,4,-14]     [{0:4}]
NTTN      If neg: Jump to label LOOP  [1,4]         [{0:4}]
SNT       Swap top two                [4,1]         [{0:4}]
SSSTN     Push 1                      [4,1,1]       [{0:4}]
TSSS      Add top two: 1+1            [4,2]         [{0:4}]
SNT       Swap top two                [2,4]         [{0:4}]
SNS       Duplicate 4                 [2,4,4]       [{0:4}]
SNS       Duplicate 4                 [2,4,4,4]     [{0:4}]
TSSN      Multiply top two: 4*4       [2,4,16]      [{0:4}]
STSSTSN   Copy 0-based 2nd            [2,4,16,2]    [{0:4}]
SNS       Duplicate 2                 [2,4,16,2,2]  [{0:4}]
TSSN      Multiply top two: 2*2       [2,4,16,4]    [{0:4}]
SSSTSN    Push 2                      [2,4,16,4,2]  [{0:4}]
TSSN      Multiply top two: 4*2       [2,4,16,8]    [{0:4}]
SNT       Swap top two                [2,4,8,16]    [{0:4}]
TSST      Subtract top two: 8-16      [2,4,-8]      [{0:4}]
NTTN      If neg: Jump to label LOOP  [2,4]         [{0:4}]
SNT       Swap top two                [4,2]         [{0:4}]
SSSTN     Push 1                      [4,2,1]       [{0:4}]
TSSS      Add top two: 2+1            [4,3]         [{0:4}]
SNT       Swap top two                [3,4]         [{0:4}]
SNS       Duplicate 4                 [3,4,4]       [{0:4}]
SNS       Duplicate 4                 [3,4,4,4]     [{0:4}]
TSSN      Multiply top two: 4*4       [3,4,16]      [{0:4}]
STSSTSN   Copy 0-based 2nd            [3,4,16,3]    [{0:4}]
SNS       Duplicate 3                 [3,4,16,3,3]  [{0:4}]
TSSN      Multiply top two: 3*3       [3,4,16,9]    [{0:4}]
SSSTSN    Push 2                      [3,4,16,9,2]  [{0:4}]
TSSN      Multiply top two: 9*2       [3,4,16,18]   [{0:4}]
SNT       Swap top two                [3,4,18,16]   [{0:4}]
TSST      Subtract top two: 18-16     [3,4,2]       [{0:4}]
NTTN      If neg: Jump to label LOOP  [3,4]         [{0:4}]
SNT       Swap top two                [4,3]         [{0:4}]
NSSTN     Create Label ZERO           [4,3]         [{0:4}]
TNST      Print as integer to STDOUT  [4]           [{0:4}]         3
                                                                            error
```
Program stops with an error because no exit is defined.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), Precision limited by built-in types, ~~42~~ 36 bytes
```
__int128 f(__int128 n){n/=sqrtl(2);}
```
[Try it online!](https://tio.run/##nY5fa8MgFMXf/RSSUVDoOv9cNdJun6CveyuUEZtMyMzWJHsp/eyZKeniuj3tgnI4/s49FvdVUQzDfu9Dx0WOS/ItAz2Fh8f249jVRND1ebjzoah7d8CbtnO@Wb0@IRRZ/PbiA/lsvKPohHCc92O0S5It3C7852SXLdNki3q0k6uPxDJFSKyjJWF0eZV8lmKWcpYwS5XEkhUyCSoWH/5o5IylpewyiZFrADBc/2J@YIKDgVxqMDcldROq8SdMmhgAa8fMZIKwYLURVqWmYlJZq4WJifh8s68Pra/CweEJ5zmANgBsxK1SXHP1vN1Sukbn4Qs "C (gcc) ‚Äì Try It Online")
Floor for the most part but the last output is ceiling.
Uses GCC's `__int128` type: shorter in text length than `unsigned long`, can represent every value in `unsigned long`, and determined to not be a builtin type. Stay tuned for 6-8 weeks to get arbitrary precision.
*-6 bytes thanks to [Peter Cordes](https://codegolf.stackexchange.com/users/30206/peter-cordes)!*
[Answer]
## [wx](https://github.com/w-golflang/w), 3 bytes
It's [W](https://github.com/a-ee/w), with just one instruction added: square root. Turns out that this is very useful! (P.S. the built-in was added before the challenge.)
```
2Q/
```
## Explanation
```
 2Q  % Find the square root of 2
a  / % Divide the input by it
     % If one operand is an integer,
     % the program will automatically
     % try to trunctuate to an integer
```
[Answer]
# [PHP](https://php.net/), 17 bytes
```
<?=$argn/2**.5|0;
```
[Try it online!](https://tio.run/##K8go@P/fxt5WJbEoPU/fSEtLz7TGwPp/anJGvoJSTF5Mnoaff4irlUJ@nkJJRmaxQnFlcUlqro5CbmKFQmZeiUJmsZWCkl6AR0C8p19IvK9jhJ6SppL1fxNTA2NTS0szI3NjcwMTS7N/@QUlmfl5xf913QA "PHP ‚Äì Try It Online")
Uses @Niphram's truncate method (which in PHP also has the ability to convert the float to an int)
I know it's trendy to say PHP is to be hated, but I kinda came to like its oddities, and it gives me a chance to add an original answer
EDIT: saved 4 bytes using `<?=` php tag (no need to echo)
EDIT2: basically it's just a port of @Niphram's answer now
[Answer]
# [Canvas](https://github.com/dzaima/Canvas), 4 [bytes](https://github.com/dzaima/Canvas/blob/master/files/chartable.md)
```
Ôºí‚àöÔΩé‚îê
```
[Try it here!](https://dzaima.github.io/Canvas/?u=JXVGRjEyJXUyMjFBJXVGRjRFJXUyNTEw,i=MTAwMA__,v=8)
[Answer]
# [Dart](https://www.dartlang.org/), 33 bytes
```
import'dart:math';f(a)=>a~/sqrt2;
```
[Try it online!](https://tio.run/##NYxBCoMwFET3nuIjggl8aKLRloq9SOkiIKF/kcSmwY3Yq6ep1LeYYYZhJh1iSmRnH2I95XC1Oj7rwTDNx5v@nN6vEJshLZ4msJoc47AWkDE@sEUHICAHd4ESG2xRYYdSYNtgJ3In/rL7pVdKnWV/NJnH8fZjDuQiKw2riMMI1WoY8a3kw77Yii19AQ "Dart ‚Äì Try It Online")
[Answer]
# [Keg](https://github.com/JonoCode9374/Keg), 6 bytes
```
21¬Ω√ã/‚Ñ§
```
[Try it online!](https://tio.run/##y05N/@@QZljz38jw0N7D3fqPWpb8PzaJy8DQyNjE9FHDQkMDIGFsBCRMDQzAfDgFBHFcGlZ6CQq6dgoJOg5pxybpJcTkJeho/v@vm5kHAA "Keg ‚Äì Try It Online")
This defines the function `f` as:
* Taking a single parameter, then
* Calculating the square root of 2 by raising it to the power of 0.5, then
* Dividing the parameter by root 2, then
* Casting the result to an integer (truncating / flooring the result) and returning it.
The footer is to define the test cases in a nice way.
## Explained in a usual way
```
21¬Ω√ã/‚Ñ§
2   # Push 2 to the stack
 1¬Ω # Push 1 and halve it to get 0.5
   √ã    # Push 2 ** 0.5 (x ** 1/2 = sqrt(x))
    /‚Ñ§  # Divide and cast to integer (floor) 
```
üçüüçÖ
Sorry, we're all out of ketchup. You'll have to squeeze your own.
[Answer]
# Haskell, 20 bytes
```
f n=round$n/(sqrt 2)
```
[Try it online](https://tio.run/##y0gszk7Nyfn/P00hz7YovzQvRSVPX6O4sKhEwUjzf25iZp6CrUJBaUlwSZFPnoKKQnFGfrmCRpqCiamBsamlpZmRubG5gYmlmeZ/AA)
[Answer]
# [Python 3](https://docs.python.org/3/), ~~22~~ 21 bytes
```
lambda x:int(x/2**.5)
```
[Try it online!](https://tio.run/##fVBNTwJBDL3zKxpOLJnodPo1JVn/iHpYYzaSwEKAEPz1awej8WQPbd9r@5r2@Hn5OEw0j/3LvBv2b@8D3Dbb6bK6PZb1@kG6@TrsztDDc06ACUoCSsAJJGBQFITkVss//jupysyG@svd6YJsXEnZQqQ4u1rxJlWZ1ZizkWUXQUX5O/mfJXDRUkM3O2K1goRWubqiaREmMiUiIb83ILtrLGImpkqvi/FwgjgStlML580Cwo6n9oTACZb90zLB2EDXzV8 "Python 3 ‚Äì Try It Online")
*-1 byte thanks to @RGS. Thanks for reminding me that implicit decimals exist*
Just a port of my Keg answer. Nothing special here.
[Answer]
# [MathGolf](https://github.com/maxbergmark/mathgolf/blob/master/math_golf.txt), 4 [bytes](https://github.com/maxbergmark/mathgolf/blob/master/code_page.py)
```
2‚àö/i
```
[Try it online.](https://tio.run/##fY3LDUJRCET3NCMwA1zKceMn0bixCGuwPBt53veiiStZQHLCzLnu76fj7XJYFn89nrvzsqiYuEAoIaYCl9DJ9LO2O5JkWX7JCt1YHEiW0Jud5R3CUER3eqF0wpkls0hdQUdYWvzU/BvpSB9Tom02yg1Wg6PTKj0IVAII9PZgnNqpIUEMvAE)
**Explanation:**
```
2‚àö    # Take the square-root of 2
  /   # Divide the (implicit) input-integer by this
   i  # Cast it to an integer, truncating any decimal values
      # (after which the entire stack joined together is output implicitly as result)
```
[Answer]
# [CJam](https://sourceforge.net/p/cjam), 9 bytes
CJam has `mQ`, but unfortunately it trunctuates to an integer ... Another port of Lyxal's answer.
```
q~2 .5#/i
```
[Try it online!](https://tio.run/##S85KzP3/v7DOSEHPVFk/8/9/UwMDAA "CJam ‚Äì Try It Online")
## Explanation
```
q~        e# Take input & evaluate
  2       e# Take 2 to the power of ...
    .5#   e# ... 0.5 (equal to square root)
       /  e# Divide the input by it
        i e# Convert to integer
```
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 67 bytes
```
param([uint64]$n)($n/[math]::Sqrt(2)).ToString("G17")-replace'\..*'
```
[Try it online!](https://tio.run/##BcHtDkAgFADQdzGbsslXankBD8A//GjWsFVyZR7/Oidcn4HnMNYiBg3akfk9fRR8TT0lqS9np@Ox9v14QyQNpWy6xgin30ky1DKhBZhg9WayhbE8Q0TeVW2nlGhkKyuuxA8 "PowerShell ‚Äì Try It Online")
.NET (and thus, by extension, PowerShell) doesn't have a `BigDecimal`, so we're limited to [`Double`](https://docs.microsoft.com/en-us/dotnet/api/system.double?view=netframework-4.8) or [`Decimal`](https://docs.microsoft.com/en-us/dotnet/api/system.decimal?view=netframework-4.8). However, the `[math]::Sqrt()` function only works on `Double`, so there we're stuck. So far, so standard. We then specify precision with [`G17`](https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings?view=netframework-4.8#GFormatString), which successfully round-trips to give us 17 digits of precision on our `Double`, so we can pass everything but the last three test cases. We finish that off with a simple truncation `-replace`.
[Answer]
# [Burlesque](https://github.com/FMNSSun/Burlesque), 8 bytes
```
@2r@|/R_
```
[Try it online!](https://tio.run/##SyotykktLixN/f/fwajIoUY/KP7/f1MDAwA "Burlesque ‚Äì Try It Online")
```
@2   # Push 2.0
r@   # Sqrt it
|/   # Cast input to number, divide input by 2
R_   # Round to nearest
```
]