Oberon Community Platform Forum
September 23, 2017, 08:43:35 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: size, min, max of real{32}  (Read 3601 times)
fnecati
Jr. Member
**
Posts: 60


« on: March 13, 2009, 09:47:35 AM »

Hi,

The following table is the output of a program which list  size, min and max of basic types of the zonnon.

real{32} type seems to have wrong size and min/max values, size should be 4 bytes and min/max order is E+-38 ?


This problem arises again in calculating the machine epsilon by using a real{32} variable.

Regards,


Zonnon type     size(bytes)            min                      max
---------------------------------------------------------------------------
    (def) char:    2                        0                      255
       char{8}:    1                        0                      255
      char{16}:    2                        0                      255
---------------------------------------------------------------------------
 (def) integer:    4              -2147483648               2147483647
    integer{8}:    1                     -128                      127
   integer{16}:    2                   -32768                    32767
   integer{32}:    4              -2147483648               2147483647
   integer{64}:    8     -9223372036854775808      9223372036854775807
  integer{128}:   16     -9223372036854775808      9223372036854775807
---------------------------------------------------------------------------
(def) cardinal:    0                        0               4294967295
---------------------------------------------------------------------------
    (def) real:    8           -1.797693E+308            1.797693E+308
      real{32}:    8           -1.797693E+308            1.797693E+308    <=====
      real{64}:    8           -1.797693E+308            1.797693E+308
      real{80}:   10           -1.797693E+308            1.797693E+308
     real{128}:   16           -1.797693E+308            1.797693E+308
---------------------------------------------------------------------------
     (def) set:    4                        0                       31
        set{8}:    1                        0                        7
       set{16}:    2                        0                       15
       set{32}:    4                        0                       31
       set{64}:    8                        0                       63
      set{128}:   16                        0                      127
---------------------------------------------------------------------------
Logged
rmitin
Moderator
Newbie
*****
Posts: 22


« Reply #1 on: June 02, 2009, 09:48:06 AM »

You're right. Actually the bug is not in the procedures, but for some reason compiler was always choosing real{64} for all types with width smaller than 64. Actually according to the language report real{27} for example means that a suitable type to store real{27} will be used. That also includes real{64} as well as real{32}.

With the size function I guess you want to know the actual size used by the variable, bot not how much it would take if we could store it as user requests (e.g. 5 bit). But probably you're right that min and max should return values for user defined size anyway. I'll think about it and then fix it. I'll bring back using Single for real{32}.

Thank you!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!