# Rocket science

I cannot seem to be able to pass this problem. Please note that I am a very beginner but even so, I pass for most planets except for Jupiter. At first I only passed the problem for one planet but after I added more decimals to Eulerâ€™s number, I am passing the test for 5 out of 6 planets.

This is the code I am using:

``````function rocket_fuel(v) {

const v_e = 2550;  // rocket exhaust velocity [m/s]
const M = 250000;  // rocket dry mass [kg]
const e = 2.7182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274274663919320030599218174135966290435729003342952605956307381323286279434907; // Euler's number
let m_fuel = 0.0;

m_fuel = M * (Math.pow(e, v / v_e ) - 1);

return m_fuel;
}

rocket_fuel(11186);
``````

Might be a bug?

1 Like

Thanks so much for bringing this up.

I tested out your code and this is definitely a bug on our side. The problem is in how we are checking solutions. Basically, we need to increase the â€śerror marginâ€ť for the solution for your code so it passes, because your code looks good to me.

Hereâ€™s a workaround for you: instead of using Math.pow(e, â€¦), use Math.exp(â€¦).

If you read online about Math.exp() youâ€™ll find that itâ€™s basically just Math.pow but the first parameter (the base) is always set to Eulerâ€™s number e.

1 Like

Yes, that seems to be alright. It is working now.

Just fixed the error/tolerance checking so the first 6 digits need to be correct instead of the first 3 decimal places (which is what we were doing). @WaterlooPitt just tried it and your original code should work now! Thanks for letting us know, other people were probably having the same issue as well.

1 Like