Back in the early $'90$s, I used to program in a (now obsolete) scripting language called LOGO.

Now, one peculiar glitch that I encountered at the time, was the interpreter halting on $\sqrt{378}$.

I clearly recall not being able to reproduce it with any value of than that specific one.

Ctrl/Break would terminate the operation, so that rules out HW-architecture issues.

My guess is that the approximation method has reached some sort of infinite loop.

So I've been wondering if it's possible to trace back on this method.

I am almost certain that I will not get an answer here, but I decided to give it a shot anyway:

  • What square-root approximation methods are typically used?
  • Is there a possible explanation for failing to approximate specific values?


  • $\begingroup$ Look at stackoverflow.com/q/12304577/1413643 perhaps? $\endgroup$
    – copper.hat
    Commented Jul 4, 2016 at 15:44
  • $\begingroup$ Possible explanation for "halting": An infinite loop in an iterative algorithm such as a Newton-Raphson iteration, designed to stop when two successive iterations produce the same value. An infinite loop occurs when the iteration instead results in a permanent oscillation between two neighboring floating-point numbers. $\endgroup$
    – njuffa
    Commented Jul 5, 2016 at 17:34
  • $\begingroup$ @njuffa: If I remember correctly, then for Newton-Raphson (which I have actually implemented in the past), you only need to go below some absolute threshold before halting. Are you suggesting that the method was alternating between two values, one negative and one positive, neither of which below that threshold (when taking the corresponding absolute value)? That would actually make a lot of sense. Thank you for responding. $\endgroup$ Commented Jul 5, 2016 at 21:19
  • 1
    $\begingroup$ @barakmanos When computed with finite-precision arithmetic, iterative methods may not converge to one single floating-point number, but may, after initial convergence, oscillate between two neighboring floating-point numbers which are both close to the mathematical result. This can be worked around by placing a hard limit on the number of iterations, or by comparing for $\epsilon$ difference between consecutive results instead of $0$. $\endgroup$
    – njuffa
    Commented Jul 5, 2016 at 22:53

1 Answer 1


This is not an answer:

Welcome to Berkeley Logo version 5.5
? sqrt 378
You don't say what to do with 19.4422220952236
  • $\begingroup$ Thanks. That's probably a more recent version of the interpreter. I do remember that a few years later I tried to reproduce it, and had to download a newer version of LOGO (since the original one that I had been using was no longer suitable with my Windows version)... And I was indeed not able to reproduce it. $\endgroup$ Commented Jul 4, 2016 at 15:44
  • $\begingroup$ My son learned a little Logo a few years ago while in elementary school! I still think it is a good learning vehicle for kids. I find Scratch & its ilk to b too visually noisy. $\endgroup$
    – copper.hat
    Commented Jul 4, 2016 at 15:50
  • $\begingroup$ Haha, so did I... But I'd imagine they got rid of it by now and moved on to a more "advanced" technology... Anyways, back at the time it used to be an MS-Dos application. I doubt I can trace back on that specific version, let alone run it on any PC at hand... Perhaps on a VM, but I doubt that there are any VMs available for this OS. $\endgroup$ Commented Jul 4, 2016 at 15:53
  • $\begingroup$ This was 2 years ago :-). I thought the visual aspect would be more appealing at that age. I have it on my Windoze 7 partition (not the MS-DOS version), but it fails to boot at the moment, so a test will have to wait :-(. $\endgroup$
    – copper.hat
    Commented Jul 4, 2016 at 15:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .