Talk:Write float arrays to a text file

From Rosetta Code

Precision vs decimal places

The majority of the code samples seem to assume precision means number of digits after the decimal point. The task description isn't super clear about this, but it becomes clear when you look at the example output in the task description. Should "incorrect" tags be added to most of the examples?


Is this already covered in File I/O? It doesn't seem to add anything extra. --Mwn3d 23:10, 23 December 2007 (MST)

Agreed. Unless serialization deserves its own category, this task is somewhat superfluous. Even if serialization did get its own category, there are better ways to tackle the subject thoroughly. (And, admittedly, I wouldn't mind seeing the subject tackled, with cross-platform file compatibility being just one interesting aspect.) --Short Circuit 01:29, 24 December 2007 (MST)
  1. This task was created due to the Modularization section in Help:Adding a new programming task. Write float arrays to a text file is a subtask of Measure relative performance of sorting algorithms implementations. Measure relative performance of sorting algorithms implementations depends on writedat(), therefore I could move it there if the subtask ever be perished.
  2. In addition, a blue print of this subtask is an output of numbers with a given number of significant digits, and an output in a format suitable for external plotting program. It is interesting, how it could be accomplished in languages without printf-like expressions.
  3. Concerning redundancy of this task, It is an eternal dichotomy between orthogonal (minimum overlap) and human (rich, superfluous) intefaces in programming, for example, compare interfaces of Python's list object with the Ruby's Array. The former has less then ten non-special methods, at the same time the latter has much more then that. In general, It's a matter of taste or religion which way to choose. Wiki may benefit from both approaches simultaneously. Geka Sua 13:03, 24 December 2007 (MST)

J code March 13th

  1. The J code posted on March 13 does not limit the precision of the formatted numbers as required by the specifications. (I also wish to note that I don't see how the example values provided for this task test the requirement for precision-limitation of the 'x' array. Do they?) --TBH 11:50, 13 March 2008 (MDT)
  2. Yes it does. That's the purpose of the 0 j. bit. EG:
   ": 1.2345678
   0j2 ": 1.2345678

Too precise and not precise enough

I'm not comfortable with the desired output:

  • What's the separator, space or tab? Should the file be fixed- or free- format? It's not clear by just looking at it.
  • On the other hand, it seems silly expect the output will have exactly the same numeric digits. It all depends on the underlying sprintf or equivalent.

I changed the task to leave some freedom on this.

Eoraptor (talk) 15:52, 29 October 2019 (UTC)