-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make floats use CLP(FD) #26
Comments
That's definitely an awesome idea and would certainly be possible with CLP(FD). I do not expect any problems with this approach. You can have However, how about taking it up a notch and aiming even higher? I see basically two very promising options, both of which could be implemented in Brachylog and would provide a rather unique selling point over many other languages even beyond typical golfing languages:
Especially regarding unums, I will help in every way I can to produce a Prolog implementation. Later, we can even move it to the SWI core. See also the unum page by Ulrich Neumerkel, who may also be interested in these developments. |
@triska Rational numbers are available for free, but they present the same problem that low-level arithmetic has as far as I see, e.g. |
@triska As for unums, it would indeed be harder to implement, especially considering that the publications on the subject are relatively sparse and not very extensive (excluding the book which I don't have access to) |
For constraint solving over rational numbers, I recommend CLP(Q) constraints, available as ?- use_module(library(clpq)). true. ?- { 5/6 = X/2 + 1/3 }. X = 1. You are perfectly right to expect more than CLP(Q) constraints should be your default when using rational numbers. |
is this still open for addition? |
Use something like
'float':Mantissa:Exponent
to represent floats in the transpiler and built-ins, so that we can apply constraints on the mantissa and exponent of a floating point number.This could be used to actually model all numbers but I think that would destroy performance on integer arithmetic if it was like that.
@triska would probably have a better idea about whether this is a good idea or not?
The text was updated successfully, but these errors were encountered: