Qualified (Restricted Range) Floating Point Numbers - Long Term

It would be good to be able to qualify a floating point numbers as non-negative, what you could almost call a ureal(w). It would help in a static analysis and in some places aid optimization.

Similarly, optimization may benefit by being able to define a number as finite although I am not too enamored with this concept. While it would aid optimization, it is really tough to verify correctness or that the assumption is actually valid (or guaranteed) programmatically, even if some attempts have been made.

Related ideas in Alive-FP, LifeJacket, CompCert, CakeML, RealCake, ...

Also see Herbie which is really cool. See lots of stuff along a similar vein in


Just to stimulate conversation, or stir the pot depending on your perspective, some of those ideas are a bit over the top, some are quite practical from a mathematical perspective, even if non trivial from a programming one.

Very low priority. Not trying to make work for anybody in the short term. Raised purely to put the ideas in the Chapel thought space so that subsequent language design and/or optimization decisions do not preclude such ideas.

Hi Damian —

This is a quick response to say that I've seen this post but that I don't expect us to do much about it, practically speaking, in the near-term beyond registering it. My short rationale is that it would require changes to the compiler to support and make use of the types, and (as you know well) we already have plenty of work from floating point users to meet expectations for the floating point types we already support. (I realize that you've put this out as food-for-thought / long-term vision rather than a short-term request).

I think the idea would be more compelling with some toy-sized, but realistically motivated, examples of what having these types in Chapel would permit a user or our compiler to do that it couldn't do today (maybe I'd be able to figure that out myself if I researched the pointers you provide, but I'm not likely to have the time or motivation to do that anytime soon :slight_smile: ).


It was mainly to register it. The fact that you have identified what is needed to be done to the compiler is all that is needed at this stage. If nothing else pops up that implies the same enhancements, this can go in the bin.

I will put together something with examples into the future at which point I will submit a Github issue. But at this stage, it is more a heads-up.