Displaying 2 results from an estimated 2 matches for "tippct".
Did you mean:
tipp
2015 Oct 05
2
Swift to IR, generates wrong IR
...code I try running:
class TipCalculator {
// 2
let total: Double
let taxPct: 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 =...
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%...