# Output with the same number of digits of pi as the length of the code

Your challenge is to print x digits of pi where x is your code length.

Examples:

Source code (length) -> output
foo!        (4)         3.141
foobar      (6)         3.14159
kinda long  (10)        3.141592653
+++++       (5)         3.1415
123456789   (9)         3.14159265


You can use floor(π/10 * 10code_length) / 10code_length - 1 to determine the number of digits you need to print. Note that the decimal point does not count as a digit of pi - so code of length 3 should have output 3.14, of length 4.

Rules:

• Your code length must be larger than three characters.
• You may not use any standard loopholes.
• You may use any standard allowed output methods.
• You may not use a builtin pi constant.
• Pi must be completely accurate and not approximated.
• The decimal point in the output is necessary. If you choose to output via return value, you must return a floating point integer.
• The goal of this challenge is to find the shortest solution in each language, not the shortest language for the solution. Don't be afraid to post a solution in a language when a shorter solution is posted in the same language as long as your solution uses a different method.
• ...so would this be valid or not? – Jonathan Allan Sep 15 '17 at 16:59
• (edit ^ this even (rounding)) – Jonathan Allan Sep 15 '17 at 17:07
• “Code length” ← in bytes or in characters? – Lynn Sep 17 '17 at 21:19
• @Lynn Bytes, as usual. – MD XF Sep 17 '17 at 23:50
• Is just 3 allowed? – NoOneIsHere Apr 23 '18 at 21:47

# Perl 6, 16 bytes

{4*atan       1}


Try it online!

• 13 bytes using tau – Jo King Apr 16 at 6:13

# Brainfuck (32 bit), 672 660 bytes

++++++[->++++++++++<]>[->+++++++++++<]>[<+>>>>>>>>++++++++++<<<<<<<-]>+++++[<+++++++++>-]+>>>>>>+[<<+++[>>[-<]<[>]<-]>>[>+>]<[<]>]>[[->>>>+<<<<]>>>+++>-]<[<<<<]<<<<<<<<+[->>>>>>>>>>>>[<+[->>>>+<<<<]>>>>>]<<<<[>>>>>[<<<<+>>>>-]<<<<<-[<<++++++++++>>-]>>>[<<[<+<<+>>>-]<[>+<-]<++<<+>>>>>>-]<<[-]<<-<[->>+<-[>>>]>[[<+>-]>+>>]<<<<<]>[-]>+<<<-[>>+<<-]<]<<<<+>>>>>>>>[-]>[<<<+>>>-]<<++++++++++<[->>+<-[>>>]>[[<+>-]>+>>]<<<<<]>[-]>+>[<<+<+>>>-]<<<<+<+>>[-[-[-[-[-[-[-[-[-<->[-<+<->>]]]]]]]]]]<[+++++[<<<++++++++<++++++++>>>>-]<<<<+<->>>>[>+<<<+++++++++<->>>-]<<<<<[>>+<<-]+<[->-<]>[>>.<<<<[+.[-]]>>-]>[>>.<<-]>[-]>[-]>>>[>>[<<<<<<<<+>>>>>>>>-]<<-]]>>[-]<<<[-]<<<<<<<<]


All credit should go to Felix Nawothnig's yapi.b.