For boats you want to use the 2-part pour-in urethane foam. the great stuff would not be a good solution and is far more expensive than the pour-in.
You will need to figure the volume of the chambers under the floor and then go about 10% more to be sure. As mentioned, you will also want to compare the volume of foam and the weight of the boat/engine. Typically you do not need 100% of the weight of the boat for what is known as positive flotation. If the volume under the floor is inadequate though, it would be good to know, so you can put additional flotation elsewhere in the boat.
Also, the foam adds a lot of strength to the boat itself, so long as you use the our-in kind of foam.
Usually flotation foam of the pour-in style gives a 30:1 expansion, when used at a temperature of 80 F. A cubic foot is = to 7.48 gallons. So, a 2 gallon foam 'kit' will yield about 8 cubic feet of foam or about 480 lbs. of buoyancy.
Best to take some measurements of the chambers that are under the decking of the boat and if you know the weight of the boat/engine, that will be useful too.