Hello,

I'd like to know if anybody has experience in finely controlling the FPU
under Linux (I'm under Debian 1.3.1). I need to control the rounding mode of
the FPU (rounding up or down instead of "to nearest").

I found /usr/include/i386/fpucontrol, but I cannot get the following program
to give at least 2 different results. Any idea ?

        Thomas

#include <stdio.h>
#include <math.h>
#include <fpu_control.h>
#include <stdlib.h>

main()
{
  double a;

  a = 1.0/3.0;
  printf("%.30f\n",a);

  __setfpucw(0x1b72);
  a = 1.0/3.0;
  __setfpucw(0x1372);
  
  printf("%.30f\n",a);

  __setfpucw(0x1772);
  a = 1.0/3.0;
  __setfpucw(0x1372);
  
  printf("%.30f\n",a);
  return(0);
}


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .

Reply via email to