• OBNC - a few questions

    From doug719125@gmail.com@21:1/5 to All on Wed Nov 22 11:44:56 2017
    I am using Ubuntu 16.04.2 x86_64. The install went very smoothly.

    My questions are:
    1. What is the bit size for INTEGER and REAL on my machine? If they are
    not 64 and 80 bits, is there any way to get data of that size?

    2. General question about Oberon 7:
    Is there a workaround for the functionality of HALT, EXIT and
    SIZE in Oberon 2 ?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From cfbsoftware@gmail.com@21:1/5 to doug7...@gmail.com on Wed Nov 22 12:46:09 2017
    On Thursday, November 23, 2017 at 6:14:56 AM UTC+10:30, doug7...@gmail.com wrote:

    2. General question about Oberon 7:
    Is there a workaround for the functionality of HALT, EXIT and
    SIZE in Oberon 2 ?

    ASSERT(FALSE) is equivalent to HALT.

    SYSTEM.SIZE is equivalent to SIZE.

    Chris Burrows
    CFB Software
    http://www.astrobe.com

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From doug719125@gmail.com@21:1/5 to doug7...@gmail.com on Wed Nov 22 16:37:48 2017
    On Wednesday, November 22, 2017 at 12:44:56 PM UTC-7, doug7...@gmail.com wrote:
    I am using Ubuntu 16.04.2 x86_64. The install went very smoothly.

    My questions are:
    1. What is the bit size for INTEGER and REAL on my machine? If they are
    not 64 and 80 bits, is there any way to get data of that size?

    2. General question about Oberon 7:
    Is there a workaround for the functionality of HALT, EXIT and
    SIZE in Oberon 2 ?

    In response to the reply:

    It appears that on onbc 0.19.1 that you cannot import SYSTEM.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From doug719125@gmail.com@21:1/5 to cfbso...@gmail.com on Wed Nov 22 16:36:00 2017
    On Wednesday, November 22, 2017 at 1:46:09 PM UTC-7, cfbso...@gmail.com wrote:
    On Thursday, November 23, 2017 at 6:14:56 AM UTC+10:30, doug7...@gmail.com wrote:

    2. General question about Oberon 7:
    Is there a workaround for the functionality of HALT, EXIT and
    SIZE in Oberon 2 ?

    ASSERT(FALSE) is equivalent to HALT.

    SYSTEM.SIZE is equivalent to SIZE.

    Chris Burrows
    CFB Software
    http://www.astrobe.com

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From doug719125@gmail.com@21:1/5 to doug7...@gmail.com on Wed Nov 22 18:01:29 2017
    On Wednesday, November 22, 2017 at 12:44:56 PM UTC-7, doug7...@gmail.com wrote:
    I am using Ubuntu 16.04.2 x86_64. The install went very smoothly.

    My questions are:
    1. What is the bit size for INTEGER and REAL on my machine? If they are
    not 64 and 80 bits, is there any way to get data of that size?

    2. General question about Oberon 7:
    Is there a workaround for the functionality of HALT, EXIT and
    SIZE in Oberon 2 ?

    It appears that obnc 0.9.1 does not allow IMPORT SYSTEM

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From doug719125@gmail.com@21:1/5 to doug7...@gmail.com on Wed Nov 22 17:58:59 2017
    On Wednesday, November 22, 2017 at 12:44:56 PM UTC-7, doug7...@gmail.com wrote:
    I am using Ubuntu 16.04.2 x86_64. The install went very smoothly.

    My questions are:
    1. What is the bit size for INTEGER and REAL on my machine? If they are
    not 64 and 80 bits, is there any way to get data of that size?

    2. General question about Oberon 7:
    Is there a workaround for the functionality of HALT, EXIT and
    SIZE in Oberon 2 ?

    Make that obnc 0.9.1

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From doug719125@gmail.com@21:1/5 to doug7...@gmail.com on Wed Nov 22 18:00:44 2017
    On Wednesday, November 22, 2017 at 12:44:56 PM UTC-7, doug7...@gmail.com wrote:
    I am using Ubuntu 16.04.2 x86_64. The install went very smoothly.

    My questions are:
    1. What is the bit size for INTEGER and REAL on my machine? If they are
    not 64 and 80 bits, is there any way to get data of that size?

    2. General question about Oberon 7:
    Is there a workaround for the functionality of HALT, EXIT and
    SIZE in Oberon 2 ?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From doug719125@gmail.com@21:1/5 to doug7...@gmail.com on Wed Nov 22 18:04:19 2017
    On Wednesday, November 22, 2017 at 5:37:48 PM UTC-7, doug7...@gmail.com wrote:
    On Wednesday, November 22, 2017 at 12:44:56 PM UTC-7, doug7...@gmail.com wrote:
    I am using Ubuntu 16.04.2 x86_64. The install went very smoothly.

    My questions are:
    1. What is the bit size for INTEGER and REAL on my machine? If they are
    not 64 and 80 bits, is there any way to get data of that size?

    2. General question about Oberon 7:
    Is there a workaround for the functionality of HALT, EXIT and
    SIZE in Oberon 2 ?

    In response to the reply:

    It appears that on onbc 0.19.1 that you cannot import SYSTEM.

    Make that obnc 0.9.1

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From doug719125@gmail.com@21:1/5 to doug7...@gmail.com on Wed Nov 22 18:02:14 2017
    On Wednesday, November 22, 2017 at 5:37:48 PM UTC-7, doug7...@gmail.com wrote:
    On Wednesday, November 22, 2017 at 12:44:56 PM UTC-7, doug7...@gmail.com wrote:
    I am using Ubuntu 16.04.2 x86_64. The install went very smoothly.

    My questions are:
    1. What is the bit size for INTEGER and REAL on my machine? If they are
    not 64 and 80 bits, is there any way to get data of that size?

    2. General question about Oberon 7:
    Is there a workaround for the functionality of HALT, EXIT and
    SIZE in Oberon 2 ?

    In response to the reply:

    It appears that on onbc 0.19.1 that you cannot import SYSTEM.

    make that obnc 0.9.1

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From cfbsoftware@gmail.com@21:1/5 to doug7...@gmail.com on Thu Nov 23 02:25:31 2017
    On Thursday, November 23, 2017 at 12:31:29 PM UTC+10:30, doug7...@gmail.com wrote:

    It appears that obnc 0.9.1 does not allow IMPORT SYSTEM

    In that case, check here to see if there are any alternative compilers that meet your requirements:

    http://oberon07.com/compilers.xhtml

    Regards,
    Chris Burrows
    CFB Software
    http://www.astrobe.com

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From miasap@21:1/5 to doug719125@gmail.com on Thu Nov 23 13:06:14 2017
    Hi,

    Author of OBNC here.

    On 2017-11-22 20:44, doug719125@gmail.com wrote:
    I am using Ubuntu 16.04.2 x86_64. The install went very smoothly.

    I'm glad to hear that.

    My questions are:
    1. What is the bit size for INTEGER and REAL on my machine? If they are
    not 64 and 80 bits, is there any way to get data of that size?

    INTEGER maps to int and REAL to double. You can see the generated C
    files in the hidden .obnc directory. INTEGER, REAL and BYTE are the only numeric types available in OBNC.

    2. General question about Oberon 7:
    Is there a workaround for the functionality of HALT, EXIT and
    SIZE in Oberon 2 ?

    As mentioned by Chris, HALT has been eliminated in favor of ASSERT(FALSE).

    A LOOP statement (with EXIT) can be rewritten as a WHILE statement with
    a loop guard named `done' or similar.

    For implementations which support the (optional) module SYSTEM you
    typically get the size of a type with SYSTEM.SIZE. OBNC, however, does
    not implement a SYSTEM module because all low-level/non-portable code is supposed to be written in C.

    Below is an example of how to get the size of INTEGER and REAL using
    OBNC. You can get a template for Limits.c by copying .obnc/Limits.c to
    the current directory. See also the section "Interfacing to C" in `man
    obnc'.

    Limits.obn:

    MODULE Limits;

    VAR
    integerSize*: INTEGER;
    realSize*: INTEGER;

    END Limits.

    Limits.c:

    #include <obnc/OBNC.h>
    #include ".obnc/Limits.h"

    int Limits_integerSize_;

    int Limits_realSize_;

    void Limits_Init(void)
    {
    Limits_integerSize_ = sizeof (int);
    Limits_realSize_ = sizeof (double);
    }

    Test.obn:

    MODULE test;

    IMPORT Limits, Out;

    BEGIN
    Out.String("size of INTEGER: ");
    Out.Int(Limits.integerSize, 0);
    Out.Ln;
    Out.String("size of REAL: ");
    Out.Int(Limits.realSize, 0);
    Out.Ln;
    END test.


    Regards,
    Karl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From miasap@21:1/5 to doug719125@gmail.com on Thu Nov 23 13:18:00 2017
    On 2017-11-22 20:44, doug719125@gmail.com wrote:
    If they are not 64 and 80 bits, is there any way to get data of that
    size?
    Just out of curiosity, what kind of application do you work on which
    requires numeric types of these sizes?

    Regards,
    Karl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From doug719125@gmail.com@21:1/5 to miasap on Thu Nov 23 05:34:40 2017
    On Thursday, November 23, 2017 at 5:18:01 AM UTC-7, miasap wrote:
    On 2017-11-22 20:44, doug719125@gmail.com wrote:
    If they are not 64 and 80 bits, is there any way to get data of that
    size?
    Just out of curiosity, what kind of application do you work on which requires numeric types of these sizes?

    Regards,
    Karl

    Thanks for your reply Karl. In computational number theory you want all the integer bits that you can get, and to implement multi precision arithmetic, 64 bit integers make life much easier. If there was a SYSTEM module for x86_64 processors you would
    need 64 bit integers for addresses.

    The case for extended real numbers is not so strong for me. Some algorithms suffer from a large roundoff error, and if you can keep the intermediate results in the 80 bit format, your overall results will improve.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From miasap@21:1/5 to doug719125@gmail.com on Thu Nov 23 16:28:23 2017
    On 2017-11-23 14:34, doug719125@gmail.com wrote:
    On Thursday, November 23, 2017 at 5:18:01 AM UTC-7, miasap wrote:
    On 2017-11-22 20:44, doug719125@gmail.com wrote:
    If they are not 64 and 80 bits, is there any way to get data of that
    size?
    Just out of curiosity, what kind of application do you work on which
    requires numeric types of these sizes?

    Regards,
    Karl

    Thanks for your reply Karl. In computational number theory you want all the integer bits that you can get, and to implement multi precision arithmetic, 64 bit integers make life much easier. If there was a SYSTEM module for x86_64 processors you
    would need 64 bit integers for addresses.

    Yes, that's an interesting observation. I wonder how Niklaus Wirth would
    solve this if he decided to target a 64-bit system.


    -- Karl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From cfbsoftware@gmail.com@21:1/5 to miasap on Thu Nov 23 12:49:34 2017
    On Friday, November 24, 2017 at 1:58:24 AM UTC+10:30, miasap wrote:
    On 2017-11-23 14:34, doug wrote:
    If there was a SYSTEM module for x86_64 processors you would need 64 bit integers for addresses.


    Yes, that's an interesting observation. I wonder how Niklaus Wirth would solve this if he decided to target a 64-bit system.


    The size of INTEGER is intentionally implementation-dependent. It could be implemented as 64-bit if the target platform needed it.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From miasap@21:1/5 to cfbsoftware@gmail.com on Fri Nov 24 10:20:34 2017
    On 2017-11-23 21:49, cfbsoftware@gmail.com wrote:
    The size of INTEGER is intentionally implementation-dependent. It could be implemented as 64-bit if the target platform needed it.


    Indeed, but then applications will waste a lot of memory when 64-bit
    integers are not needed.


    -- Karl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From cfbsoftware@gmail.com@21:1/5 to miasap on Fri Nov 24 03:24:59 2017
    On Friday, November 24, 2017 at 7:50:35 PM UTC+10:30, miasap wrote:
    On 2017-11-23 21:49, cfbsoftware wrote:
    The size of INTEGER is intentionally implementation-dependent. It could be implemented as 64-bit if the target platform needed it.


    Indeed, but then applications will waste a lot of memory when 64-bit
    integers are not needed.


    Yes - it will always be a tradeoff. However, the same applies to 32-bit systems. I typically use 32-bit integers to store a zero, one etc. in Oberon programs. I wouldn't bother using BYTE just because they happen to be small values.

    If you are working on an architecture that requires 64 bits to address memory then shortage of memory is unlikely to be a problem. Your integers will only take up twice as much memory but you could have more than 65000 times as much memory to work with!

    BTW this has already been done. The Patchouli Oberon compiler is a 64-bit compiler. According to the documentation INTEGER is 64-bit:

    https://github.com/congdm/Patchouli-Compiler/wiki/Detailed-Documentation

    --
    Chris Burrows
    CFB Software
    http://www.astrobe.com/RISC5

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From cfbsoftware@gmail.com@21:1/5 to cfbso...@gmail.com on Fri Nov 24 04:20:47 2017
    On Friday, November 24, 2017 at 9:54:59 PM UTC+10:30, cfbso...@gmail.com wrote:
    Your integers will only take up twice as much memory but you could have more than 65000 times as much memory to work with!


    Correction: Oops! Of course that should be *4 billion times* as much memory (i.e. 16 "Exabytes"). However that is the theoretical maximum. Current Windows systems have a limit of 512 Gigabytes which is 128 times the limit of 32-bit Windows systems.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Nemo@21:1/5 to doug719125@gmail.com on Fri Nov 24 16:34:25 2017
    On 23/11/2017 08:34, doug719125@gmail.com wrote (in part):
    Thanks for your reply Karl. In computational number theory you want all
    the integer bits that you can get, and to implement multi precision arithmetic, 64 bit integers make life much easier. If there was a
    SYSTEM module for x86_64 processors you would need 64 bit integers
    for addresses.

    In this regard, it would be nicer if CARDINAL were kept as you lose a
    bit with signed integers (and have all sorts of house-keeping problems).

    N.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From miasap@21:1/5 to doug719125@gmail.com on Thu Nov 30 13:23:45 2017
    On 2017-11-22 20:44, doug719125@gmail.com wrote:
    1. What is the bit size for INTEGER and REAL on my machine? If they are
    not 64 and 80 bits, is there any way to get data of that size?

    OBNC 0.10.0 now has the build options --use-long-int and --use-long-real
    which adds the type specifier `long' for the C types corresponding to
    INTEGER, SET and REAL. This should enable 64-bit integers and/or 80-bit floating point numbers on the system you use. The math module in the
    basic library only supports double precision, however, so you have to
    provide your own for extended precision calculations.

    http://miasap.se/obnc/


    Regards,
    Karl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From miasap@21:1/5 to miasap on Fri Dec 8 12:45:15 2017
    On 2017-11-30 13:23, miasap wrote:
    The math module in the
    basic library only supports double precision, however, so you have to
    provide your own for extended precision calculations.

    OBNC 0.10.1 now supports extended precision calculations in basic module
    Math.

    http://miasap.se/obnc/


    Regards,
    Karl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From miasap@21:1/5 to doug719125@gmail.com on Tue Mar 6 13:48:56 2018
    On 2017-11-23 03:01, doug719125@gmail.com wrote:
    It appears that obnc 0.9.1 does not allow IMPORT SYSTEM

    The module SYSTEM is implemented in OBNC 0.12.0.


    -- Karl

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)