]> git.lizzy.rs Git - rust.git/commit
Add a generic power function
authorFlavio Percoco <flaper87@gmail.com>
Sun, 12 Jan 2014 20:02:59 +0000 (21:02 +0100)
committerFlavio Percoco <flaper87@gmail.com>
Fri, 17 Jan 2014 14:41:26 +0000 (15:41 +0100)
commited7e576d9cf807169b17b5a4c572e874e38681cf
tree02b3ccb929e3e47154f754f3a79508fba04bface
parent5fdc81262a5d44f10e335384b5d69b938d6d729c
Add a generic power function

The patch adds a `pow` function for types implementing `One`, `Mul` and
`Clone` trait.

The patch also renames f32 and f64 pow into powf in order to still have
a way to easily have float powers. It uses llvms intrinsics.

The pow implementation for all num types uses the exponentiation by
square.

Fixes bug #11499
doc/guide-tasks.md
src/libextra/num/rational.rs
src/libextra/stats.rs
src/libstd/num/f32.rs
src/libstd/num/f64.rs
src/libstd/num/int.rs
src/libstd/num/mod.rs
src/libstd/rand/distributions/gamma.rs
src/libstd/sync/mpmc_bounded_queue.rs
src/test/bench/shootout-binarytrees.rs