As electric bass guitars are tuned one octave lower than regular electric guitars, I can't understand why they are only slightly longer. I would think that an octave lower means strings of double length, so that a bass guitar would have about the size of a double-bass.
Electric bass strings are much thicker, hence heavier, than electric guitar strings - this allows them to sound at a much lower frequency without needing double the length. (Guitars have scale lengths in the region 24-25 inches, electric basses around 30-34 inches depending on the style. The thickest guitar strings are usually a single steel core with a wire wrapping; the bass strings I've seen have a core and two layers of wire wrapping.)
On the other hand the double bass was traditionally strung with thick gut strings wrapped with wire. This is not as dense as electric strings, so they have always needed a long scale length (at least 40-41 inches).
Double bass strings can be had in all-wire these days, but the scale length has become established. (The overall size of the body contributes to their sound, so they've remained the same size.)
Let's get specific:
The scale lengths of these instruments are, typically:
Upright bass: 41.5 inches or 105.4cm
Bass guitar: 34 inches or 86.36 cm
Electric guitar: 25.5 inches or 64.8 cm
(There are of course exceptions among different models of these instruments)
The upright bass and the acoustic guitar are many centuries old. The dimensions and scale length for the upright bass and for the acoustic guitar have remained rather constant for centuries.
The electric bass guitar, in contrast, was invented and came to market in 1951, so it is scarcely 60 years old.
The upright bass is played in an upright position. The arm and hand can move up and down in a vertical direction and can accommodate the 105.4cm scale length.
However, the electric bass guitar is slung over the shoulder and is played in the horizontal position. The average human being could not play such an instrument if it had a 105.4cm scale length because the person's arms would not be nearly long enough!
Leo Fender, the inventor whose model for the electric bass guitar in 1951 set the precedent for everything that came after that, settled on 34 inches as the scale length for the electric bass guitar because he believed it was the longest scale length that the average person's arms and hands could play in that position. He then designed custom strings of the necessary thickness and tension to produce the desired pitches for an instrument of that scale length.
In 1951, the technology for creating wound steel strings existed to the degree that it was possible to design the dimensions of the instrument first and then build an entirely new specification of strings that would accommodate that scale length.
Photograph showing the multiple layers of wrapped steel wire used to construct a low B string for a 5-string bass guitar; a very thick string that can be tuned to a low pitch. Source http://www.frudua.com/bass_strings.htm
The upright bass and the guitar are the scale lengths that they are because those instruments evolved in much earlier eras (hundreds of years earlier) when the technology for making strings was not so advanced. In those earlier centuries, strings were made of sheep gut with a bronze wire wrapped around them for the lower notes. So however the scale lengths of the upright bass and the guitar were settled upon, it was an evolutionary process in instrument design over many decades. Those instruments have retained their scale lengths largely due to centuries of tradition, despite the fact that the technology for designing and building strings is much more versatile today.
The electric bass guitar, however, emerged full-fledged at once with Fender's design. Since 1951 there have been variations on the design of the electric bass guitar, to be sure, but it is remarkable how close the most popular and successful designs for bass guitars are to Fender's original. The 34-inch scale length remains the most popular scale length for the electric bass, by far.
You'd think so, yes. However, the standard length was conjured up by a certain Mr. Fender, and the strings basically follow on from the guitar length and gauge. Since the top string of a bass guitar (G) is slightly higher in pitch than the lowest on a guitar, but slightly longer, to get a similar tension, it's about the same gauge. Average bottom string on guitar - say .048. Average top bass guitar string - say .040. To have a string the length of a double bass string, it would only be possible to play with extraordinarily long arms - or upright! The bottom (E) string on an average bass guitar is around .100, so is about twice the diameter and about the same tension as a bottom guitar string with a pitch twice as high. So it all works out pro rata, approximately.
For the science nerds: http://hyperphysics.phy-astr.gsu.edu/hbase/waves/string.html
The resonant frequencies of the string are a function of its length and the "wave velocity". The later one describes how fast mechanical waves can travel along the string. It's a function of tension and "mass per unit length".
The longer, heavier and floppier the string: the lower the note. There are three variables to play with: length, weight-per-length, and tension.
You should look at the overall size of these instruments separately from their "scale length": the measure of the string from the bridge to the nut.
If you look at a bass guitar, note that the bridge is close to the end of the instrument. This is not the case on a double bass. The bridge is a wooden piece held by string pressure against body, and is approximately in the middle of the body. The body adds to the length of the instrument. (It is needed in order to provide a resonant cavity for bass notes, something that an electric bass doesn't need.)
The position of the bridge closer to the end of the body also explains why typical basses are not that much longer than typical guitars: it's sort of an optical illusion. There are compact guitars which use the same trick: like the venerable old Hohner Steinbergers and various travel and exotic guitars.
Scale length is the key: look at the size of the vibrating portion of the string of the instrument, and how it fits into the geometry of the whole instrument.
Stringed bass instruments do need longer scale lengths. Or, we can simply look at a piano or harp: the bass strings are not thicker but longer. Because they are thicker, they don't have to be that much longer.
The fundamental frequency of a vibrating string is related to its tension, mass and length. Tension is approximately a given: we want the strings in an instrument to have about similar tension: you wouldn't want 50 pounds in one string, and 5 in another. So to obtain lower notes we can play with linear density (mass per unit length) of the string (making it thicker), or we can make it longer. If you just make a string longer without changing its tension or thickness, then you have to double its length in order to drop an octave! If you just make a string thicker, you have to make it twice as thick (four times as massive) to drop an octave due to the quadratic relationship between frequency and mass. A combination of these two: somewhat longer and somewhat thicker, works best.
So, because the strings on a bass guitar are not that much longer than those of a guitar, thanks to their thickness, and a trick is played with the position of the bridge, the overall length of the instrument isn't that much greater.