That's not something that can be resolved by a simple utility that
handles floating point numbers.  So if this is an issue you should
implement something that fits your problem domain.

-- 
Raul

On Tue, Jan 22, 2013 at 1:24 PM, Devon McCormick <[email protected]> wrote:
> A bigger problem might be the slight upward bias in this algo.  It's
> exacerbated if you have a lot of halves in your data:
>
>    rr=. -: 100?@$100
>    usus rr            NB. usus -> usual stats: Min, max, mean, SD
> 0 49.5 27.63 14.7935
>    usus round rr      NB. Higher mean: significant?
> 0 50 27.9 14.7802
>
>    mean&> (round;]) -: 100?@$100
> 22.28 21.975
>    -/mean&> (round;]) -: 100?@$100
> 0.275
>    -/mean&> (round;]) -: 100?@$100
> 0.225
>
>    $100 ([: -: ?@$)&.>100$100
> 100
>
>    usus ([: -/ [: mean&> round ; ]) &> 100 ([: -: ?@$)&.>1e6$100
> 0.13 0.365 0.250008 0.0249975
>    NB. Could be significant...
>
>
> On Tue, Jan 22, 2013 at 12:08 PM, Raul Miller <[email protected]> wrote:
>
>> I don't think that that definition of round can be tacit and use under.
>>
>> A tacit implementation might be:
>>    1&$: : ([ * <.@+~&1r2@%~)
>>
>> Note also: this is a verb, not an adverb. In this definition, 1 is the
>> default value for x, not a control argument for :
>>
>> FYI,
>>
>> --
>> Raul
>>
>> On Tue, Jan 22, 2013 at 11:55 AM, David Ward Lambert
>> <[email protected]> wrote:
>> >    round =: 1&$: : (dyad def '<.@:(1r2+])&.:(%&x) y')
>> >    assert 1 -: round 1.2
>> >    assert 1.25 -: 0.25 round 1.2
>> >
>> >    Round =: adverb def '<.@:(1r2+])&.:(%&m) y'
>> >
>> > Is there a tacit definition of round using under?
>> > What is the tacit definition of adverb Round?
>> > Thanks, Dave.
>> >
>> > ----------------------------------------------------------------------
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
>
> --
> Devon McCormick, CFA
> ^me^ at acm.
> org is my
> preferred e-mail
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to