@@ -61,10 +61,11 @@ static int _gr_acb_ctx_get_real_prec(slong * res, gr_ctx_t ctx)
6161static int
6262_gr_acb_ctx_write (gr_stream_t out , gr_ctx_t ctx )
6363{
64- gr_stream_write (out , "Complex numbers (acb, prec = " );
65- gr_stream_write_si (out , ACB_CTX_PREC (ctx ));
66- gr_stream_write (out , ")" );
67- return GR_SUCCESS ;
64+ int status = GR_SUCCESS ;
65+ status |= gr_stream_write (out , "Complex numbers (acb, prec = " );
66+ status |= gr_stream_write_si (out , ACB_CTX_PREC (ctx ));
67+ status |= gr_stream_write (out , ")" );
68+ return status ;
6869}
6970
7071static void
@@ -105,60 +106,59 @@ _gr_acb_randtest(acb_t res, flint_rand_t state, const gr_ctx_t ctx)
105106static int
106107__gr_acb_write (gr_stream_t out , const acb_t x , slong digits , int flags , const gr_ctx_t ctx )
107108{
109+ int status = GR_SUCCESS ;
110+
108111 if (arb_is_zero (acb_imagref (x )))
109112 {
110113 /* used by polynomial printing */
111114 if (arb_is_exact (acb_realref (x )))
112115 {
113116 if (arf_is_zero (arb_midref (acb_realref (x ))))
114117 {
115- gr_stream_write (out , "0" );
116- return GR_SUCCESS ;
118+ return gr_stream_write (out , "0" );
117119 }
118120 else if (arf_is_one (arb_midref (acb_realref (x ))))
119121 {
120- gr_stream_write (out , "1" );
121- return GR_SUCCESS ;
122+ return gr_stream_write (out , "1" );
122123 }
123124 else if (arf_equal_si (arb_midref (acb_realref (x )), -1 ))
124125 {
125- gr_stream_write (out , "-1" );
126- return GR_SUCCESS ;
126+ return gr_stream_write (out , "-1" );
127127 }
128128 }
129129
130- gr_stream_write_free (out , arb_get_str (acb_realref (x ), digits , flags ));
130+ status |= gr_stream_write_free (out , arb_get_str (acb_realref (x ), digits , flags ));
131131 }
132132 else if (arb_is_zero (acb_realref (x )))
133133 {
134- gr_stream_write_free (out , arb_get_str (acb_imagref (x ), digits , flags ));
135- gr_stream_write (out , "*I" );
134+ status |= gr_stream_write_free (out , arb_get_str (acb_imagref (x ), digits , flags ));
135+ status |= gr_stream_write (out , "*I" );
136136 }
137137 else
138138 {
139- gr_stream_write (out , "(" );
140- gr_stream_write_free (out , arb_get_str (acb_realref (x ), digits , flags ));
139+ status |= gr_stream_write (out , "(" );
140+ status |= gr_stream_write_free (out , arb_get_str (acb_realref (x ), digits , flags ));
141141
142142 if ((arb_is_exact (acb_imagref (x )) || (flags & ARB_STR_NO_RADIUS ))
143143 && arf_sgn (arb_midref (acb_imagref (x ))) < 0 )
144144 {
145145 arb_t t ;
146146 arb_init (t );
147147 arb_neg (t , acb_imagref (x ));
148- gr_stream_write (out , " - " );
149- gr_stream_write_free (out , arb_get_str (t , digits , flags ));
148+ status |= gr_stream_write (out , " - " );
149+ status |= gr_stream_write_free (out , arb_get_str (t , digits , flags ));
150150 arb_clear (t );
151151 }
152152 else
153153 {
154- gr_stream_write (out , " + " );
155- gr_stream_write_free (out , arb_get_str (acb_imagref (x ), digits , flags ));
154+ status |= gr_stream_write (out , " + " );
155+ status |= gr_stream_write_free (out , arb_get_str (acb_imagref (x ), digits , flags ));
156156 }
157157
158- gr_stream_write (out , "*I)" );
158+ status |= gr_stream_write (out , "*I)" );
159159 }
160160
161- return GR_SUCCESS ;
161+ return status ;
162162}
163163static int
164164_gr_acb_write (gr_stream_t out , const acb_t x , const gr_ctx_t ctx )
0 commit comments