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.

• 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.

marked as duplicate by xnor code-golf StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Apr 27 '17 at 23:47

• 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 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," ")}