Shop OBEX P1 Docs P2 Docs Learn Events
Any ideas on running the float32 object? — Parallax Forums

Any ideas on running the float32 object?

Zap-oZap-o Posts: 452
edited 2010-03-16 12:35 in Propeller 1
I don't understand why I cant get the truncate to work using the Float32 object. Its identical to the Round function as far as I can tell. In wiki the truncation is to the right of the decimal not rounding.

Also what is the Frac, Fmin do? Is there any directions to this object?

Thanks in advance

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-03-12 21:41
    There's a PDF document included in the Float32Lib download from the Object Exchange. That and any comments in the source code make up the documentation.

    "Frac" returns the fractional part of a floating point value.

    "Fmin" returns the minimum of two floating point values as shown on page 5 of the PDF file
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-03-12 23:12
    I've attached a FloatMath pdf. I'm not sure this is what Mike was talking about, though.

    Hope that helps.
  • ManAtWorkManAtWork Posts: 2,178
    edited 2010-03-13 10:40
    Mike said...
    "Fmin" returns the minimum of two floating point values
    Hello Mike,

    stupid question, but why can't we simly use the ># spin operator? Well, actually the question ist not so stupid, I'll explain... As·mentioned in the wiki article about IEEE-754, floatingpoint numbers have "lexicographical ordering". That means sign and exponent are in the most significat bits. If the floating point values a and b are ordered a<b then their cast-to-integer values (the same bit pattern interpreted as integer) are also ordered a<b (only exceptions are NaN and negative zero).

    So in theory we could use all compare and limit-to operators of spin for float values, also. I do this frequently and it seems to work as expected. Are there any objections against doing so?

    Cheers
  • Zap-oZap-o Posts: 452
    edited 2010-03-16 12:35
    I hate to be the one to point this out, but the directions mention nothing except clock cycles.
Sign In or Register to comment.