I have strange behavior on this function. At some point (when share is 39.0 / 100) cake became more than one on a console, but the assert does not invoke. I attach the log from the console. May be I am absolutely stupid in an implementing of that algorithm, but where am I?

Code:

```
struct IntrestingTask {
func calculate() {
var cake = 1.0
var pupils = 100
var array = [(pipulNumber: Int, amount: Double)]()
var index = 1
var currentpercent = 1.0
while pupils > 0 {
let piece = cake * Double((currentpercent/100))
cake -= piece
print("piece: \(piece), share: \(currentpercent) / 100, decimal: \(Double(currentpercent/100)) cake: \(cake)")
assert(cake < 1)
array.append((index, piece))
index += 1
currentpercent = Double(index)
pupils -= 1
}
let sorted = array.sorted { $0.amount < $1.amount }
// array.forEach { print($0) }
}
}
```

I try to describe the task. It is a school task about pupils and cake. There are 100 pupils and one cake.

First takes 1 percent from the cake. Second takes 2 percent from the reminder and so one. Which pupil takes a biggest piece?

But when I execute same expression in REPL it returns fine.