[Oberon] real math

rob solomon drrob106 at verizon.net
Thu Nov 13 13:52:53 CET 2014


Or there is an optimization going on in your code, so that the  / 
100.0*100.0 is being optimized out.

On 11/13/2014 07:28 AM, oberon at moravcik.info wrote:
> Here it is. It runs on the same machine. So the difference can only be in the compiler?
> Zdenek
>
> #include <stdio.h>
>   
> main()
> {
>     float number;
>   
>     number = 480.0 / 100.0 * 100.0;
>     printf("result: %3.15f\n", number);
>   
>     return 0;
> }
>
>
>
> On Thu, Nov 13, 2014 at 10:06:28PM +1030, Chris Burrows wrote:
>> I would be interested to see your gcc source code as well for comparison.
>> Make sure that you include details of which compile-time and linker options
>> that you used - especially any that are FPU-related (including default
>> values) as they will also affect the behaviour of the software.
>>
>> Regards,
>> Chris
>>
>> Chris Burrows
>> CFB Software
>> http://www.cfbsoftware.com
>>
>>
>>> -----Original Message-----
>>> From: oberon at moravcik.info [mailto:oberon at moravcik.info]
>>> Sent: Thursday, 13 November 2014 9:51 PM
>>> To: ETH Oberon and related systems
>>> Subject: Re: [Oberon] real math
>>>
>>> (*
>>>
>>>    To not confuse everyone here is my source code and what it outputs.
>>>    I am using aos.linux revision 5730 on debian wheezy on AMD64
>>>    Tested the same source on gcc and result was 480.
>>>    Zdenek
>>>
>>>    test2.test ~    outputs:  480000032
>>>
>>>    SystemTools.Free test2 ~
>>>
>>> *)
>>>
>>> MODULE test2;
>>>   IMPORT out:=KernelLog;
>>>
>>> PROCEDURE test*();
>>> VAR
>>>   r : REAL;
>>> BEGIN
>>>   r := 480 / 100 * 100;
>>>   out.Int(ENTIER(r * 1000000),0); out.Ln; END test;
>>>
>>> END test2.
>>>
>>>
>>> On Tue, Nov 11, 2014 at 04:12:01PM +0100, Jörg wrote:
>>>> As neither myself nor Yaroslav had the result Zdenek had, we should
>>> ask:
>>>> What Oberon system on what platform are you using, Zdenek?
>>>>
>>
>> --
>> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
>> https://lists.inf.ethz.ch/mailman/listinfo/oberon
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>




More information about the Oberon mailing list