François Van Emelen wrote:
> They have to same limitations as 'print'; '9,876,543,210.00'
> (floating point) can't be displayed correctly with them and that's 
> what I want to be available, a way to display the value 
> 9876543210.00 as  9876543210.00 not as 9.87653954E9

Just a doodle, quick and dirty, but it might do what you want, all in
simple SBasic. Of course you will not gain a single bit of precision
this way.

100 DEFine FuNction Value$(V)
110 V$ = V
120 EP = 'E' INSTR V$
130 IF EP = 0 THEN
140   IF V$(1) = "." THEN V$ = "0" & V$
150 ELSE
160   E = V$(EP + 1 TO)
170   V$ = V$(1 TO EP - 1)
180   IF E < 0 THEN
190     V$ = "0." & FILL$("0", -E - 1) & V$(1) & V$(3 TO)
200   ELSE
210     V$ = V$(1 TO EP - 1)
220     IP = '.' INSTR V$
230     IF IP = 0 THEN
240       I$ = V$: F$ = ""
250     ELSE
260       I$ = V$(1 TO IP - 1)
270       F$ = V$(IP + 1 TO)
280     END IF
290     IF E > LEN(F$) THEN
300       F$ = F$ & FILL$("0", E - LEN(F$))
310     END IF
320     V$ = I$ & F$(1 TO E)
330     IF E + 1 < LEN(F$) THEN
340       V$ = V$ & '.' & F$(E + 1 TO)
350     END IF
360   END IF
370 END IF
380 IP = '.' INSTR V$
390 IF IP = 0 THEN IP = LEN(V$) + 1
400 FOR E = IP - 4 TO 1 STEP -3
410   V$ = V$(1 TO E) & "," & V$(E + 1 TO)
420 END FOR
430 RETurn V$
440 END DEFine

Marcel

_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to