Re: RE : number conversion significant digits

From: Anil Rodrigues <arodrix_at_weld.com>
Date: Tue, 16 Dec 2008 08:49:21 -0500

Charles,
thanks for your comments;
I received an off-list email including the following -

--------------------------------------------------------
The fix is simple, just add FROUND :

: REPRESENT ( c-addr u -- n f1 f2 )
   2DUP [CHAR] 0 FILL 2DUP FSIGN? >R FABS
   #EXP DUP >R - 1- >10** DROP FROUND F>D <# #S #>
   ROT 2DUP - >R MIN ROT SWAP MOVE 2R> + 1+ R> -1 ;

Recompile Fpmath.f and that's it. Make sure FPoptions is set
to "round to nearest" rather than "truncate".
--------------------------------------------------------

Cheers! Anil

-----Original Message-----
From: sftalk-bounce_at_forth.com [mailto:sftalk-bounce_at_forth.com]On Behalf
Of Charles Melice
Sent: Thursday, December 11, 2008 4:43 AM
To: sftalk_at_forth.com
Subject: [sftalk] RE : number conversion significant digits

I agree. Zero (0) is not an unsignifiant digit.

The result should be 2345????.

In real application, SET-PRECISION is unusable.
I expect more a SET-DECIMALS word:

        2 SET-DECIMALS
        23456789 ok
        s>f f. 23456789.00 ok

Charles

-----Message d'origine-----
De : sftalk-bounce_at_forth.com [mailto:sftalk-bounce_at_forth.com] De la part de
Anil Rodrigues
Envoyé : mercredi 10 décembre 2008 17:59
À : sftalk_at_forth.com
Objet : [sftalk] number conversion significant digits

Would anyone volunteer whether this is expected behaviour,
if yes why so?

  ok
\ set Options/fpmath options -(disp.format) significant digits = 10: ok
  ok
  ok
23456789 ok
s>f f. 23456789.00 ok
  ok
  ok
\ set Options/fpmath options -(disp.format) significant digits = 4: ok
  ok
23456789 ok
s>f f. 23450000. ok
  ok

Seems to me display format shouldn't make me lose signif. digits?

Cheers! Anil
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com For
list command help, send subject "help" to sftalk-request_at_forth.com Message
archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and
bug reports, please send email to support_at_forth.com
----------------------------------------------------------------------

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and
bug reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Tue Dec 16 2008 - 05:52:42 PST


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 09-Feb-2012. Archive updated nightly.