develooper Front page | perl.perl5.porters | Postings from December 2004

Re: modf chainsaw?

Thread Previous | Thread Next
Ed Allen Smith
December 14, 2004 02:54
Re: modf chainsaw?
Message ID:
In message <> (on 14 December 2004 01:49:30
-0800), (Yitzchak Scott-Thoennes) wrote:
>It looks to me like the only use of modfl? is now in pp_pack.c, and that
>looks like a bizarre kind of way to do something by someone who didn't
>know that fmod existed.
>Can someone who has some idea what the uuencode unpacking code is doing
>comment on whether this:
>               cdouble = Perl_modf(cdouble / adouble, &trouble) * adouble;
>can't be this instead:
>               cdouble = Perl_fmod(cdouble, adouble);
>Then the Perl_modfl stuff in numeric.c can be ripped out, and the
>requirement for modfl for using long doubles can be removed from


    dSP; dTARGET; tryAMAGICun(int);
      NV value;
      IV iv = TOPi; /* attempt to convert to IV if possible. */
      /* XXX it's arguable that compiler casting to IV might be subtly
         different from modf (for numbers inside (IV_MIN,UV_MAX)) in which
         else preferring IV has introduced a subtle behaviour change bug. OTOH
         relying on floating point to be accurate is a bug.  */

      if (!SvOK(TOPs))
      else if (SvIOK(TOPs)) {
        if (SvIsUV(TOPs)) {
            UV uv = TOPu;
        } else
      } else {
          value = TOPn;
          if (value >= 0.0) {
              if (value < (NV)UV_MAX + 0.5) {
              } else {
          else {
              if (value > (NV)IV_MIN - 0.5) {
              } else {

Allen Smith		
There is only one sound argument for democracy, and that is the argument
that it is a crime for any man to hold himself out as better than other men,
and, above all, a most heinous offense for him to prove it. - H. L. Mencken

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About