Announcement

Collapse
No announcement yet.

Constant Floats array

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • John Kevin
    commented on 's reply
    No problem either way is fine. Good luck with your project!

  • ch701builder
    replied
    Thanks Kevin,
    Sorry about calling you John, I saw your name as John Kevin, but... I didn't pay attention to your signature.
    With this little example help, I should finish up my >60Kbytes, 8 separate executables files project.
    Thanks again,
    Keith

    Leave a comment:


  • John Kevin
    replied
    Hi Keith,
    No problem. Glad it helped!
    If you still have any questions, don't hesitate to ask

    Best Regards,
    Kevin

    Leave a comment:


  • ch701builder
    replied
    AH HA!
    Thanks John, I can work with that.
    Keith

    Leave a comment:


  • John Kevin
    replied
    Hello Keith,

    You can store the float values on a data line, however
    it will be stored as a string.
    Code:
    #DATA
    byte ETZLat1 "47.98706201\0"
    byte ETZLat2 "46.58196794\0"
    byte ETZLat3 "45.90339392\0"
    
    byte ETZLon1 "-89.56729464\0"
    byte ETZLon2 "-90.41239819\0"
    byte ETZLon3 "-88.0929389\0"
    #END
    If you want to access them through their index, you can use an array to store
    the values.
    Code:
    var ETZLat[3]:= [ETZLat1,ETZLat2,ETZLat3];
    var ETZLon[3]:= [ETZLon1,ETZLon2,ETZLon3];
    You can convert them on their float value when you store them on a 2 word array.
    Code:
    var floatA[2];
    And using the 'flt_VAL' command to convert a string variable to a float variable
    Code:
    flt_VAL(floatA, ETZLat1); 
    flt_PRINT(floatA,"%.5f");
    Kindly refer to the "floating point functions" section of the Diablo16 Internal functions for more information.
    Please take note that the conversion only returns a 32-bit precision.

    I hope this helps.
    Best Regards,
    Kevin

    Leave a comment:


  • ch701builder
    started a topic Constant Floats array

    Constant Floats array

    All, I am needing to use a couple of fixed LAT/LON points. I have tried to use them in the following example

    #DATA
    float ETZLat 47.98706201, 46.58196794, 45.90339392
    float ETZLon -89.56729464, -90.41239819, -88.0929389
    #END

    I can't use BYTE or WORD since they are foat types of variables. I do not get any errors when I compile, but the values I get end up being 0.0000000 no matter what index I use.


    Any suggestions on an array of float values?

    Thanks,
    Keith
Working...
X