Explain the decimals Given a decimal in the form of &lt;float&gt;, &lt;precision&gt;, you draw the graphical representation of the decimal part (i.e. fraction) of the float. Examples:


Input: 6.75, 4, output:

6||| 7
 ---- 


6.75 (first number from the input) is the number to explain, 4 (the second number from the input) is the number of dashes below the pipes.  6 is the floored 6.75, 7 is the ceiled 6.75. The number of pipes is the decimal part of first input number * second input number.
Input: 10.5, 6, output:

10|||   11
  ------

Input: 20.16, 12, output

20||          21
  ------------


.16 actually takes 1.92 pipes, but since I can't draw 1.92 pipes, I ceil it to 2.
Input: 1.1, 12, output:

1|           2
 ------------


.1 is 1.2 pipes in this case, so it's floored to 1 pipe.
Also, an edge case. Input: 5, 4 (i.e. the number is an integer), output:

5    6
 ----






The number to explain is the positive float, limited only by your language abilities.
The precision number is an even integer, greater than 2 (i.e. minimal required precision is 4). It can be arbitrary large too.
>= n.5 pipes are rounded up, to n+1 (i.e 1.5 is rounded to 2 and 2.5 is rounded to 3). &lt; n.5 pipes are rounded to n (i.e. 1.4 is rounded to 1 and 2.4 is rounded to 2).
If it would be more convenient for your language, you can take the input as an array, e.g. [6.75, 4]. If you take the input in the reversed order, i.e. [4, 6.75], please specify it in your answer.
CJam, 32 bytes

l~1md@:X*mo'|*XSe]1$)NW$s,S*'-X*


Takes the precision first and the decimal second, separated by a space.

Run all test cases.

Explanation

l~   e# Read input and evaluate, pushing precision and decimal on the stack.
1md  e# Divmod 1, separating the decimal into integer and fractional part.
@:X  e# Pull up precision, store in X.
*mo  e# Multiply precision by fractional part and round.
'|*  e# Push that many vertical bars.
XSe] e# Pad with length X with spaces.
1$)  e# Copy integer part and increment.
N    e# Push linefeed.
W$   e# Copy integer part.
s,   e# Get number of digits as length of string representation.
S*   e# Push that many spaces, to indent the hyphens correctly.
'-X* e# Push X hyphens.