[comp.sys.ibm.pc.misc] Weird Floating point.

shearer@cis.udel.edu (Rob Shearer) (10/06/90)

I am using TC++ 1.0 and I am having a very weird problem!

I have 2 machines:  1 33Mhz 386 DecStation with Pheniox ROMS. and a 387 chip.
(at work) and 1 25Mhz 386 Gateway 2000 with AMI ROMS and NO 387 chip.

My program that I am working on is very complicated, and VERY tricky, BUT it
works on the 33Mhz machine at work with the 387 chip.  At home I can't even
get it to print a float correctly!.  

I have compiled/linked everything with EMULATION floating point turned on (even on the machine with the 387 chip).  I have a routine as follows:

void calc_ms (void) {
  float tmp_tmp;

  tmp_tmp = (time_slice/((float)newclock*18.207)) * 1000;
  printf("%f4.2ms",tmp_tmp);
}

with time_slice = 1, and newclock = 55 on the machine at work i get 1.00ms
as output, at home i get 0.00ms (or sometimes -0.00ms!!!){
(those #'s are just to show you it doesn't work.  No matter which numbers
I assign to time_slice and newclock, the machine at work will print the
correct millisecond calculation... the one at home prints 0.00).

I have written a SIMPLE program that did ONLY this.. and it DOES work at home
but that only confuses me more!  

I also have a routine that calculates the # of seconds since midnight
using inportb(0x43) and inportb(0x40) etc...  it works (again) at work
but at home i get 0.0000000000.      These also work in routines by themselves
but I can't figure out what is causing the problem in my program.

I{play around with different things (my own handler in INT8, accelerate
the heart beat, remap dos INT21 to INT66 and install my own handler in INT21
(calls INT66, and then checks for a flag, and if set, calls INT8) 

I have commented each of these out 1 step at a time, and the problem still
occurs!... It is driving me batty!

(NOTE:  I just tried this on my fiance's 386SX from Gateway and it is the
same as my home system... gives me 0.00000)

thank you for ANY help you can give me..  like I said.. it is driving me 
crazy!

Robb Shearer
shearer@sol.cis.udel.edu

PS:  in my INT8 handler, i should would like to know how the interrupt
was called, either by the hardware (IRQ0), or from my dos interrupt handler
(INT21) so that I can keep the system time correct...  any ideas on how
to differentiate between software and hardware interrupts??  this is a
secondary question...  but any responses to this would be greatly appreciated
also!