As far as the U.S. goes, I doubt students remember much of the math they learn, or gain much more competency in math than they would via a language course.
There are lots of standardized tests that evaluate students’ math proficiency, and lots of research examining specifically how much math proficiency students gain from each year of school. Learning and retention could definitely be improved, but I’ve never seen research that claims it’s as low as it apparently is for foreign languages.
Standardised tests are pretty terrible at measuring actual competency. Standardised testing is one of the reasons why the US's school system is so poor. And I say this as someone who generally excels at these kind of arbitrary tests.
Knowing what functions and variables are is below high school level, and I'd say it'd be comparative to knowing basic greetings in a foreign language. I doubt that many students who don't go on to study math after high school remember what's taught in courses at or past the Algebra 2 level.