It, of course, depends on the application.
It may be thought, because of exposure to what is most common, that computers can only deal with IEEE floating point numbers or arbitrary rational numbers or some such restricted thing, but this is wrong; computers can deal with all kinds of things, as long as you tell them the rules for how to represent them and manipulate them. One particularly easy thing to do is to come up with rules for how to represent arbitrary natural numbers as bitstrings and instructions for how to computably perform basic arithmetic upon them, and from there to represent integers and rational numbers is also particularly easy, but that doesn’t mean there aren’t other representations one could use which correspond to other kinds of numbers.
As the simplest example, suppose the only irrational numbers we really cared about were ones of the form a + b * sqrt(2), where a and b were rational. Then we could just represent such numbers as pairs of two rational numbers, and compute additions, multiplications, subtractions, and divisions in the obvious way upon them. (Sure, this representation doesn’t allow for, say, logarithms; if we wanted those, we’d have to pick a slightly different representation. The representation you pick will always have to be tailored to the operations you want to be able to carry out (for anything; not just numbers); thus, “It depends on the application”).
Speaking of which, we can also go much, much further than this toy example. As a preparatory analogy, suppose the question were “How can computers deal with countably infinite strings of 0s and 1s?”. Well, one non-naive way you could represent such a string is as (some representation of the code for) a function from natural numbers to bits. In a higher-order programming language, you could pass such functions around, store them in variables, evaluate them at particular arguments, and so forth, just as if it was any other basic data type.
(The caveat may be raised now: Whatever representation your higher-order programming languages uses internally for "functions from natural numbers to bits, it presumably doesn’t allow all such functions to be directly represented; only those functions which are computable. True; but in a strong sense, for most purposes, that’s all you really needed.)
In similar ways, one can represent real numbers using higher-order techniques. For example, one can represent a real number as a pair of an integral part and a function from natural numbers to digits, representing its decimal expansion, in the manner we are all familiar with. Or one could represent a real number as a function which takes in rational numbers as input, and outputs either “I’m higher than this”, or “I’m lower than this”, or just runs forever to signal “I’m equal to this” (this corresponds to the Dedekind cuts you probably learnt about in Intro to Analysis).
An interesting aspect that plays into all this is that various different mathematical definitions of real numbers which are classically equivalent have different computational properties; the things you can computably do with them are different, depending on the representation. [In a sense which can be made precise, the internal logic of “the computable world” is not classical logic, but rather a so-called intuitionistic logic]. For example, with the Dedekind-cut representation, addition is easy, but with the decimal-expansion representation, it’s not generally possible to carry out addition [suppose you were adding two digit streams, the first of which looked like 0.09999… so far and the second of which looked like 0.0000000… so far . What should the first digit after the decimal point of the output be? You can only make it 0 once you’re sure there’s never going to be a carry, and you can only make it 1 once you’re sure there will be a carry. But if both streams keep going like they are, you’ll never reach such certainty, and thus never know what to output].
Thus, the decimal expansion representation of real numbers is actually not a very good one.
In fact, there are strong topological reasons for this as well: there is a field called “domain theory” in which computer datatypes are associated with topological spaces, in such a way as that a nice correspondence is set up between computability and continuity of functions. According to domain theory, a countably infinite series of digits corresponds to a countably infinite product of discrete spaces with ten elements; this is homeomorphic to Cantor space, but not homeomorphic to the real numbers. On the other hand, the above-described Dedekind cut datatype would correspond to a topological space which is homeomorphic to the real numbers, and thus would work well for representing them (for this, it is crucial that we use running forever as the indicator of “I’m equal to this rational number”, rather than requiring an actual return value indicating this).
Anyway, I’m just rambling now, so I’ll cut it short, but perhaps I’ve touched on some interesting ideas of use to you.