(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 
<hauke.r...@uni-jena.de>:  
 
 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 
> <henryhr...@gmail.com>:
>  
>  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

Reply via email to