I need the perfect algorithm or C# function to calculate the difference (distance) between 2 decimal numbers.
For example the difference between:
100 and 25 is 75
100 and -25 is 125
-100 and -115 is 15
-500 and 100 is 600
Is there a C# function or a very elegant algorithm to calculate this or I have to go and handle every case separately with ifs.
If there is such a function or algorithm, which one is it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…