I'm going to guess its impossible to get f 3.120 --> 3 (decimal places) because 
of:

   ] 3.12
3.1200000000000001

this verb seems better than m12 in 
C:\j601\system\extras\help\phrases\representations.htm

decimals=: (] i. 1:)@: (]= <.) @: (( 10^i.13) * ]) NB. max 13 decimal places 
hard coded.

m12=: <.@(10&^.)@(('.'&~: # ]) &.": % ])

   m12 3.212
16
    decimals 3.212
3

the decimals verb can get a bit flakey with high input, but its ok for 
currencies

   decimals 134.9999999999
10
   decimals 131324.9999999999
0

----- Original Message ----
From: Pascal Jasmin <[EMAIL PROTECTED]>
To: Programming forum <[email protected]>
Sent: Saturday, November 18, 2006 12:43:24 PM
Subject: Re: [Jprogramming] decimal conversions

I would like a verb f such that f returns a literal that is exactly the number 
that was typed.  ie:

    f 3.12
3.12
    f 3.120
3.120

    ": 3.12
3.1200000000000001
   

I need this info to simply count the number of decimals given, so if there is 
an alternate way of doing this, and the above is impossible, then help is 
appreciated.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to