This is a sensible question, and worth exploring because it influences the “where/what to do” question.
Persistence service like rrd4j store the raw numeric value of a Quantity Item state. That’s it, no units. It doesn’t care how you updated that state.
Upon retrieval of the number, persistence service gets the existing unit of the Item and applies that to the stored numeric to recreate the complete Quantity value.
(I think more accurately the “existing unit” is taken to be the system default unit, or the Item state presentation if it exists)
You’ll see the trap; if you change units of the Item state during operation, any historic data you look at (e.g. for charting) will be misrepresented.
So one good practice is to set up to do any transforms or scaling that you might want at the channel level, before data gets to the Item. And then leave that alone.
The answer to the actual question here is of course “it depends”. It depends where you do the transform.
If you transform for display presentation, this does not affect the raw Item quantity value and so does not affect persistence.
If you transform in a rule to process the value in some way, but do not update your Item with any new state, then persistence knows nothing about that either.
If you transform in channel or profile, before data is used for Item state, persistence just uses the Item state.