# Are Minecraft enchantment values applied to items float based (and so carry fractional values over) or integer based (and so lost?)

This seems like an important question, but different searches using different phrasings returned no matches. I apologize if it has been answered before. Here is my question.

When applying enchantments from books to items, I've noticed that often no level improvement is shown. For example, applying a sharpness level II to a sword with sharpness III will show no change, even though the player is charged full price in experience for the 'upgrade'. In the most extreme example, I have a crossbow with level IV piercing and a book with level IV piercing. Placing both items on the anvil shows a cost of 35 experience, but the resulting crossbow shows as the same level IV. Would using this rare and precious book on the crossbow be wasted, or am I better off waiting until I can combine two level IV piercing books to obtain a level V, and then apply that to the crossbow? In other words, would applying the level IV piercing to the crossbow increase the float value of the enchantment (even though it falls short of the level V displayed integer) and so carry over until I can apply additional piercing enchants (say several level II's or a level III) to reach the next full displayed integer level V, or are integer values only used, and anything that fails to reach the level V integer is wasted and lost, at the expense of exp?

# Shorts (Integers)

Enchantment levels are short integer. A short is an integer between -32767 and 32767 (inclusive). If you use a Sharpness II + Sharpness III book, nothing will happen except you will get scammed for your XP.
You can only combine the same level enchantments, it will let you combine them but the level you see there is exactly what you get, meaning if you see V that is exactly 5, not something like 5.294.

# Why?

Why are is XP still taken? Probably because sometimes only one enchantment you want to combine and you don't care if you lose out on another one if the item has multiple enchantments on it.

• Yeah, that is a bit of a scam. 35 EXP takes a lot of time to acquire. To have it burned because of a poorly coded and poorly explained dynamic doesn't seem quite right. Ok then. I'll hold on to that book for now. Thanks for the information! Commented Oct 28, 2020 at 16:06
• @science_1 its not really poorly coded as I tried to explain in the "why" as to why this is, and its not very poorly explained as it tells you exactly what you're putting in (i.e. Sharpness I and Sharpness II) and shows you exactly what you'd get (i.e. Just Sharpness II). You then accepted to trade that in. If it did have hidden decimal values then that would be poorly shown and confusing but the way it is I think is fairly straightforward, I think you were just overcomplicating it. Commented Oct 28, 2020 at 17:51