Mathematical substitution Sometimes it is useful to run a math problem with multiple inputs. The goal of this challenge is to make a program that eases this task.

Number-generating expressions

You must support 3 types of expression:


Single number generator: Very simple, just a literal number
Multi-number generator: A tad more complicated. Thees are surrounded by square brackets ([]). Numbers are comma (,) separated in the expression. Example [-1,2,3.26].
Range generator: This one is surrounded by curly braces ({}). It will have 3 numbers separated by a comma. The format of this expression is {start,stop,step}. start and stop are inclusive.


Rules for evaluation


You must support the order of operations. (https://en.wikipedia.org/wiki/Order_of_operations#Definition)
You don't need to support parenthesis.
Any number of spaces may occur in the expression.
You must support floating point numbers (whatever precision your language defaults to is fine).
Division by 0 results in NaN (not a number).


Your program must support multiplication (*), division (/), addition (+) and subtraction (-).

Output

Each line of output is one of the combinations of the generators. The format is the expression (with the real numbers substituted into it) followed by a equals sign (=) and the result of evaluation. All combinations of the generators must be represented in the output. 

Examples

(&gt;&gt;&gt; denotes input)

&gt;&gt;&gt;3 * [3,2]
3 * 3 = 9
3 * 2 = 6

&gt;&gt;&gt;{1,2,3}
1 = 1 &lt;-- this is because 1 + 3 &gt; the end

&gt;&gt;&gt;{0,2,1} + {0,1,1}
0 + 0 = 0
1 + 0 = 1
2 + 0 = 2
0 + 1 = 1
1 + 1 = 2
2 + 1 = 3

&gt;&gt;&gt;6/[2,3]
6/2 = 3
6/3 = 2

&gt;&gt;&gt;{1.5,2.5,0.5}
1.5 = 1.5
2 = 2
2.5 = 2.5

&gt;&gt;&gt;3-{6,5,-1}
3-6 = -3
3-5 = -2

&gt;&gt;&gt;5/{-1,1,1}
5/-1 = -5
5/0 = NaN
5/1 = 5

&gt;&gt;&gt;4.4 / [1,2.2] + {0,2,1}
4.4 / 1 + 0 = 4.4
4.4 / 1 + 1 = 5.4
4.4 / 1 + 2 = 6.4
4.4 / 2.2 + 0 = 2
4.4 / 2.2 + 1 = 3
4.4 / 2.2 + 2 = 4

&gt;&gt;&gt; [1,2] / 0 + 5
1 / 0 + 5 = NaN
2 / 0 + 5 = NaN


The program needs to be short so I can memorizes it and use it anywhere.

Thanks to @PeterTaylor and @geokavel for helping me with this post in the sandbox
Haskell, 474 362 bytes

The function f takes a string as input and prints the results



g '+'=(+);g '-'=(-);g '*'=(*);g '/'=(\a b-&gt;a*b/b/b)
p[]=[]
p(o:x:y)=[(flip(g o)$n,' ':o:' ':show n)|n&lt;-v]:p r where
    [f,e,s]=z;(z,h)=reads('[':y)!!0;(w,m)=reads(x:y)!!0;(v,r)|x=='['=(z,h)|x=='{'=([f,f+s..e],h)|True=([w],m)
h '}'=']';h x=x
d(a,b)=putStrLn.drop 3$foldl(++)""b++" = "++show(foldl(flip($))0a)
f t=mapM_(d.unzip)$sequence$p(filter(/=' ')$'+':map h t)


tests : 

main=do
    f "4.4 / [1,2.2] + {0,2,1}"
    putStrLn""
    f "[1,2] / 0 + 5"
    putStrLn""
    f "{0,2,1} + {0,1,1}"


output:

4.4 / 1.0 + 0.0 = 4.4
4.4 / 1.0 + 1.0 = 5.4
4.4 / 1.0 + 2.0 = 6.4
4.4 / 2.2 + 0.0 = 2.0
4.4 / 2.2 + 1.0 = 3.0
4.4 / 2.2 + 2.0 = 4.0

1.0 / 0.0 + 5.0 = NaN
2.0 / 0.0 + 5.0 = NaN

0.0 + 0.0 = 0.0
0.0 + 1.0 = 1.0
1.0 + 0.0 = 1.0
1.0 + 1.0 = 2.0
2.0 + 0.0 = 2.0
2.0 + 1.0 = 3.0