<div dir="ltr"><div><div><div><div>I am trying to grovel the value of HUGE_VAL from math.h. This:<br><br></div>(constant (huge-val "HUGE_VAL") :type double-float)<br></div><div><br></div>doesn't work, presumably because HUGE_VAL isn't a proper float on my system (but rather some special positive infinity double float). I get this error:<br>
<br>The value NLOPT::INF is not of type REAL.<br><br></div>I need to use HUGE_VAL in the arguments in my NLOpt bindings (hence the package name in NLOPT::INF, though I don't think I even typed INF into the system). I believe that I can't use, say, most-positive-double-float, as there is special behavior when the value HUGE_VAL is used, i.e. it isn't just a large number.<br>
<br></div>Interestingly, I can grovel HUGE_VAL as an integer with value 18446744073709551615 which, presumably, if I used the ieee-floats system:<br><br>(ieee-floats:decode-float64 18446744073709551615) == HUGE_VAL<br><br>
However, I'm not sure of that and that form naturally produces an overflow error. This is a value that cannot actually be represented as a float, after all. Anyway, I'm not sure that this helps me as I have to pass it to a function that expects a double (actually I pass it as an element in an array of doubles that gets passed to the function):<br>
<pre>nlopt_result nlopt_set_lower_bounds(nlopt_opt opt, const double* lb);<br></pre><div><div>So, I think I need to hold the sizeof(double) bytes in memory (whatever the value of HUGE_VAL is) so that I can write it out to an array later. This is doable, but I am having trouble figuring out the syntax to have the groveler automate the task of getting those sizeof(double) bytes in the first place.<br>
</div><div><br>Is there a way to deal with this? Even better, is there a way that CFFI makes this much simpler so I can just pass define whatever holds HUGE_VAL as an opaque object that can be used as a double? Even better yet, the value of HUGE_VAL provided by CFFI already and I am just not seeing it?<br>
<br></div><div>Thanks for reading, any help is appreciated,<br></div><div>Zach<br><br></div></div></div>