comparison scripts/plot/draw/fplot.m @ 18775:37c300acfcfd stable

don't truncate when casting char to uintN values (bug #42054) * oct-inttypes.h (octave_int<T>::octave_int (char)): New special case constructor. * oct-inttypes.cc: New tests.
author John W. Eaton <jwe@octave.org>
date Sat, 05 Apr 2014 15:09:09 -0400
parents d63878346099
children 6fdd3ab55b78
comparison
equal deleted inserted replaced
18774:6535cb2b8e23 18775:37c300acfcfd
144 ## x-range. Try any function with a discontinuity, such as 144 ## x-range. Try any function with a discontinuity, such as
145 ## fplot (@tan, [-2, 2]) or fplot ("1./x", [-3, 2]), to see the 145 ## fplot (@tan, [-2, 2]) or fplot ("1./x", [-3, 2]), to see the
146 ## problems with the current solution. 146 ## problems with the current solution.
147 147
148 while (n < 2^18) # Something is wrong if we need more than 250K points 148 while (n < 2^18) # Something is wrong if we need more than 250K points
149 yi = interp1 (x0, y0, x, "linear"); 149 yi = interp1 (x0, y0, x, "linear")
150 ## relative error calculation using average of [yi,y] as reference 150 ## relative error calculation using average of [yi,y] as reference
151 ## since neither estimate is known a priori to be better than the other. 151 ## since neither estimate is known a priori to be better than the other.
152 err = 0.5 * max (abs ((yi - y) ./ (yi + y))(:)); 152 err = 0.5 * max (abs ((yi - y) ./ (yi + y))(:))
153 if (err < tol || abs (err - err0) < tol/2) 153 if (err < tol || abs (err - err0) < tol/2)
154 ## Either relative tolerance has been met OR 154 ## Either relative tolerance has been met OR
155 ## algorithm has stopped making any reasonable progress per iteration. 155 ## algorithm has stopped making any reasonable progress per iteration.
156 break; 156 break;
157 endif 157 endif