Is a 'synonym' exact?
The received wisdom in linguistics is that there are no exact synonyms; normally there is some difference between any two proposed synonyms (usually in syntax, presuppositions, idiom participation, social level, or speech-group identification), such that one will work, and the other won't.
If you ever do have a situation in which there is absolutely no difference between two words, what happens in general is that one of them disappears (or survives with a different meaning), and the other one inherits the wordhood. After all, why go to the trouble of memorizing two words that have no difference at all when one will do?
The closest to syntactic and semantic synonymy that I've ever encountered is the two verbs seem and appear, which come from very different sources, but have invaded the same word space and can be substituted one for another in any number of situations without changing meaning or producing ungrammaticality. This includes some fairly sophisticated syntax, as well as some epistemologically interesting semantics.
Are synonyms exact? This is an excellent question, and it gets to the concept of how meaning is constructed in language.
With your example from arithmetic, the thing the symbol 5 refers to is fixed. Mathematicians have a series of absolute rules for how you can use it and what it is equal to.
Language, and in particular, the relationship between a thing in a language (e.g., the word happy or phrase a happy occasion) and the meaning of that thing, is not fixed. Many linguists and philosophers would say the meaning of the set of symbols or sounds "happy" is constructed based on how it is used.
You can think of an individual's understanding of a word -- you may look up a word in the dictionary and see a string of other words that describe a meaning, and you may also encounter that word in text and speech. All of these things help you understand what you and others believe the word to mean.
You can also refer to the way dictionaries generate their definitions. Merriam-Webster describes this process in an answer to the faq "how does a word get into the dictionary". The dictionary meanings themselves are based on the way the words are used.
If meaning comes from usage, since two synonyms will occur in different texts, with different contexts, they may have similar or very similar meanings, but they can't have exactly the same meaning.
You may make an argument that in a specific utterance you could replace one word for another without a change in meaning, that the thing either of those words referred to would be the same. However, once that utterance occurs, only one of the possible words was used, and both meanings are changed either by being selected or not.