/[guile]/guile/guile-core/libguile/numbers.c
ViewVC logotype

Diff of /guile/guile-core/libguile/numbers.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.195 by kryde, Thu Jul 17 23:38:34 2003 UTC revision 1.196 by kryde, Thu Jul 24 01:03:40 2003 UTC
# Line 4257  SCM_GPROC (s_angle, "angle", 1, 0, 0, sc Line 4257  SCM_GPROC (s_angle, "angle", 1, 0, 0, sc
4257  SCM  SCM
4258  scm_angle (SCM z)  scm_angle (SCM z)
4259  {  {
4260      /* atan(0,-1) is pi and it'd be possible to have that as a constant like
4261         scm_flo0 to save allocating a new flonum with scm_make_real each time.
4262         But if atan2 follows the floating point rounding mode, then the value
4263         is not a constant.  Maybe it'd be close enough though.  */
4264    if (SCM_INUMP (z))    if (SCM_INUMP (z))
4265      {      {
4266        if (SCM_INUM (z) >= 0)        if (SCM_INUM (z) >= 0)
4267          return scm_make_real (atan2 (0.0, 1.0));          return scm_flo0;
4268        else        else
4269          return scm_make_real (atan2 (0.0, -1.0));          return scm_make_real (atan2 (0.0, -1.0));
4270      }      }
# Line 4271  scm_angle (SCM z) Line 4275  scm_angle (SCM z)
4275        if (sgn < 0)        if (sgn < 0)
4276          return scm_make_real (atan2 (0.0, -1.0));          return scm_make_real (atan2 (0.0, -1.0));
4277        else        else
4278          return scm_make_real (atan2 (0.0, 1.0));          return scm_flo0;
4279      }      }
4280    else if (SCM_REALP (z))    else if (SCM_REALP (z))
4281      return scm_make_real (atan2 (0.0, SCM_REAL_VALUE (z)));      {
4282          if (SCM_REAL_VALUE (z) >= 0)
4283            return scm_flo0;
4284          else
4285            return scm_make_real (atan2 (0.0, -1.0));
4286        }
4287    else if (SCM_COMPLEXP (z))    else if (SCM_COMPLEXP (z))
4288      return scm_make_real (atan2 (SCM_COMPLEX_IMAG (z), SCM_COMPLEX_REAL (z)));      return scm_make_real (atan2 (SCM_COMPLEX_IMAG (z), SCM_COMPLEX_REAL (z)));
4289    else    else

Legend:
Removed from v.1.195  
changed lines
  Added in v.1.196

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26