One solution could be putting numbers in form of an array. In Mendix, you can use a non-persistable entity with one decimal attribute to store the number. Now create a list of this entity. Each object holds one decimal numbers.
So , in this case it will be a list of size 3 having 3 numbers.
Sort this list in ascending order so largest number is at end. Now you can calculate smallest difference by
Below is a programmatic version of above algorithm if it may help you
for (let i = 0; i < numbers.length - 1; i++) {
// Only calculate the difference between the next number and the current
const latestDiff = numbers[i + 1] - numbers[i];
// Only keep the diff if it's smaller than any we've seen up to this point
smallestDiff = smallestDiff === null ? latestDiff : Math.min(smallestDiff, latestDiff);
}