Re: problem with very small numbers - g95 versus gfortran



"e p chandler" <epc8@xxxxxxxx> wrote in message
news:4222e3fc-6663-4fb2-b505-e2a30dfc3584@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

OK. Here it goes with G95:

C:\Users\epc\temp>g95 mega.f90

C:\Users\epc\temp>a
(2.5788508E+38,-2.5788508E+38)
(1.2030801E+38,-1.2030801E+38)
(+Inf,-Inf)
(6.355804891857543E+307,-6.355805169678616E+307)
(+Inf,-Inf)
(4.2063359488591517347E+4931,-4.2063361327239468925E+4931)
3.4028235E+38
1.7976931348623157E+308
1.189731495357231765E+4932

I have worried about writing a replacement for missing intrinsics
because if you're not careful intermediate calculations may
overflow even though the final result should be a model number.
I suppose I need not have worried so much considering that at
least for gcc-based compilers this kind of care is not taken for
the intrinsics in the first place. I speculate that you didn't
overflow for the single precision version because the single
precision overflow intermediate was never stored into memory
as a single precision number. In the x86_64 compilers the
computation is more likely to be carried out in SSE registers
where single-precision overflow really is overflow; there is no
15-bit exponent field in the xmm registers as there is in x87
registers.

--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end


.



Relevant Pages

  • Re: problem with very small numbers - g95 versus gfortran
    ... I have worried about writing a replacement for missing intrinsics ... overflow even though the final result should be a model number. ... overflow for the single precision version because the single ... computation is more likely to be carried out in SSE registers ...
    (comp.lang.fortran)
  • Re: integer limit
    ... If we do this in 32 bit registers, and do not worry about overflow, we ... so in a twos complement machine 2147483648 is negative, ... I am not surprised that Google turns up nothing for 139586437119. ...
    (comp.unix.shell)
  • Re: Integer arithmetic, multiplication overflow
    ... If the result register of an integer multiplication instruction is twice as wide as the factor registers then overflow will never occur. ... The second operand D2represents the second factor, a 32-bit signed integer in main storage. ...
    (sci.math)
  • Exploiting new IE Object Type Overflow
    ... Object Type) (ESP doesn't seem to be overwritten, but EDI is). ... "This allows us to take control of key registers so as to run code that we ... which will be available at the EDX register. ... is different from a regular stack overflow as placing the address of a JMP ...
    (Vuln-Dev)
  • Re: Total order on floating point numbers
    ... |> decided that the speedup from using assembler wasn't worth the hassle |>, but the principle seemed ... |> if nonzero, branch to overflow. ... Relatively recently a multiply with a single precision result ...
    (comp.arch.arithmetic)