Displaying 2 results from an estimated 2 matches for "printpossibletips".
2015 Oct 05
2
Swift to IR, generates wrong IR
...Double
let subtotal: Double
// 3
init(total: Double, taxPct: Double) {a
self.total = total
self.taxPct = taxPct
subtotal = total / (taxPct + 1)
}
// 4
func calcTipWithTipPct(tipPct: Double) -> Double {a
return subtotal * tipPct
}
// 5
func printPossibleTips() {
print("15%: \(calcTipWithTipPct(0.15))")
print("18%: \(calcTipWithTipPct(0.18))")
print("20%: \(calcTipWithTipPct(0.20))")
}
}
// 6
let tipCalc = TipCalculator(total: 33.25, taxPct: 0.06)
tipCalc.printPossibleTips()
2015 Oct 05
2
Swift to IR, generates wrong IR
...self.total = total
>> self.taxPct = taxPct
>> subtotal = total / (taxPct + 1)
>> }
>>
>> // 4
>> func calcTipWithTipPct(tipPct: Double) -> Double {a
>> return subtotal * tipPct
>> }
>>
>> // 5
>> func printPossibleTips() {
>> print("15%: \(calcTipWithTipPct(0.15))")
>> print("18%: \(calcTipWithTipPct(0.18))")
>> print("20%: \(calcTipWithTipPct(0.20))")
>> }
>>
>> }
>>
>> // 6
>> let tipCalc = TipCalculator(total: 33....