         let learningRate = self.learningRate * 1 / (1 + decay * step)
         // Note: `stepSize` and `secondMoments` are split into two lines to avoid the "compiler is 
         // unable to type-check this expression in reasonable time" error.
-        var stepSize = learningRate * sqrt(1 - pow(beta2, step))
-        stepSize = stepSize / (1 - pow(beta1, step))
+        var stepSize = learningRate * sqrtf(1 - powf(beta2, step))
+        stepSize = stepSize / (1 - powf(beta1, step))
         firstMoments = firstMoments * beta1 + direction * (1 - beta1)
         secondMoments = secondMoments * beta2
         secondMoments += direction .* direction * (1 - beta2)

    public func update(_ model: inout Model, along direction: Model.TangentVector) {
        step += 1
        let step = Float(self.step)
        let beta1Power = pow(beta1, step)
        let beta2Power = pow(beta2, step)
        let learningRate = self.learningRate * 1 / (1 + decay * step)
        // Note: `stepSize` and `secondMoments` are split into two lines to avoid the "compiler is 
        // unable to type-check this expression in reasonable time" error.
        var stepSize = learningRate * sqrt(1 - pow(beta2Power, step))
        stepSize = stepSize / (1 - pow(beta1Power, step))
        firstMoments = firstMoments * beta1 + direction * (1 - beta1)
        secondMoments = secondMoments * beta2
        secondMoments += direction .* direction * (1 - beta2)

    public func update(_ model: inout Model, along direction: Model.TangentVector) {
        step += 1
        let step = Float(self.step)
        let beta1Power = powf(beta1, step)
        let beta2Power = powf(beta2, step)
        secondMoments = beta2 * secondMoments + direction .* direction * (1 - beta2)
        firstMoments = beta1 * firstMoments + direction * (1 - beta1)
        // Compute maximum length SMA, bias-corrected moving average and approximate length.
