Have a look at the variance of your results.  For things this small, you need maybe 1e5 trials rather than 30.

But then again, what are you testing?  The interpreter starts with a character string.  It then has to

1. break the string into words
2. assign a type and value to each word
3. parse the word list, creating executable fragments
4. execute the fragments

I say that nothing you get from this analysis will be of any value when you are executing from an explicit or tacit verb.

Henry Rich


On 6/24/2020 10:36 PM, Julian Fondren wrote:
On 2020-06-24 20:41, 'Bo Jacoby' via Programming wrote:
Is

   _0.5+0.5+4r5
0.8



the smarter way to convert 4r5 into 0.8 ?

here are some options sorted by speed in j902, though
with a narrow benchmark:

   ops =: }: LF splitstring 0 : 0
_0.5+0.5+4r5
+/ _0.5 0.5 , 4r5
x:inv 4r5
_1 x: 4r5
]&.(+&0.5) 4r5
)
   (". each ops) , ops ,: times=: 30&timex each ops
+------------+-----------------+----------+---------+--------------+
|0.8         |0.8              |0.8       |0.8      |0.8 |
+------------+-----------------+----------+---------+--------------+
|_0.5+0.5+4r5|+/ _0.5 0.5 , 4r5|x:inv 4r5 |_1 x: 4r5|]&.(+&0.5) 4r5|
+------------+-----------------+----------+---------+--------------+
|6.63333e_6  |4.86667e_6       |1.23333e_6|6e_7     |1.53333e_6 |
+------------+-----------------+----------+---------+--------------+
   > ops {~ /: times
_1 x: 4r5
x:inv 4r5
]&.(+&0.5) 4r5
+/ _0.5 0.5 , 4r5
_0.5+0.5+4r5
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


--
This email has been checked for viruses by AVG.
https://www.avg.com

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to