Your challenge is to print
x digits of pi where
x is your code length.
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.
- 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 read your source to determine code length.
- 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.