I haven't been able to find any information on this, but I think that if someone knows it, it's someone here. I need it for some theoretical knowledge about lambda calculus and compiler optimizations. I'm sorry if this is the wrong stackexchange site, I have been told to go here by some people at stackoverflow.com
How are fractional numbers most effectively encoded in lambda calculus?
1
$\begingroup$
lambda-calculus
1 Answers
0
If you want to encode arbitrary fractions then a common choice is as a ratio of two arbitrary integers: numerator and denominator. In this case one would keep always cancel the gcd of the two integers to keep it in a simple form. One can keep denominator positive and the sign with the numerator or one can split the sign out and have a triple of (sign,numerator,denominator), in which case the numerator and denominator are natural numbers (though try not to divide by zero...)
If by fractional you mean "non-integer" real number then other choices might be a continued fraction representation, or some successive interval approximation, or even a lazy stream of digits.
-
0I do have a way to encode pairs, but the idea is encoding non-integers in a practical way. For example, I could encode integers in pairs, but that wouldn't be useful at all. What WOULD be useful would be to encode them as iteration. The problem is, you can't do that for fractional numbers. – 2011-03-30