What is my mistake about binary output

Hello, I have a simple script calculate simple things.
medCalc.rb · GitHub here source code
it gives me binary output but I can’t understand why?
Best Regards.

I don’t understand what you are trying to do in that script. Can you reduce the problem to 2-3 lines, and post them here, showing what you expect and what you get?