Shop OBEX P1 Docs P2 Docs Learn Events
Floating Point Library for PropBasic — Parallax Forums

Floating Point Library for PropBasic

Christof Eb.Christof Eb. Posts: 1,237
edited 2011-11-18 05:41 in Propeller 1
Hi PropBasic - Fans,

this is just an adaption of the first Cog part of "F32Full.spin" as a library for PropBasic. Actually I did spend quite a few hours how to include the Pasm - Part into a Basic task - without trying to understand how it works.... It seems to work, but perhaps it is a good idea to wait a little time, if someone finds a bug, before i put into obex.....

A Cog is started as a floating point coprocesssor, the code runs as cog pasm code with maximum speed.

Unfortunately the compiler can not work with float constants? It would be great, if this could be changed....

Of course my dream is, that the compiler could work with longs and floats automaticly...

Have fun, Christof

Comments

  • BeanBean Posts: 8,129
    edited 2011-11-15 03:56
    Christof,
    I'm a little "under the weather" but I will take a look at these as soon as I'm feeling better.

    P.S. I "think" you can using floating point constants if you prefix them with a # as in: value = #1.0

    Bean
  • Christof Eb.Christof Eb. Posts: 1,237
    edited 2011-11-15 11:46
    Bean, get well soon!
    Best Regards, Christof
  • FriedVFriedV Posts: 77
    edited 2011-11-15 19:17
    Hello,
    here is my try at this.
    It is not a library yet, but a main progran running in cog0 and
    a driver for SPI connected to the uM-FPU and a DogM163 3x16 display running in another Cog.
    All written in PropBasic.
    This is work in progress, up to now no provision for errors or special cases, all maths are assumed
    "well behaved". Documentation is also not finalized yet, may contain errors.
    Thanks Bean & Hanno for the tools, btw the display of the float numbers works fine in Viewport.
    To test I have attached a PropPlug to the FPU, on the PC I use http://www.clearconnex.com/content/clearterminal
    to watch the FPU
    FPU_LCD.pbas
    Cheers, Fried
    771 x 800 - 64K
  • HannoHanno Posts: 1,130
    edited 2011-11-15 19:35
    Good job Fried! I really like where PropBasic is going.
    Hanno
  • Christof Eb.Christof Eb. Posts: 1,237
    edited 2011-11-16 11:53
    Hi Fried,
    isn't it interesting, that both of us have started now towards floating point with PropBasic?
    What do you think, is the speed gain of your hardware solution?
    I have read, that um-FPU 3.1 would be based on this:
    http://ww1.microchip.com/downloads/en/DeviceDoc/70139E.pdf, which has the same pinout and a fast 17*17bit hardware- multiply. On the other hand, you need to get the data into and out of it.
    Best regards, Christof
  • BeanBean Posts: 8,129
    edited 2011-11-18 05:41
    Bean wrote: »
    P.S. I "think" you can using floating point constants if you prefix them with a # as in: value = #1.0

    Nope, That doesn't work. But I will work on getting it working for the next release.

    Bean
Sign In or Register to comment.