Should I Choose Fortran or C++ for My Math Needs?

June 11, 2025 5 answers
Asked by sleigh.runners
I'm a programmer skilled in both C++ and Fortran, and I'm considering which one to use for a new math project. I know it's possible to integrate Fortran modules into C++, but I'm wondering if it's really worth the effort. What are other people's experiences and recommendations?

Answers

baton grip
Consider what type of project this isโ€”are you trying to do this for fun or is it a professional venture? Also, are you planning to write the Fortran code yourself or leverage existing libraries? Think about the type of math youโ€™re working with as well; is it more parallel or sequential? That should guide your decision.
Reply to this answer
house rules
Iโ€™d lean towards C++ as well. It offers more versatility and youโ€™re probably going to find more applications for it in the future compared to Fortran.
Reply to this answer
GRAVITY ASSIST
It really depends on the math requirements you have. If you're looking to use specific libraries, like those from NASA that are in Fortran, it could be worth it to integrate them. Fortunately, modern Fortran can communicate with C, so you can get the best of both worlds. Personally, I avoid rewriting libraries if I can; they can be complex and if they work, I would hate to break them by modifying them.
Reply to this answer
MapleSapNotes
Honestly, it all boils down to your specific needs. If Fortran offers capabilities that are hard to replicate in C++, then sure, go for it! Otherwise, sticking with C++ might save you time and hassle.
Reply to this answer
stove_top_simmer
If you're dealing with geometry or basic math tasks, C++ is definitely the way to go! It provides a lot more flexibility and is generally more applicable.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions