<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div><span>Thanks for getting back to me., I really appreciate it</span></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span>Using coerce though I'm already casting it to a float on the lisp side...I was wondering if I can cast a 4 to a float with CFFI and have the output be a 4.0f0 like it works in C...without doing anything on the Lisp side<br></span></div><div style="display: block;" class="yahoo_quoted"> <div style="font-family:
HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 10pt;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> On Sunday, March 30, 2014 7:12 AM, Stelian Ionescu <sionescu@cddr.org> wrote:<br> </font> </div> <blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;"> <div class="y_msg_container">On Sun, 2014-03-30 at 06:59 -0700, Joeish W wrote:<br clear="none">> This is the way I thought you did it but I'm running this and it's not<br clear="none">> working: <br clear="none">> <br clear="none">> (with-foreign-object (float :float)<br clear="none">> <br clear="none">> (setf float 6)<br clear="none">>
(type-of float))<br clear="none">> <br clear="none">> >(INTEGER 0 4611686018427387903)<br clear="none">> <br clear="none">> The output says it is an integer<br clear="none">> <br clear="none">> I tried this:<br clear="none">> <br clear="none">> <br clear="none">> (with-foreign-object (float :float)<br clear="none">> <br clear="none">> (setf (mem-ref float :float) 4)<br clear="none">> (type-of (mem-ref float :float)))<br clear="none"><br clear="none">(with-foreign-object (float :float)<br clear="none"> (setf (mem-ref float :float)<br clear="none"> (coerce 4 'single-float))<div class="yqt3910232723" id="yqtfd64008"><br clear="none"> (mem-ref float
:float))</div><br clear="none"><br clear="none">or use the syntax 4.0s0 for a literal single-float(4.0d0 is a literal<br clear="none">double in comparison).<br clear="none"><br clear="none">-- <br clear="none">Stelian Ionescu a.k.a. fe[nl]ix<br clear="none">Quidquid latine dictum sit, altum videtur.<div class="yqt3910232723" id="yqtfd09469"><br clear="none"></div><br><br></div> </blockquote> </div> </div> </div> </div></body></html>