The piece function is defined as following:

Here is the code snippet:
\pgfmathdeclarefunction{func}{1}{%
\pgfmathparse{%
(and(#1>=0 , #1<=500) * (300 + #1*(12/10)) +%
(and(#1>500, #1<=1000) * (600 + #1*(12/10)) %
}%
}
What does the asterisk "*" right after the (and.. actually do? and the "+" sign at the end. I reused some the examples that I found in this site, but the syntax is not really intuitive. Could anyone explain this syntax? Thanks in advance.
Edit (Add complete example)
\documentclass[10pt,letterpaper]{article}
\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{polynomial}
\usepackage{layouts}
\usepackage{enumerate}
\usepackage{syntax}
\usepackage{gensymb}
\usepackage{cancel}
\usepackage{calc}
\usepackage{xcolor}
\usepackage[version=0.96]{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,automata,backgrounds,petri,positioning}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{decorations.fractals}
\usetikzlibrary{decorations.footprints}
\usetikzlibrary{shadows}
\usetikzlibrary{calc}
\usetikzlibrary{spy}
\usetikzlibrary{matrix}
\usepackage{tikz-qtree}
\usepackage{pgfplots}
\begin{document}
\pgfmathdeclarefunction{func}{1}{%
\pgfmathparse{%
(and(#1>=0 ,#1<=500) * (300 + #1*(12/10)) +%
(and(#1>=500 ,#1<=1000) * (600 + #1*(12/10)) %
}%
}
\begin{tikzpicture}[scale=0.8]
\begin{axis}
[title={$C(x)$},
ylabel=$y$,
xlabel=$x$,
grid=both,
minor xtick={0,100,...,1000},
xtick={0,200,...,1000},
ytick={0,400,...,3200}]
\addplot[blue,domain=0:1000]{func(x)};
\end{axis}
\end{tikzpicture}
\end{document}

and(...)returns 1 when the condition inside is true and 0 when false;*denotes multiplication. So, when#1is for instance 100, you're doing1*(300+100*(12/10))+0*(600+100*(12/10))which is what's expected. When#1is 700, the zero and one are reversed. – egreg Oct 21 '12 at 22:19samples=2improving the computation time and the file size. – Luigi Oct 22 '12 at 08:41