# Calculate golden ratio

Write the shortest code, in number of bytes, to display, return, or evaluate to the golden ratio (that is, the positive root of the quadratic equation: $$\x^2-x-1=0\$$, approximately 1.618033988749895), to at least 15 significant figures. No input will be given to your program.

Sample in Stutsk programming language:

1 100 { 1 + 1 swp / } repeat print

• This question will need a scoring criteria, input/output specification, etc. Please read the FAQ - codegolf.stackexchange.com/faq Jul 26 '12 at 20:27
• @ardnew: I'll try to at least nail down an input (namely none) and winning criterion (shortest code). The expected output is, well...most languages support double-precision, so let's do that and call it good. :-) Jul 30 '12 at 17:22

# ><>, 29, 25 bytes

Saved 4 bytes!

After posting this answer I noticed the example Stutsk program and realized that I could probably save a few bytes. My new answer is based off the example given in the question. This program works because the golden ration can be expressed as a continued fraction.

golden_ratio = 1+1/(1+1/(1+1/...))

ff*101.;n~<
$1$,1+$:?!^1-  Try it online! ## Old Answer f201.;n,2+1~<$:5$,+2,$:?!^1-


The second line approximates the sqrt of 5. After looping 15 times, this value is used to calculate the golden ratio.

Try it online!

# Gol><>, 4 bytes

S1n;


This answer feels like cheating because S1 simply pushes the golden ratio onto the stack.

This answer doesn't work with TIO, but it does work with this interpreter: Try it online!