TNT.....: 4 kJ/gram and 7 MJ/liter
Gasoline: 43 kJ/gram and 33 MJ/literEdit: Or, a fair closed-system comparison to a battery would need to include a liquid oxygen tank or similar so you have the two components stored but can control the delivery...
As a stupid example, if we have a high density battery technology that never explodes unless, say, under magnetic forces only seen being produced by magnetars, that's a pretty safe battery.
Interesting discussions about energetics are best had from a distance.
Energy density of gasoline is approximately 44 to 45 megajoules per kilogram.
Energy density of TNT is approximately 4.184 megajoules per kilogram.
https://en.wikipedia.org/wiki/Table_of_explosive_detonation_...
There is a way how to use the energy density of gasoline for explosive purposes, Thermobaric weapons.
"A fuel–air explosive (FAE) device consists of a container of fuel and two separate explosive charges. After the munition is dropped or fired, the first explosive charge bursts open the container at a predetermined height and disperses the fuel in a cloud that mixes with atmospheric oxygen (the size of the cloud varies with the size of the munition). The cloud of fuel flows around objects and into structures. The second charge then detonates the cloud and creates a massive blast wave."
And I'd know because I have to work with this IN ORBIT. I've had this conversation a dozen times in meetings with military and government.