Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
We read data from the file byte by byte into a byte variable of size char or more, while adding them to a variable, for example sum += byte. Preferably into a variable like long long, unsigned long, etc. or in double. If the result is added to double or float, then to reduce accumulation and / or alignment errors, use the Kohan (Kogan) or pairwise summation algorithms (this is just an example).
Maybe they meant it?
perl -le 'use bytes; local $/; $s+=ord $_ for map {split //, $_} <>; print $s' < /path/to/filename
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question