I have translated many numerical math programs from FORTRAN into C++ and JavaScript. The original FORTRAN source code listings are posted on the NETLIB site and have been in the public domain for 20, 30, years.

The C++ and JavaScript translations that I write are hand-coded, line-by-line, and repeatedly tested and stepped through. The conversion tool f2c is not used.

Sometimes I get emails from people asking if they can use my program, or the source code, or parts of it in their own work.
I do not mind people using my code in their own work; I implicitly assume people will use it when I post it on a public website anyhow.

But some people ask about licensing (MIT, BSD, BSD 2/3-Clause, Apache, or some other license.)
I have no idea about licensing.
Coding is just a hobby of mine; I have never looked into licenses, how they work, what they do, which one would be most appropriate to my work, etc.

Any advice?
How do I decide to add a license to my work? And, if so, what factors should be considered to decide which license is appropriate to the type of work I post?

pty commented: An interesting question +0

I hear you. My software and apps over the years have had so many licenses that I would not be able to tell you there is a right answer here.

Go with your choice of the above and add some protection to yourself with some passage/text like.

Not for use on life critical systems.

Read https://en.wikipedia.org/wiki/Life-critical_system what that is.

I'd also stick in the usual boiler plate about "supplied as-is without warranty."
There are a lot of litigious folk out there so the license is not only abut the use, but protecting your assets.

I am not a lawyer, but I believe that if you 'port' software from one language to another, you're creating a derivative work and the original licence applies. However (from Wikipedia):

The code base of Netlib was written at a time when computer software was not yet considered merchandise. Therefore, no license terms or terms of use are stated for many programs. Before the Berne Convention Implementation Act of 1988 (and the earlier Copyright Act of 1976) works without an explicit copyright notice were public domain software. Also, most of the Netlib code is work of US government employees and therefore in the public domain.[3][4] While several packages therefore don't have explicit waiver/anti-copyright statements, for instance the SLATEC package has an explicit statement.

As you have created the ports of libraries that are in the public domain, I'd suggest that a Creative Commons licence makes most sense. I noticed on several netlib pages that attribution is requested, so CC-BY might be most suitable (crediting both the original authors and you), or CC-0 if that's not required.

Thanks for all the advice. That was very informative.

I didn't realize there were so many options.
Even to upload an image to Wikipedia requires a license.
If I type text for a simple equation, that is fine. No boundary-pushing discovery here: e.g., cos(x) - x = 0.
But if I want to make the equation look nicer by creating a graphic of it, and trying to upload the png, it needs to come with a license. (So much for doing some quick and easy editing.)

I suppose it is good to know about licenses in any case; sooner or later the knowledge is bound to come in handy.

Wikipedia support Latex notation which shouldn't require any uploading on your behalf.