Shop OBEX P1 Docs P2 Docs Learn Events
umFPU3.1 and FloatString...? — Parallax Forums

umFPU3.1 and FloatString...?

JavalinJavalin Posts: 892
edited 2008-12-05 07:39 in Propeller 1
Evening all,

Both of these; the IC and the object say they read/write/etc IEE754 format floating point numbers.· Are they thus "compatible"?

I am trying to use the FPU to perform calculations and then store the raw IEE754 floating point in a LONG variable in the prop, for other cogs to either: 1) decode into a string for screen presentation
2) convert into float*100 for transmission to VB

I want to avoid performing math on the prop, and doing to much math (time constraints) on the FPU - hence the method above.

I've got a reasonable way - just for example the float string values are not quite whats in the FPU.· I.e. for a value in the FPU of 109 Float string gives "110", and for 1024.5 I get "1000" back.

Am I missing something? (or quite a lot!)

Cheers,

James

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-04 19:13
    The floating point objects and the FPUs sold by Parallax all use IEEE754 format floating point. You should get essentially the same values from both. If that's not what's happening, you will need to provide more information like source code and data demonstrating the problem. There may be something small you're doing wrong that's causing the problem. Given the two examples you've shown, it may be an output rounding problem. 109 rounded to 2 significant digits would give 110 and 1024.5 rounded to two significant digits would give 1000.
  • JavalinJavalin Posts: 892
    edited 2008-12-05 07:39
    Mike,

    You were spot on!

    I had "'Fstring.SetPrecision(2)"

    in the code - removed the line and all is good.

    Thanks for your help!!!

    James
Sign In or Register to comment.