Calculations Wrong?

Hi, I am trying to create some sort of a musical calculator so I am using the unity GUI. The calculations I am using work correctly when I do it manually in a calculator but not when I script them. What am I doing wrong?

These work in normal calculators but not the script I am writing.

SecondsToOneBar = (60/Bpm)*BeatsPerBar;

BeatsPerBar = (Bpm/60)*SecondsToOneBar;

However, this works.

Bpm = (60/SecondsToOneBar )*BeatsPerBar;


Your math looks straightforward but you might get surprised by something called integer division. Basically most programming languages will truncate the division of integers to the next lowest integer and not implicitly give you a float. If float division is what you prefer, make sure to cast the denominator to a float first.