I am working on a a c++ program to calculate the value of pi using following series Pi = 4 * (1/1 – 1/3 + 1/5 – 1/7 + 1/9 … (alternating + -) (1/n)).
I am reading input from a file with following values: 12 123 1234 12345 123456 12345678 123456789 My compiler gives me instant out of for value of pi for these values. But when I try to go further than above values lets say 12345678922. it takes atleast 2 mins to get the output value. Can someone explain why it takes longer time ?
Aucun commentaire:
Enregistrer un commentaire