@@ -131,19 +131,28 @@ for ( i = 0; i < 100; i++ ) {
131
131
Returns a single-precision complex floating-point number with the same magnitude as ` z ` and the sign of ` y*z ` .
132
132
133
133
``` c
134
- #include < complex.h>
134
+ #include " stdlib/complex/float32/ctor.h"
135
+ #include " stdlib/complex/float32/real.h"
136
+ #include " stdlib/complex/float32/imag.h"
135
137
136
- float complex y = stdlib_base_cflipsignf( 2.0 -1.0 *I, -1.0 );
137
- // returns -2.0+1.0*I
138
+ stdlib_complex64_t z = stdlib_complex64( 2 .5f , -1 .5f );
139
+
140
+ stdlib_complex64_t out = stdlib_base_cflipsignf( z, -1 .0f );
141
+
142
+ float re = stdlib_complex64_real( out );
143
+ // returns -2.5f
144
+
145
+ float im = stdlib_complex64_imag( out );
146
+ // returns 1.5f
138
147
```
139
148
140
149
The function accepts the following arguments:
141
150
142
- - ** z** : ` [in] float complex ` input value.
151
+ - ** z** : ` [in] stdlib_complex64_t ` input value.
143
152
- ** y** : ` [in] float ` number from which to derive the sign.
144
153
145
154
``` c
146
- float complex stdlib_base_cflipsignf ( const float complex z, const float y );
155
+ stdlib_complex64_t stdlib_base_cflipsignf ( const stdlib_complex64_t z, const float y );
147
156
```
148
157
149
158
</section>
@@ -166,19 +175,31 @@ float complex stdlib_base_cflipsignf( const float complex z, const float y );
166
175
167
176
```c
168
177
#include "stdlib/math/base/special/cflipsignf.h"
178
+ #include "stdlib/complex/float32/ctor.h"
179
+ #include "stdlib/complex/float32/reim.h"
169
180
#include <stdio.h>
170
- #include <complex.h>
171
181
172
182
int main( void ) {
173
- const float complex x[] = { 3.14f+1.5f*I, -3.14f-1.5f*I, 0.0f+0.0f*I, 0.0f/0.0f+0.0f/0.0f*I };
174
-
175
- float complex v;
176
- float complex y;
183
+ const stdlib_complex64_t x[] = {
184
+ stdlib_complex64( 3.14f, 1.5f ),
185
+ stdlib_complex64( -3.14f, -1.5f ),
186
+ stdlib_complex64( 0.0f, 0.0f ),
187
+ stdlib_complex64( 0.0f/0.0f, 0.0f/0.0f )
188
+ };
189
+
190
+ stdlib_complex64_t v;
191
+ stdlib_complex64_t y;
192
+ float re1;
193
+ float im1;
194
+ float re2;
195
+ float im2;
177
196
int i;
178
197
for ( i = 0; i < 4; i++ ) {
179
198
v = x[ i ];
180
199
y = stdlib_base_cflipsignf( v, -1.0f );
181
- printf( "cflipsignf(%f + %fi, %f) = %f + %fi\n", crealf( v ), cimagf( v ), -1.0f, crealf( y ), cimagf( y ) );
200
+ stdlib_complex64_reim( v, &re1, &im1 );
201
+ stdlib_complex64_reim( y, &re2, &im2 );
202
+ printf( "cflipsignf(%f + %fi, %f) = %f + %fi\n", re1, im1, -1.0f, re2, im2 );
182
203
}
183
204
}
184
205
```
0 commit comments