# Floating point substraction

if $$x=1.0e38=1.0 * 10^{38}$$ and $$y=3.0$$
i want to find $$(x-x)+y$$ and $$(x+y)-x$$
i think the value of (x-x)+y will be just substract $$x-x=0 + y=3.0 = 3.0$$
but how can i perfom addition of different base? $$(x+y)-x$$
i think the idea is addition $$(x+y)$$ then substract $$-x$$ using floating point, i tried to convert $$y=3.0$$ to binary such as $$1.1 * 2^1$$
but how about $$10^{38}$$ to binary ?

• What happens when you subtract a small number from a very big number? Would precision matter? – gnasher729 Jul 31 at 12:21
• @gnasher729 can you explain more? My question is how can i add x+y in different base? – devss Jul 31 at 12:23
• Do you think you have enough precision in floating point so that 10^38 and 10^38 + 3 can be distinguished? – gnasher729 Jul 31 at 17:55
• @gnasher729 i think it will produce overflow(?) in IEEE754 we only have 8 bits for eksponent and 23 for mantissa , since it will shift 3 to match 38 eksponent , and the addition it produce $10^{38}$ because overflow(?) – devss Jul 31 at 22:55