If we divide (1.0/0.0) we will get +Infinity and if we divide (-1.0/0.0) we will get -Infinity.
How does a computer calculate this value internally?
The simple answer is that a computer that follows a floating point standard such as IEEE 754 does not really compute +/- infinity at all. Instead it treats it as an exception - a special case. Whenever the processor detects an attempt to divide a non-zero floating point number by zero, it sets the result to a special value that is then interpreted as +/-infinity, where the sign depends on the sign of the original number.
In IEEE 754 I believe the special values of +/- infinity are represented internally as a floating point number with a sign bit, an exponent set to all $1$s, and a significand set to all $0$s. This is a value that cannot result from normal (non-exceptional) floating point operations.
Technically speaking, not all computers evaluate
1.0 / 0.0 to
+Inf. But most of recent computers follows a specification named IEEE 754, which especially defines the division on floating-point numbers
1.0 / 0.0 is
Division by zero: an operation on finite operands gives an exact infinite result, e.g., 1/0 or log(0). By default, returns ±infinity.
Also note that an evaluation of a division on integers
1 / 0 often throws "Division By Zero" error in many programming languages.
Division is a rather complex operation.
If the computer is implementing IEEE 754 arithmetic then most likely it categorises its inputs as NaN (not a number), Infinity, Normalised numbers, denormalise numbers, and zeroes. That is done by looking at the exponent and mantissa. The rules are:
Denormalised numbers are made normalised. Then if the operands are not both normalised, the hardware has defined values for the 15 other combinations. If both operands are normalised, the division is performed, and the result can be overflow, normalised, denormalised, or so small it is rounded to zero.
It just checks if the denominator is zero and, if so, does whatever it needs to do, such as returning a value representing infinity, an error, or whatever else is required in the context.