Fractional numbersΒΆ

The type of fractional numbers is written F, 𝔽, Frac, or Fractional. The fractional numbers include all the natural numbers (0, 1, 2, …) along with all the positive fractions formed from the ratio of two natural numbers (such as 1/2, 13/7, 56/57, …)

Adding, multiplying, or dividing two fractional numbers yields another fractional number. Trying to subtract two fractional numbers will automatically convert the result to a rational number:

Disco> :type (1/2) * (2/3)
1 / 2 * 2 / 3 : 𝔽
Disco> :type 1/2 - 2/3
1 / 2 - 2 / 3 : β„š

The special sets β„• (natural numbers), β„€ (integers), and β„š (rational numbers) are very common in mathematics and computer science, but the set of fractional numbers 𝔽 is not common at all (in fact, I made up the name and the notation). People usually start with the natural numbers β„•, extend them with subtraction to get the integers β„€, and then extend those again with division to get the rational numbers β„š. However, there is no reason at all that we can’t do it in the other order: first extend the natural numbers β„• with division to get the fractional numbers 𝔽, then extend with subtraction to get β„š. Having all four types in Disco (even though one of them is not very common in mathematical practice) makes many things simpler and more elegant.