# [R] Exponentiate very large numbers

Gabor Grothendieck ggrothendieck at gmail.com
Tue Feb 5 21:35:13 CET 2013

```On Mon, Feb 4, 2013 at 10:11 AM, francesca casalino
<francy.casalino at gmail.com> wrote:
> Dear R experts,
>
> I have the logarithms of 2 values:
>
> log(a) = 1347
> log(b) = 1351
>
> And I am trying to solve this expression:
>
> exp( ln(a) ) - exp( ln(0.1) + ln(b) )
>
> But of course every time I try to exponentiate the log(a) or log(b)
> values I get Inf. Are there any tricks I can use to get a real result
> for exp( ln(a) ) - exp( ln(0.1) + ln(b) ), either in logarithm or
> exponential form?
>

Assuming you have bc, try this using the r-bc package available at

> bc("e(1347) - e(l(0.1) + 1351)")
[1] "-4405386005870716963250677607096464495107208188262037831496629962604389947022370210116563260536709412765244230596649428637325731073087741577278759185783174516835759767642509461583320513769415050345878341068570238633056331967056945630593558411688354769032035897813566786044573424610037424319481107653164601301363052343211549433260783299929388275371544460247043814951038945784700209474446687259093777751098627790391356643931274009579136611476739316800835499749286852733758497967615615441909946879410903730244743058347457562287380518284874370438753598667230357006574194406623712901009806747.7875941440505465257638722719393870571587463674102678572599172110259394653657558768303852737288352763"

--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

```