General > Frequently Asked Questions

Managing IEEE Floating Point Numbers

<< < (2/2)

support:
Sorry, but you will have to use MID$ to remove the sign.


A# = 240.50000
A$ = STR$(A#,-2)
SETLCD 1,1, A$

A$ = MID$(A$, 2, LEN(A$)-1)
SETLCD 2,1, A$


BC SYSTEMS:
Ok Thanks

garysdickinson:
Marcus,

I was having problems formatting negative floating point values with str$(x#,n).

This code shows a similar usage of mid$ to swap a "+" for a "-".


   ' print float with 2 decimal points of accuracy
   '
   if (i# < 0.0)
      A$ = str$(-i#,-2)
      A$ = "-" + mid$(A$,2,len(A$)-1)  
      print #2 A$
   else
      print #2 str$(i#,-2)
  endif
[/font][/color]
Best regards,

Gary d

BC SYSTEMS:
Thanks Gary,

I'll give that a try!

Cheers

Marcus

Navigation

[0] Message Index

[*] Previous page

Go to full version