HaskellProjects

Golden Ratio Calculation (High Precision)

Computes the golden ratio (ϕ) to a specified number of decimal digits using arbitrary-precision integer arithmetic via GMP.

🛠 Build & Run

Make sure you have GCC, GHC (Glasgow Haskell Compiler), and GMP installed.

cd golden_ratio
gcc -c cbits/wrappers.c -o cbits/wrappers.o
ghc golden_ratio.hs cbits/wrappers.o -o golden_ratio
./golden_ratio <digits>      # Linux/macOS
.\golden_ratio.exe <digits>  # Windows

Example:

./golden_ratio 50      # Compute ϕ to 50 digits

⚙ Command-line Arguments

Example run:

./golden_ratio 50

📋 Expected Output

The program prints the golden ratio to the specified number of digits:

ϕ to 50 digits is: 1.61803398874989484820458683436563811772030917980576

🔔 Notes

📜 License

This project is licensed under the MIT License.