…without using any operator/function besides addition (
+), subtraction (
-), multiplication (
*), division (
/), modulo (
pow() or any of the standard C bitwise operators (
<<, >>, ~, &, |, ^) or unary operators (
—, ++) or assignment/comparison operators (
If these symbols represent a different operation in your chosen language, go with the spirit of the question and don't use them.
- You cannot use any mathematical functions your language might offer (Mathematica, looking at you.)
- You cannot use any operator besides the bitwise operators or the arithmetic operators listed above.
- Your output should be a float and be correct to at least 2 decimal places when truncated/rounded.
- You can use constants your language's standard libraries might provide.
- You can hardcode the values, but your program should work correctly for all floats (up to 2 decimal places) between
This is code-golf, so the shortest answer wins.
Input: 3.141592653 / 2 Output: 1.00xxxxxx…
Please also post an ungolfed version of your code.