IonicWind Software

IWBasic => General Questions => Topic started by: obelisk on December 24, 2020, 01:02:48 PM

Title: STR$
Post by: obelisk on December 24, 2020, 01:02:48 PM
Hi

I searched but can't find a solution.

I am using STR$(B) where B is 50.000
Then I am adding STR$(B) to an Istring but it keeps adding 50
It drops the decimal and trailing zeros

I tried setprecision but it doesn't seem to change the results

Can you point me in the right direction?

Thanks in advance
Title: Re: STR$
Post by: Egil on December 24, 2020, 01:43:28 PM
Hi there,

I ran into the same problem when I started using IWB. Don't remember exactly what I did, but I the solution came after experimenting a litte with formating text output. ( PRINT USING )

Attach a screendump of the UserGuide.



Merry Christmas!

Egil
Title: Re: STR$
Post by: obelisk on December 24, 2020, 03:26:23 PM
Thank you for the reply

I must be missing something.
No matter what I try, I still get only the whole number without the decimal point or trailing zeros.
Title: Re: STR$
Post by: billhsln on December 24, 2020, 05:29:00 PM
Try:

DEF fd="%d-###,###.##":STRING
DEF ftotal:DOUBLE

ftotal = 20.00

PRINT "\t\tTotal $"+USING(fd,ftotal)

Prints:     Total $20.00

Bill
Title: Re: STR$
Post by: obelisk on December 24, 2020, 06:47:55 PM
Thank you!!!