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.
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.
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.
"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.
Commenting on the research, Dr Richard Buggs of Queen Mary, University of London, said: "This is not evidence for plant intelligence. It simply suggests that plants have a mechanism designed to automatically regulate how fast they burn carbohydrates at night. Plants don't do maths voluntarily and with a purpose in mind like we do."