Thanks for all the replies.
I will have to take some time later to analyze the more idiomatic code above
and learn.
I understand my code may not appear to make sense. It's primary purpose is
simply to provide somewhat of a stress test of what I might commonly do in
various methods/functions. I
Very interesting explanation.
As regards Python floats, they are native floats (64 bits long in IEEE 754
format), not arbitrary precision floats. Only integers are in arbitrary
precision. So, I think that the rounding errors are also present in the Python
program.
Quick eureka before I sleep.
The bulk of processing is in the `sum` function for both Python and Nim, as
@Stefan_Salewski you should store the previous result because right now the
algorithm is doing an extra useless pass on `farray`, furthermore this relies
on the initialization of that empty
Hey there,
This would be an idiomatic Nim translation of your program (and the result is
more similar to the Python one).
import os, strutils, times, math, parsecsv, streams
const CsvPath = "./build/EUR_USD_Week1.csv"
# Row: lTid,cDealable,CurrencyPair,RateDateTime,Rate
Unfortunately I can not really understand your code...
But it looks a bit strange for me.
for price in prices:
pcount += 1
farray[pcount] = ((price * price) * ((pcount+1) / prices.len))
pips += price
psum = farray.sum()
Run
In this loop you modi
Hello,
I have some code that I am trying to understand why it is slower than
Python/Numpy. I am not a C programmer and Nim is my first real attempt to learn
a systems level, statically compiled language. But to my understanding Nim
should approach C speeds to a certain extent. If what I present