@@ -64,9 +64,15 @@ pub trait Float:
6464
6565impl Float for f32 {
6666 #[ inline]
67- fn pi ( ) -> Self { core:: f32:: consts:: PI }
67+ fn pi ( ) -> Self {
68+ core:: f32:: consts:: PI
69+ }
70+
6871 #[ inline]
69- fn from ( x : f64 ) -> Self { x as f32 }
72+ fn from ( x : f64 ) -> Self {
73+ x as f32
74+ }
75+
7076 #[ inline]
7177 fn to_u64 ( self ) -> Option < u64 > {
7278 if self >= 0. && self <= :: core:: u64:: MAX as f32 {
@@ -77,21 +83,40 @@ impl Float for f32 {
7783 }
7884
7985 #[ inline]
80- fn abs ( self ) -> Self { self . abs ( ) }
86+ fn abs ( self ) -> Self {
87+ self . abs ( )
88+ }
89+
8190 #[ inline]
82- fn floor ( self ) -> Self { self . floor ( ) }
83-
91+ fn floor ( self ) -> Self {
92+ self . floor ( )
93+ }
94+
8495 #[ inline]
85- fn exp ( self ) -> Self { self . exp ( ) }
96+ fn exp ( self ) -> Self {
97+ self . exp ( )
98+ }
99+
86100 #[ inline]
87- fn ln ( self ) -> Self { self . ln ( ) }
101+ fn ln ( self ) -> Self {
102+ self . ln ( )
103+ }
104+
88105 #[ inline]
89- fn sqrt ( self ) -> Self { self . sqrt ( ) }
106+ fn sqrt ( self ) -> Self {
107+ self . sqrt ( )
108+ }
109+
90110 #[ inline]
91- fn powf ( self , power : Self ) -> Self { self . powf ( power) }
92-
111+ fn powf ( self , power : Self ) -> Self {
112+ self . powf ( power)
113+ }
114+
93115 #[ inline]
94- fn tan ( self ) -> Self { self . tan ( ) }
116+ fn tan ( self ) -> Self {
117+ self . tan ( )
118+ }
119+
95120 #[ inline]
96121 fn log_gamma ( self ) -> Self {
97122 let result = log_gamma ( self . into ( ) ) ;
@@ -103,9 +128,15 @@ impl Float for f32 {
103128
104129impl Float for f64 {
105130 #[ inline]
106- fn pi ( ) -> Self { core:: f64:: consts:: PI }
131+ fn pi ( ) -> Self {
132+ core:: f64:: consts:: PI
133+ }
134+
107135 #[ inline]
108- fn from ( x : f64 ) -> Self { x }
136+ fn from ( x : f64 ) -> Self {
137+ x
138+ }
139+
109140 #[ inline]
110141 fn to_u64 ( self ) -> Option < u64 > {
111142 if self >= 0. && self <= :: core:: u64:: MAX as f64 {
@@ -116,23 +147,44 @@ impl Float for f64 {
116147 }
117148
118149 #[ inline]
119- fn abs ( self ) -> Self { self . abs ( ) }
150+ fn abs ( self ) -> Self {
151+ self . abs ( )
152+ }
153+
120154 #[ inline]
121- fn floor ( self ) -> Self { self . floor ( ) }
122-
155+ fn floor ( self ) -> Self {
156+ self . floor ( )
157+ }
158+
123159 #[ inline]
124- fn exp ( self ) -> Self { self . exp ( ) }
160+ fn exp ( self ) -> Self {
161+ self . exp ( )
162+ }
163+
125164 #[ inline]
126- fn ln ( self ) -> Self { self . ln ( ) }
165+ fn ln ( self ) -> Self {
166+ self . ln ( )
167+ }
168+
127169 #[ inline]
128- fn sqrt ( self ) -> Self { self . sqrt ( ) }
170+ fn sqrt ( self ) -> Self {
171+ self . sqrt ( )
172+ }
173+
129174 #[ inline]
130- fn powf ( self , power : Self ) -> Self { self . powf ( power) }
131-
175+ fn powf ( self , power : Self ) -> Self {
176+ self . powf ( power)
177+ }
178+
132179 #[ inline]
133- fn tan ( self ) -> Self { self . tan ( ) }
180+ fn tan ( self ) -> Self {
181+ self . tan ( )
182+ }
183+
134184 #[ inline]
135- fn log_gamma ( self ) -> Self { log_gamma ( self ) }
185+ fn log_gamma ( self ) -> Self {
186+ log_gamma ( self )
187+ }
136188}
137189
138190/// Calculates ln(gamma(x)) (natural logarithm of the gamma
0 commit comments