Shop OBEX P1 Docs P2 Docs Learn Events
Port from OBEX: TrigPack.spin — Parallax Forums

Port from OBEX: TrigPack.spin

ReinhardReinhard Posts: 489
edited 2011-11-21 14:25 in Propeller 1
Hi,

I have ported a part from TrigPack.spin in gcc.
The port is not completed, several functions don't work correct or are not ported currently.

What I can show is the sinus function in first quadrant ( 0 ... 90 degree)
and a multiply / divide demo.

All functions are not well tested, so I can not guarantee for right results in all situations.

If I find time in next days I will complete this.

best regards
Reinhard

Comments

  • jazzedjazzed Posts: 11,803
    edited 2011-11-21 13:33
    Good project. Thanks for your continuing efforts.
  • ReinhardReinhard Posts: 489
    edited 2011-11-21 13:58
    Thanks,
    with ports like this I can improve my knowledge in SPIN language.
    Here I am the absolute newbie.
    Sometimes I see the strength of any SPIN operator, in other cases I find not the C equivalent.
    For example for the Multiply operators * and ** Return low, Return High , I found not a shorter C statement.

    However I prefer C in hobby and work, so it is not really an effort, more a fun.

    best regards,
    Reinhard
  • ersmithersmith Posts: 6,100
    edited 2011-11-21 14:14
    Sometimes I see the strength of any SPIN operator, in other cases I find not the C equivalent.
    For example for the Multiply operators * and ** Return low, Return High , I found not a shorter C statement.

    To get the upper 32 bits of X*Y (which I guess is X**Y in spin) use:
    result = (X * (long long)Y)>>32;
    

    Eric
  • ReinhardReinhard Posts: 489
    edited 2011-11-21 14:25
    Thanks Eric,

    yes with a construct like this, it would be possible to replace the ** spin operator.

    best regards,
    Reinhard
Sign In or Register to comment.