Hi Bo,
It looks like that as long as you have a floating type, you have a precision
issue. Even if it seems equivalent to an integer.
(100&*) 4.57 4.34 4.44
457 434 444
+./ (100&*) 4.57 4.34 4.44
2.63185e_11
<. (100&*) 4.57 4.34 4.44
457 434 444
+./ <. (100&*) 4.57 4.34 4.44
1
datatype (100&*) 4.57 4.34 4.44
floating
datatype <. (100&*) 4.57 4.34 4.44
integer
Cheers, bob
> On May 15, 2020, at 23:34, 'Bo Jacoby' via Programming
> <[email protected]> wrote:
>
>
> (100&*)4.57 4.34 4.44
>
> 457 434 444
>
> +./(100&*)4.57 4.34 4.44
> 2.63185e_11
>
> (+./&.(100&*))4.57 4.34 4.44
> 2.63185e_13
>
>
>
> It doesn't work.
> Thanks.
> Bo.
>
> Den fredag den 15. maj 2020 20.58.47 CEST skrev Hauke Rehr
> <[email protected]>:
>
> my 2¢
>
> the result is absolutely correct;
> both Henry Rich and Devon McCormick showed why
>
> If you’re dealing with values with two decimal places
> everywhere, either apply rounding after each operation,
> or (better imho) work on 100-fold values and divide by
> 100 in the very last step of your computation.
>
> you could also define your own data structure but then
> you’re better off using x: in the first place.
>
> Either you want to deal with rationals (x:) or with
> whole numbers (algorithm&.(100&*)).
>
>
> Am 15.05.20 um 17:20 schrieb 'Bo Jacoby' via Programming:
>> The expression
>> 4.57+.(4.34+.4.44)
>>
>>
>> should evaluate like this
>> 4.34+.4.44
>> 0.02
>>
>> 4.57+.0.02
>> 0.01
>>
>>
>>
>> but it does evaluate to
>> 5.39568e_12
>>
>>
>> which is a useless and incorrect result.
>> = is tolerant, why isn't +. ?
>> Thanks.
>> Bo. Den fredag den 15. maj 2020 16.24.10 CEST skrev Henry Rich
>> <[email protected]>:
>>
>> What's wrong with it?
>>
>> 0j19 ": 4.57 4.34 4.44
>> 4.5700000000000002842 4.3399999999999998579 4.4400000000000003908
>>
>> Henry Rich
>>
>> On 5/15/2020 10:17 AM, 'Bo Jacoby' via Programming wrote:
>>> +./4.57 4.34 4.44
>>> 5.39568e_12
>>>
>>> NB. this was not the correct answer. A bug?
>>>
>>> +./x:4.57 4.34 4.44
>>>
>>> 1r100
>>>
>>> NB. this was a work-around
>>> Thanks!
>>> Bo.
>>>
>>>
>>>
>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>>
>
> --
> ----------------------
> mail written using NEO
> neo-layout.org
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm