Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanShushakov committed Nov 28, 2021
0 parents commit d3029e1
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
Cargo.toml
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

145 changes: 145 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
pub trait MyFloatTrait
{
type Other;

fn my_powi(&self, n: i32) -> Self;
fn my_sqrt(&self) -> Self;
fn my_acos(&self) -> Self;
fn my_cos(&self) -> Self;
fn my_sin(&self) -> Self;
fn my_abs(&self) -> Self;
fn my_asin(&self) -> Self;
fn my_atan2(&self, other: Self::Other) -> Self;
fn my_atan(&self) -> Self;
fn my_to_degrees(&self) -> Self;
}


impl MyFloatTrait for f32
{
type Other = f32;

fn my_powi(&self, n: i32) -> Self
{
self.powi(n)
}


fn my_sqrt(&self) -> Self
{
self.sqrt()
}


fn my_acos(&self) -> Self
{
self.acos()
}


fn my_cos(&self) -> Self
{
self.cos()
}


fn my_sin(&self) -> Self
{
self.sin()
}


fn my_abs(&self) -> Self
{
self.abs()
}


fn my_asin(&self) -> Self
{
self.asin()
}


fn my_atan2(&self, other: Self::Other) -> Self
{
self.atan2(other)
}


fn my_atan(&self) -> Self
{
self.atan()
}


fn my_to_degrees(&self) -> Self
{
self.to_degrees()
}
}


impl MyFloatTrait for f64
{
type Other = f64;

fn my_powi(&self, n: i32) -> Self
{
self.powi(n)
}


fn my_sqrt(&self) -> Self
{
self.sqrt()
}


fn my_acos(&self) -> Self
{
self.acos()
}


fn my_cos(&self) -> Self
{
self.cos()
}


fn my_sin(&self) -> Self
{
self.sin()
}


fn my_abs(&self) -> Self
{
self.abs()
}


fn my_asin(&self) -> Self
{
self.asin()
}


fn my_atan2(&self, other: Self::Other) -> Self
{
self.atan2(other)
}


fn my_atan(&self) -> Self
{
self.atan()
}


fn my_to_degrees(&self) -> Self
{
self.to_degrees()
}
}

0 comments on commit d3029e1

Please sign in to comment.