Announcement

Collapse
No announcement yet.

set one floating point variable equal to that of another

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

  • set one floating point variable equal to that of another

    if I have

    Code:
    var flt1[2];
    var flt2[2];
    flt_VAL(flt1,"3.1415");
    Is there an easier way to set flt2 = flt1 than

    Code:
    flt_ITOF(flt2, 1);
    flt_MUL(flt2, flt1, flt2);
    And is there a better way to assign a float a constant value, than using the flt_VAL() func?

  • #2
    Can I just use?

    Code:
    *flt2[0] = *flt1[0];
    *flt2[1] = *flt1[1];

    Comment


    • #3
      Hi Calvin,

      You could use this command to copy the contents of one array to another

      mem_Copy(flt2, flt1, 4);

      The number 4 is the amont of bytes that you will copy so as it is a float and each array cell is 2 bytes wide, you need to copy 4 over.

      I hope this helps

      Best regards

      Paul

      Comment


      • calvin.krusen
        calvin.krusen commented
        Editing a comment
        Thanks Paul.

        I'm still getting used to this programming "language"
    Working...
    X