Plants have a built-in capacity to do maths, which helps them regulate food reserves at night, research suggests.
UK scientists say they were "amazed" to find an example of such a sophisticated arithmetic calculation in biology.
Mathematical models show that the amount of starch consumed overnight is calculated by division in a process involving leaf chemicals, a John Innes Centre team reports in e-Life journal.
Birds may use similar methods to preserve fat levels during migration.
The scientists studied the plant Arabidopsis, which is regarded as a model plant for experiments.
'Astonished'
Overnight, when the plant cannot use energy from sunlight to convert carbon dioxide into sugars and starch, it must regulate its starch reserves to ensure they last until dawn.
Experiments by scientists at the John Innes Centre, Norwich, show that to adjust its starch consumption so precisely, the plant must be performing a mathematical calculation - arithmetic division.
"They're actually doing maths in a simple, chemical way - that's amazing, it astonished us as scientists to see that," study leader Prof Alison Smith told BBC News.
"This is pre-GCSE maths they're doing, but they're doing maths."
The scientists used mathematical modelling to investigate how a division calculation can be carried out inside a plant.
During the night, mechanisms inside the leaf measure the size of the starch store. Information about time comes from an internal clock, similar to the human body clock.
'Sophisticated'
The researchers proposed that the process is mediated by the concentrations of two kinds of molecules called "S" for starch and "T" for time.
If the S molecules stimulate starch breakdown, while the T molecules prevent this from happening, then the rate of starch consumption is set by the ratio of S molecules to T molecules. In other words, S divided by T.
"This is the first concrete example in biology of such a sophisticated arithmetic calculation," said mathematical modeller Prof Martin Howard, of the John Innes Centre.
The scientists think similar mechanisms may operate in animals such as birds to control fat reserves during migration over long distances, or when they are deprived of food when incubating eggs.