I would speak to your professor before I filed a formal complaint. I would be calm, and tell him exactly what you've stated here. His behavior is unprofessional. You can always file a complaint with the school. I would keep it short, objective, and to-the-point (don't need a 3-page complaint with every detail -- administration won't really go beyond the first few points.)
This is an old story ... we've all encountered good & bad teachers. Sometimes, the "bad" experiences/teachers really shape our lives in ways we can't even imagine. After being out of school for over 15 years, I had the most insane A&P instructor -- for example if the cranial nerves were completely correct -- numbers/what they did/correct spelling
-- if they were't written in ROMAN NUMERALS -- then you would get no credit for the answer. Very OCD. Hated her class ... didn't like her as a professor or person. But she set me up to succeed in any other class -- every class -- including advanced physiology, statistics, etc. -- were a piece of cake after dealing with her. She told me, the first day of class, to drop out because I would never pass the class having been out of school for so long.
Fast forward -- got A's in her classes & ended up working as a student tutor the following year. You don't have to like your teacher ... but you should expect to be treated with respect by your teacher -- whether you are a child or an adult. By the way, congratulations on the B in math. B is ABOVE average -- and you should be proud.
Remember -- whether you speak to your professor or the dean -- keep your emotions in check -- present the facts -- keep it simple. Hostile learning environments are not condusive to learning. Hang in there.