Computes e^x with a specified number of digits of precision using a binary splitting method for high-precision calculation.
Make sure you have GHC (Glasgow Haskell Compiler) installed.
cd exp
ghc exp.hs -o exp
./exp # Linux/macOS
.\exp.exe # Windows
This program interactively asks for input rather than command-line arguments.
x
(the exponent).Example run:
./exp # Linux/macOS
.\exp.exe # Windows
Enter the value of x (exponent): 2
Enter the number of digits of precision: 10
The program prints the value of e^x
to the requested number of digits.
Example output:
e^2 to 10 digits is: 7.389056098
x
and digits to avoid long computation times.This project is licensed under the MIT License.