Skip to main content
edited body
Source Link
FlipTack
  • 14.7k
  • 3
  • 56
  • 102

Inspired by this video by tecmath.

An approximation toof the square root of any number x can be found by taking the integer square root s (i.e. the largest integer such that s * s ≤ x) and then calculating s + (x - s^2) / (2 * s). Let us call this approximation S(x). (Note: this is equivalent to applying one step of the Newton-Raphson method).

Though this does have quirk, where S(n^2 - 1) will always be √(n^2), but generally it will be very accurate. In some larger cases, this can have a >99.99% accuracy.

Input and Output

You will take one number in any convienent format.

Examples

Format: Input -> Output

2 -> 1.50 5 -> 2.25 15 -> 4.00 19 -> 4.37 // actually 4.37 + 1/200 27 -> 5.20 39 -> 6.25 47 -> 6.91 // actually 6.91 + 1/300 57 -> 7.57 // actually 7.57 + 1/700 2612 -> 51.10 // actually 51.10 + 2/255 643545345 -> 25368.19 // actually 25,368.19 + 250,000,000/45,113,102,859 35235234236 -> 187710.50 // actually 187,710.50 + 500,000,000/77,374,278,481 

Specifications

  • Your output must be rounded to at least the nearest hundredth (ie. if the answer is 47.2851, you may output 47.29)

  • Your output does not have to have following zeros and a decimal point if the answer is a whole number (ie. 125.00 can be outputted as 125 and 125.0, too)

  • You do not have to support any numbers below 1.

  • You do not have to support non-integer inputs. (ie. 1.52 etc...)

Rules

Standard Loopholes are forbidden.

This is a , so shortest answer in bytes wins.

Inspired by this video by tecmath.

An approximation to the square root of any number x can be found by taking the integer square root s (i.e. the largest integer such that s * s ≤ x) and then calculating s + (x - s^2) / (2 * s). Let us call this approximation S(x). (Note: this is equivalent to applying one step of the Newton-Raphson method).

Though this does have quirk, where S(n^2 - 1) will always be √(n^2), but generally it will be very accurate. In some larger cases, this can have a >99.99% accuracy.

Input and Output

You will take one number in any convienent format.

Examples

Format: Input -> Output

2 -> 1.50 5 -> 2.25 15 -> 4.00 19 -> 4.37 // actually 4.37 + 1/200 27 -> 5.20 39 -> 6.25 47 -> 6.91 // actually 6.91 + 1/300 57 -> 7.57 // actually 7.57 + 1/700 2612 -> 51.10 // actually 51.10 + 2/255 643545345 -> 25368.19 // actually 25,368.19 + 250,000,000/45,113,102,859 35235234236 -> 187710.50 // actually 187,710.50 + 500,000,000/77,374,278,481 

Specifications

  • Your output must be rounded to at least the nearest hundredth (ie. if the answer is 47.2851, you may output 47.29)

  • Your output does not have to have following zeros and a decimal point if the answer is a whole number (ie. 125.00 can be outputted as 125 and 125.0, too)

  • You do not have to support any numbers below 1.

  • You do not have to support non-integer inputs. (ie. 1.52 etc...)

Rules

Standard Loopholes are forbidden.

This is a , so shortest answer in bytes wins.

Inspired by this video by tecmath.

An approximation of the square root of any number x can be found by taking the integer square root s (i.e. the largest integer such that s * s ≤ x) and then calculating s + (x - s^2) / (2 * s). Let us call this approximation S(x). (Note: this is equivalent to applying one step of the Newton-Raphson method).

Though this does have quirk, where S(n^2 - 1) will always be √(n^2), but generally it will be very accurate. In some larger cases, this can have a >99.99% accuracy.

Input and Output

You will take one number in any convienent format.

Examples

Format: Input -> Output

2 -> 1.50 5 -> 2.25 15 -> 4.00 19 -> 4.37 // actually 4.37 + 1/200 27 -> 5.20 39 -> 6.25 47 -> 6.91 // actually 6.91 + 1/300 57 -> 7.57 // actually 7.57 + 1/700 2612 -> 51.10 // actually 51.10 + 2/255 643545345 -> 25368.19 // actually 25,368.19 + 250,000,000/45,113,102,859 35235234236 -> 187710.50 // actually 187,710.50 + 500,000,000/77,374,278,481 

Specifications

  • Your output must be rounded to at least the nearest hundredth (ie. if the answer is 47.2851, you may output 47.29)

  • Your output does not have to have following zeros and a decimal point if the answer is a whole number (ie. 125.00 can be outputted as 125 and 125.0, too)

  • You do not have to support any numbers below 1.

  • You do not have to support non-integer inputs. (ie. 1.52 etc...)

Rules

Standard Loopholes are forbidden.

This is a , so shortest answer in bytes wins.

I can't help it. The addition signs were out of place.
Source Link
Stan Strum
  • 447
  • 3
  • 14

Inspired by this video by tecmath.

An approximation to the square root of any number x can be found by taking the integer square root s (i.e. the largest integer such that s * s ≤ x) and then calculating s + (x - s^2) / (2 * s). Let us call this approximation S(x). (Note: this is equivalent to applying one step of the Newton-Raphson method).

Though this does have quirk, where S(n^2 - 1) will always be √(n^2), but generally it will be very accurate. In some larger cases, this can have a >99.99% accuracy.

Input and Output

You will take one number in any convienent format.

Examples

Format: Input -> Output

2 -> 1.50 5 -> 2.25 15 -> 4.00 19 -> 4.37 // actually 4.37  + 1/200 27 -> 5.20 39 -> 6.25 47 -> 6.91 // actually 6.91  + 1/300 57 -> 7.57 // actually 7.57  + 1/700 2612 -> 51.10 // actually 51.10  + 2/255 643545345 -> 25368.19 // actually 25,368.19 + 250,000,000/45,113,102,859 35235234236 -> 187710.50 // actually 187,710.50 + 500,000,000/77,374,278,481 

Specifications

  • Your output must be rounded to at least the nearest hundredth (ie. if the answer is 47.2851, you may output 47.29)

  • Your output does not have to have following zeros and a decimal point if the answer is a whole number (ie. 125.00 can be outputted as 125 and 125.0, too)

  • You do not have to support any numbers below 1.

  • You do not have to support non-integer inputs. (ie. 1.52 etc...)

Rules

Standard Loopholes are forbidden.

This is a , so shortest answer in bytes wins.

Inspired by this video by tecmath.

An approximation to the square root of any number x can be found by taking the integer square root s (i.e. the largest integer such that s * s ≤ x) and then calculating s + (x - s^2) / (2 * s). Let us call this approximation S(x). (Note: this is equivalent to applying one step of the Newton-Raphson method).

Though this does have quirk, where S(n^2 - 1) will always be √(n^2), but generally it will be very accurate. In some larger cases, this can have a >99.99% accuracy.

Input and Output

You will take one number in any convienent format.

Examples

Format: Input -> Output

2 -> 1.50 5 -> 2.25 15 -> 4.00 19 -> 4.37 // actually 4.37 + 1/200 27 -> 5.20 39 -> 6.25 47 -> 6.91 // actually 6.91 + 1/300 57 -> 7.57 // actually 7.57 + 1/700 2612 -> 51.10 // actually 51.10 + 2/255 643545345 -> 25368.19 // actually 25,368.19 + 250,000,000/45,113,102,859 35235234236 -> 187710.50 // actually 187,710.50 + 500,000,000/77,374,278,481 

Specifications

  • Your output must be rounded to at least the nearest hundredth (ie. if the answer is 47.2851, you may output 47.29)

  • Your output does not have to have following zeros and a decimal point if the answer is a whole number (ie. 125.00 can be outputted as 125 and 125.0, too)

  • You do not have to support any numbers below 1.

  • You do not have to support non-integer inputs. (ie. 1.52 etc...)

Rules

Standard Loopholes are forbidden.

This is a , so shortest answer in bytes wins.

Inspired by this video by tecmath.

An approximation to the square root of any number x can be found by taking the integer square root s (i.e. the largest integer such that s * s ≤ x) and then calculating s + (x - s^2) / (2 * s). Let us call this approximation S(x). (Note: this is equivalent to applying one step of the Newton-Raphson method).

Though this does have quirk, where S(n^2 - 1) will always be √(n^2), but generally it will be very accurate. In some larger cases, this can have a >99.99% accuracy.

Input and Output

You will take one number in any convienent format.

Examples

Format: Input -> Output

2 -> 1.50 5 -> 2.25 15 -> 4.00 19 -> 4.37 // actually 4.37  + 1/200 27 -> 5.20 39 -> 6.25 47 -> 6.91 // actually 6.91  + 1/300 57 -> 7.57 // actually 7.57  + 1/700 2612 -> 51.10 // actually 51.10  + 2/255 643545345 -> 25368.19 // actually 25,368.19 + 250,000,000/45,113,102,859 35235234236 -> 187710.50 // actually 187,710.50 + 500,000,000/77,374,278,481 

Specifications

  • Your output must be rounded to at least the nearest hundredth (ie. if the answer is 47.2851, you may output 47.29)

  • Your output does not have to have following zeros and a decimal point if the answer is a whole number (ie. 125.00 can be outputted as 125 and 125.0, too)

  • You do not have to support any numbers below 1.

  • You do not have to support non-integer inputs. (ie. 1.52 etc...)

Rules

Standard Loopholes are forbidden.

This is a , so shortest answer in bytes wins.

edited tags
Link
Mr. Xcoder
  • 42.9k
  • 9
  • 87
  • 221
Source Link
Stan Strum
  • 447
  • 3
  • 14
Loading