How do I understand the meaning of the phrase "up to~" in mathematics? I am reading a book that explains elementary number theory: Number Theory: A Lively Introduction with Proofs, Applications, and Stories by James Pommersheim, Tim Marks and Erica Flapan.
The authors say, 

"We express this idea in the statement of the Fundamental of Arithmetic by saying that prime factorization are unique up to order.  ... for example, 40 and -40 are equal up to sign, the functions $12x^2$ and $x^2$ are equal up to a constant factor, and so forth."

Because I am not an English native speaker, the phrase "up to" is ambiguous for me a little bit. I would like to figure out the meaning of the phrase and use it properly. How do I do?
 A: When one says "$X$ is true up to $Y$", then one means that it is not strictly speaking correct that $X$ is true, and the $Y$ which occurs after the up to clarifies the sense in which $X$ is not quite true.  
Thus it really means "Roughly speaking $X$ is true, except for $Y$".  
As you can see, this is a very informal construction.  It could be used very abusively.  In order to be acceptable, the sense in which $Y$ "corrects" $X$ needs to be very familiar to the reader, or the underlying logic should be made more explicit.  
So when one says that factorizations in $\mathbb{Z}$ are unique up to order, then it is understood that of course we could have $a*b*c= b*a*c = c*a*b = \ldots$ and we don't want to count these as being essentially different factorizations.  In this case this sloppy language is probably a good expository choice, since most readers have an intuitive idea of what the "exception" is, whereas spelling it out explicitly would probably involve something like the following:

Uniqueness of Prime Factorizations: If $r$ and $s$ are positive integers, $p_1,\ldots,p_r,q_1,\ldots,q_s$ are prime numbers and $p_1 \cdots p_r = q_1 \cdots q_s$, then $r = s$ and there is a bijection $\sigma: \{1,\ldots,r\} \rightarrow \{1,\ldots,s\}$ such that $p_i = q_{\sigma(i)}$ for all $1 \leq i \leq r$.  

The point is that this more precise statement will be gibberish to someone who does not have a certain amount of mathematical sophistication.  (On the other hand, at some point a student of mathematics should be able to supply the statement above or something equally explicit and logically equivalent.  In fact I happen to recall one colleague of mine, a veteran research mathematician, who told me that he was always uncomfortable with the statement of uniqueness of factorization because of the vague phrase "up to".  He has very high standards for clear exposition and thinking.) The book that you speak of is written for a much more general audience, so their expository choice is a good one.
(As an aside, I was first introduced to number theory in a course taught by Marks and Pommersheim, a course they taught to talented high school students during the summer over a period of many years.  I haven't read the book that you mention, coauthored with Flapan, but I'd have to think that it is largely based on these courses.  This course was one of the great influences on my intellectual life -- not coincidentally I am now a number theorist! -- so I expect the book is pretty good.)
A: "$A$ and $B$ are equal up to $x$" means that either $A = B$, or that $A$ can be obtained from $B$ by merely modifying $x$ or applying $x$.
Examples:  


*

*$4$ and $-4$ are equal up to sign because you can obtain one from the other by modifying the sign.  

*$(2^3, 7^4)$ and $(7^4, 2^3)$ are equal up to order since you can obtain one from the other by modifying the order.  

*$S_2$ and $\mathbb{Z}/2\mathbb{Z}$ are equal up to isomorphism (as groups) since you can obtain one from the other by applying an isomorphism.


It's understood that when ever this terminology is used, the relation between $A$ and $B$ is an equivalence relation on objects of the type of $A$ and $B$.
