Skip to content

Commit 466dd39

Browse files
committed
---
yaml --- r: 56527 b: refs/heads/auto c: cdf4d4b h: refs/heads/master i: 56525: d99f401 56523: 525fb25 56519: dcd6379 56511: 2a461b6 v: v3
1 parent 58e77bd commit 466dd39

File tree

27 files changed

+1310
-1247
lines changed

27 files changed

+1310
-1247
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 8f63f9789b12a69723630ae072b6ba63203ed0f6
17+
refs/heads/auto: cdf4d4bcddc7331239237ff9a667c724836ac4fa
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/libcore/core.rc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,8 @@ pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
104104
pub use iter::{ExtendedMutableIter};
105105

106106
pub use num::{Num, NumCast};
107-
pub use num::{Orderable, Signed, Unsigned, Round};
108-
pub use num::{Algebraic, Trigonometric, Exponential, Hyperbolic};
109-
pub use num::{Integer, Fractional, Real, RealExt};
107+
pub use num::{Orderable, Signed, Unsigned, Integer};
108+
pub use num::{Round, Fractional, Real, RealExt};
110109
pub use num::{Bitwise, BitCount, Bounded};
111110
pub use num::{Primitive, Int, Float};
112111

branches/auto/src/libcore/num/f32.rs

Lines changed: 72 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//! Operations and constants for `f32`
1212
1313
use from_str;
14+
use libc::c_int;
1415
use num::{Zero, One, strconv};
1516
use prelude::*;
1617

@@ -101,8 +102,8 @@ delegate!(
101102
fn sinh(n: c_float) -> c_float = c_float_utils::sinh,
102103
fn tan(n: c_float) -> c_float = c_float_utils::tan,
103104
fn tanh(n: c_float) -> c_float = c_float_utils::tanh,
104-
fn tgamma(n: c_float) -> c_float = c_float_utils::tgamma
105-
)
105+
fn tgamma(n: c_float) -> c_float = c_float_utils::tgamma)
106+
106107

107108
// These are not defined inside consts:: for consistency with
108109
// the integer types
@@ -367,153 +368,154 @@ impl Fractional for f32 {
367368
fn recip(&self) -> f32 { 1.0 / *self }
368369
}
369370

370-
impl Algebraic for f32 {
371+
impl Real for f32 {
372+
/// Archimedes' constant
371373
#[inline(always)]
372-
fn pow(&self, n: f32) -> f32 { pow(*self, n) }
374+
fn pi() -> f32 { 3.14159265358979323846264338327950288 }
373375

376+
/// 2.0 * pi
374377
#[inline(always)]
375-
fn sqrt(&self) -> f32 { sqrt(*self) }
378+
fn two_pi() -> f32 { 6.28318530717958647692528676655900576 }
376379

380+
/// pi / 2.0
377381
#[inline(always)]
378-
fn rsqrt(&self) -> f32 { self.sqrt().recip() }
382+
fn frac_pi_2() -> f32 { 1.57079632679489661923132169163975144 }
379383

384+
/// pi / 3.0
380385
#[inline(always)]
381-
fn cbrt(&self) -> f32 { cbrt(*self) }
386+
fn frac_pi_3() -> f32 { 1.04719755119659774615421446109316763 }
382387

388+
/// pi / 4.0
383389
#[inline(always)]
384-
fn hypot(&self, other: f32) -> f32 { hypot(*self, other) }
385-
}
390+
fn frac_pi_4() -> f32 { 0.785398163397448309615660845819875721 }
386391

387-
impl Trigonometric for f32 {
392+
/// pi / 6.0
388393
#[inline(always)]
389-
fn sin(&self) -> f32 { sin(*self) }
394+
fn frac_pi_6() -> f32 { 0.52359877559829887307710723054658381 }
390395

396+
/// pi / 8.0
391397
#[inline(always)]
392-
fn cos(&self) -> f32 { cos(*self) }
398+
fn frac_pi_8() -> f32 { 0.39269908169872415480783042290993786 }
393399

400+
/// 1 .0/ pi
394401
#[inline(always)]
395-
fn tan(&self) -> f32 { tan(*self) }
402+
fn frac_1_pi() -> f32 { 0.318309886183790671537767526745028724 }
396403

404+
/// 2.0 / pi
397405
#[inline(always)]
398-
fn asin(&self) -> f32 { asin(*self) }
406+
fn frac_2_pi() -> f32 { 0.636619772367581343075535053490057448 }
399407

408+
/// 2.0 / sqrt(pi)
400409
#[inline(always)]
401-
fn acos(&self) -> f32 { acos(*self) }
410+
fn frac_2_sqrtpi() -> f32 { 1.12837916709551257389615890312154517 }
402411

412+
/// sqrt(2.0)
403413
#[inline(always)]
404-
fn atan(&self) -> f32 { atan(*self) }
414+
fn sqrt2() -> f32 { 1.41421356237309504880168872420969808 }
405415

416+
/// 1.0 / sqrt(2.0)
406417
#[inline(always)]
407-
fn atan2(&self, other: f32) -> f32 { atan2(*self, other) }
408-
}
418+
fn frac_1_sqrt2() -> f32 { 0.707106781186547524400844362104849039 }
409419

410-
impl Exponential for f32 {
420+
/// Euler's number
411421
#[inline(always)]
412-
fn exp(&self) -> f32 { exp(*self) }
422+
fn e() -> f32 { 2.71828182845904523536028747135266250 }
413423

424+
/// log2(e)
414425
#[inline(always)]
415-
fn exp2(&self) -> f32 { exp2(*self) }
426+
fn log2_e() -> f32 { 1.44269504088896340735992468100189214 }
416427

428+
/// log10(e)
417429
#[inline(always)]
418-
fn expm1(&self) -> f32 { expm1(*self) }
430+
fn log10_e() -> f32 { 0.434294481903251827651128918916605082 }
419431

432+
/// log(2.0)
420433
#[inline(always)]
421-
fn log(&self) -> f32 { ln(*self) }
434+
fn log_2() -> f32 { 0.693147180559945309417232121458176568 }
422435

436+
/// log(10.0)
423437
#[inline(always)]
424-
fn log2(&self) -> f32 { log2(*self) }
438+
fn log_10() -> f32 { 2.30258509299404568401799145468436421 }
425439

426440
#[inline(always)]
427-
fn log10(&self) -> f32 { log10(*self) }
428-
}
441+
fn pow(&self, n: f32) -> f32 { pow(*self, n) }
429442

430-
impl Hyperbolic for f32 {
431443
#[inline(always)]
432-
fn sinh(&self) -> f32 { sinh(*self) }
444+
fn exp(&self) -> f32 { exp(*self) }
433445

434446
#[inline(always)]
435-
fn cosh(&self) -> f32 { cosh(*self) }
447+
fn exp2(&self) -> f32 { exp2(*self) }
436448

437449
#[inline(always)]
438-
fn tanh(&self) -> f32 { tanh(*self) }
439-
}
450+
fn expm1(&self) -> f32 { expm1(*self) }
440451

441-
impl Real for f32 {
442-
/// Archimedes' constant
443452
#[inline(always)]
444-
fn pi() -> f32 { 3.14159265358979323846264338327950288 }
453+
fn ldexp(&self, n: int) -> f32 { ldexp(*self, n as c_int) }
445454

446-
/// 2.0 * pi
447455
#[inline(always)]
448-
fn two_pi() -> f32 { 6.28318530717958647692528676655900576 }
456+
fn log(&self) -> f32 { ln(*self) }
449457

450-
/// pi / 2.0
451458
#[inline(always)]
452-
fn frac_pi_2() -> f32 { 1.57079632679489661923132169163975144 }
459+
fn log2(&self) -> f32 { log2(*self) }
453460

454-
/// pi / 3.0
455461
#[inline(always)]
456-
fn frac_pi_3() -> f32 { 1.04719755119659774615421446109316763 }
462+
fn log10(&self) -> f32 { log10(*self) }
457463

458-
/// pi / 4.0
459464
#[inline(always)]
460-
fn frac_pi_4() -> f32 { 0.785398163397448309615660845819875721 }
465+
fn log_radix(&self) -> f32 { log_radix(*self) as f32 }
461466

462-
/// pi / 6.0
463467
#[inline(always)]
464-
fn frac_pi_6() -> f32 { 0.52359877559829887307710723054658381 }
468+
fn ilog_radix(&self) -> int { ilog_radix(*self) as int }
465469

466-
/// pi / 8.0
467470
#[inline(always)]
468-
fn frac_pi_8() -> f32 { 0.39269908169872415480783042290993786 }
471+
fn sqrt(&self) -> f32 { sqrt(*self) }
469472

470-
/// 1 .0/ pi
471473
#[inline(always)]
472-
fn frac_1_pi() -> f32 { 0.318309886183790671537767526745028724 }
474+
fn rsqrt(&self) -> f32 { self.sqrt().recip() }
473475

474-
/// 2.0 / pi
475476
#[inline(always)]
476-
fn frac_2_pi() -> f32 { 0.636619772367581343075535053490057448 }
477+
fn cbrt(&self) -> f32 { cbrt(*self) }
477478

478-
/// 2.0 / sqrt(pi)
479+
/// Converts to degrees, assuming the number is in radians
479480
#[inline(always)]
480-
fn frac_2_sqrtpi() -> f32 { 1.12837916709551257389615890312154517 }
481+
fn to_degrees(&self) -> f32 { *self * (180.0 / Real::pi::<f32>()) }
481482

482-
/// sqrt(2.0)
483+
/// Converts to radians, assuming the number is in degrees
483484
#[inline(always)]
484-
fn sqrt2() -> f32 { 1.41421356237309504880168872420969808 }
485+
fn to_radians(&self) -> f32 { *self * (Real::pi::<f32>() / 180.0) }
485486

486-
/// 1.0 / sqrt(2.0)
487487
#[inline(always)]
488-
fn frac_1_sqrt2() -> f32 { 0.707106781186547524400844362104849039 }
488+
fn hypot(&self, other: f32) -> f32 { hypot(*self, other) }
489489

490-
/// Euler's number
491490
#[inline(always)]
492-
fn e() -> f32 { 2.71828182845904523536028747135266250 }
491+
fn sin(&self) -> f32 { sin(*self) }
493492

494-
/// log2(e)
495493
#[inline(always)]
496-
fn log2_e() -> f32 { 1.44269504088896340735992468100189214 }
494+
fn cos(&self) -> f32 { cos(*self) }
497495

498-
/// log10(e)
499496
#[inline(always)]
500-
fn log10_e() -> f32 { 0.434294481903251827651128918916605082 }
497+
fn tan(&self) -> f32 { tan(*self) }
501498

502-
/// log(2.0)
503499
#[inline(always)]
504-
fn log_2() -> f32 { 0.693147180559945309417232121458176568 }
500+
fn asin(&self) -> f32 { asin(*self) }
505501

506-
/// log(10.0)
507502
#[inline(always)]
508-
fn log_10() -> f32 { 2.30258509299404568401799145468436421 }
503+
fn acos(&self) -> f32 { acos(*self) }
509504

510-
/// Converts to degrees, assuming the number is in radians
511505
#[inline(always)]
512-
fn to_degrees(&self) -> f32 { *self * (180.0 / Real::pi::<f32>()) }
506+
fn atan(&self) -> f32 { atan(*self) }
513507

514-
/// Converts to radians, assuming the number is in degrees
515508
#[inline(always)]
516-
fn to_radians(&self) -> f32 { *self * (Real::pi::<f32>() / 180.0) }
509+
fn atan2(&self, other: f32) -> f32 { atan2(*self, other) }
510+
511+
#[inline(always)]
512+
fn sinh(&self) -> f32 { sinh(*self) }
513+
514+
#[inline(always)]
515+
fn cosh(&self) -> f32 { cosh(*self) }
516+
517+
#[inline(always)]
518+
fn tanh(&self) -> f32 { tanh(*self) }
517519
}
518520

519521
impl Bounded for f32 {

0 commit comments

Comments
 (0)