The number 40 appears often in Scripture, usually in context with 'judgment' or 'testing'. Of course, it's still to be taken literally ('forty days' is 'forty days'). But it seems that God has chosen this number to emphasize times of trouble and/or hardship.
In the Old Testament:
God destroyed the earth with a great flood ... The rain fell upon the earth for forty days and forty nights. (Genesis 7:12)
After killing an Egyptian, Moses fled to a desert region ... After forty years had passed, an angel appeared to him in the wilderness of Mount Sinai, in the flame of a burning thorn bush. (Acts 7:30)
He communed with God on Mount Sinai ... Moses was on the mountain for forty days and forty nights. (Exodus 24:18)
Moses interceded on Israel’s behalf ... Then I fell down before the Lord like the first time, for forty days and nights; I neither ate bread nor drank water, because of all your sin which you had committed by doing what was evil in the sight of the Lord, to provoke Him to anger. (Deuteronomy 9:18)
The Law specified a maximum number of lashes a man could receive for a crime ... Forty blows he may give him and no more, lest he should exceed this and beat him with many blows above these, and your brother be humiliated in your sight. (Deuteronomy 25:3).
The Israelites wandered that long ... And you shall remember that the Lord your God led you all the way these forty years in the wilderness, to humble you and test you, to know what was in your heart, whether you would keep His commandments. (Deuteronomy 8:2)
Those who Moses selected to spy out Canaan ... And they returned from spying out the land after forty days. (Numbers 13:25)
(the number 40 also appears in the prophecies of Ezekiel and Jonah)
In the New Testament:
Before Jesus was tempted in the wilderness ... And when He had fasted forty days and forty nights, afterward He was hungry. (Matthew 4:2)
Between Christ's resurrection and ascension ... After his suffering, he presented himself to them and gave many convincing proofs that he was alive. He appeared to them over a period of forty days and spoke about the kingdom of God. (Acts 1:3)
**********
The Word of God definitely seems to use the number 40 to press home the gravity of a certain situation, but nowhere in the Bible do we find an 'assigned' meaning.
Some place great significance on 'numerology' as a method of study ... a rather 'highbrow' attempt to uncover hidden truth (a 'grasping at straws', of sorts).
The Holy Spirit reveals all we need to know ... All Scripture is God-breathed and is useful for teaching, rebuking, correcting, and training in righteousness, so that the servant of God may be thoroughly equipped for every good work. (2 Timothy 3:16-17)
Having said that ... the number 40 was still an interesting subject to explore.