-- programmer: Elizabeth Adams -- Semester/Date: Fall 2006 Sept 28th -- Ada does not allow mixed mode arithmetic. -- This means that -- you can't directly assign an integer to a float -- you can't directly -- add, subtract, multiply or divide an integer and a float -- You can handle this by calling a function to perform a temporary conversion with ada.text_io; with ada.float_text_io; procedure testMixedMode is i : integer; a,c : float; begin i := 5; a := 34.98715; c := a*i; -- illegal - try it and comment it out c := a* float(i); -- solves the problem c := i * 5; -- illegal - try it an comment it out c := float(i*5); -- solves problem i := integer (c); end testFloatOutput; -- "It is a general rule that mixed mode arithmetic is not allowed. -- One cannot, for example, add an integer value to a real value; -- both must be of the same type. A change of type from -- INTEGER to REAL or vice versa can be done by using the -- desired type name ( or indeed subtype name) followed -- by the expression to be converted in brackets " -- p. 46 Programming in Ada, 3rd edition, J.G.P. Barnes