As said in other answers, Float are inexact. Also remember that Visualworks Float default to single precision (about 7 decimal places), if you posfix your float number with letter d, like 5.1d you'll get double precision (about 15 decimal places), less inexact, but still inexact.
One additional source of confusion is that two different Float can print with the same approximate decimal representation in Visualworks.
5.1 squared printString
-> '26.01'
but
5.1 squared = 26.01
-> false
Note that recent Squeak or Pharo prints just enough decimals to distinguish different Float (and reinterpret them unchanged)
5.1 squared
->26.009999999999998
Alternatively, you can use the so called FixedPoint (in VisualWorks, or ScaledDecimals in other flavours) to perform exact operations:
theTestArray := #(1.2s 3 5.1s 7).
self assert: theTestArray squareOfAllElements = #(1.44s 9 26.01s 49).
Also beware of this other trap: a FixedPoint (ScaledDecimals) prints only as many decimals after the fraction point as it was told to, but internally it can hold more (infinitely many).
5.1s1 squared printString
-> '26.0s1'
but
5.1s1 squared = 26.01s2
-> true