Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python large_exponentiation.py #3

Open
Cirruslucent opened this issue May 29, 2024 · 0 comments
Open

python large_exponentiation.py #3

Cirruslucent opened this issue May 29, 2024 · 0 comments

Comments

@Cirruslucent
Copy link
Owner

Cirruslucent commented May 29, 2024

import math

Given values

base = 123456789
exponent = 9876543210.0123456789

Step 1: Calculate the natural logarithm of the base

ln_base = math.log(base)

Step 2: Multiply by the exponent

power_term = exponent * ln_base

Step 3: Exponentiate the result

result = math.exp(power_term)

Output the result

print(f"The approximate value of {base}^{exponent} is {result:()}")

import math

Given values

base = 0.123456789
exponent = 9876543210.0123456789

Step 1: Calculate the natural logarithm of the base

ln_base = math.log(base)

Step 2: Multiply by the exponent

power_term = exponent * ln_base

Step 3: Exponentiate the result

result = math.exp(power_term)

Output the result

print(f"The approximate value of {base}^{exponent} is {result:.2e}")

Repository owner locked and limited conversation to collaborators May 29, 2024
Repository owner unlocked this conversation May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant