# Print all decimals [duplicate]

You must write a program or function that will output all decimals with the specified precision if run forever. Example:

### Input:

2


### Output:

0.01, -0.01, 0.02, -0.02, 0.03, -0.03...


The input is the number of decimal places to print. The output is all the numbers with the specified decimal precision (if run forever). It will not output 0.

This challenge has much in common with Print all integers, and the rules are the same:

• The output must be in decimal, unless your language does not support decimal integer (in that case use the natural representation of integers your language uses).
• Your program has to work up to the numbers with the biggest magnitude of the standard integer type of your language.
• Each integer must be separated from the next using any separator (a space, a comma, a linebreak, etc.) that is not a digit nor the negative sign of your language.
• The separator must not change at any point.
• The separator can consist of multiple characters, as long as none of them is a digit nor the negative sign (e.g. , is as valid as just ,). Any supported integer must eventually be printed after a finite amount of time.

### But one more additional rule:

• Your submission must support the highest input value / precision possible for floating point arithmetic. You don't have to handle input value beyond that.

4

-0.0001 0.0001 -0.0002 0.0002 -0.0003 0.0003...


Note that there can be multiple valid outputs,

0.0001 0.0002 0.0003 -0.0001 -0.0002 -0.0003 0.0004 0.0005 0.0006 -0.0004 -0.0005 -0.0006...


is valid for that last example.

The ellipsis (...) means more input will follow.

• In your output it is not obvious when 0 would be printed – Digital Trauma Apr 27 '17 at 23:29
• "unless your language does not support decimal integer (in that case use the natural representation of integers your language uses)"..."Any supported integer must eventually be printed after a finite amount of time." - copy-paste? – Jonathan Allan Apr 27 '17 at 23:32
• It looks like you can just print all the integers, dividing each by 10^n. Is this sufficiently different a challenge? – xnor Apr 27 '17 at 23:36
• I think this is close enough to be considered a dup. In languages that support non-integers, I think the answers will mostly be trivially similar. I won't cast my code-golf dup-hammer vote yet though - lets see what others think... – Digital Trauma Apr 27 '17 at 23:36
• I think you need to define "precision" 0.0001 having precision 4 suggests to me that the meaning is number of decimal places (in this case, shouldn't 0.0000 be printed? What is different between one of four and zero of four?), What about 1.0001? – Jonathan Allan Apr 27 '17 at 23:44

i=scan();j=1;while(TRUE){l=j/(10^i);j=j+1;cat(l,-l," ")}