[Oberon] On a code generated for Math.Mod.txt

Srinivas Nayak sinu.nayak2001 at gmail.com
Thu Jul 14 09:25:59 CEST 2016


Thanks Jorg.
You are correct.

I see in C, on x86,

#include <stdio.h>
int main()
{
	union {float f; int i;}u;

	u.f = 9.999999e-1;
	printf("%e  =  ", u.f);
	printf("%#x\n", u.i);

	u.f = 9.9999999e-1;
	printf("%e  =  ", u.f);
	printf("%#x\n", u.i);

	return 0;
}

produces

# ./a.out
9.999999e-01  =  0x3f7ffffe
1.000000e+00  =  0x3f800000
#

But I think, Oberon doesn't convert 9.9999999e-1 to 1.000000e+00.
When both use 32bit and use IEEE 754 format, what is causing this?
Is it language trick? I don't think so, since Oberon compiler doesn't do anything special for this.
Is it processor dependent thing? Don't know anything about this.

Hope you will shed some more light on this deepening darkness.



With thanks and best regards,

Yours sincerely,
Srinivas Nayak

Home: http://www.mathmeth.com/sn/
Blog: http://srinivas-nayak.blogspot.in/

On 07/14/2016 03:26 AM, Jörg Straube wrote:
> Srinivas
>
>     MOV' R1 #aa    (upper 16 bit)
>     IOR R1 #bb       (lower 16 bit)
> is the code to fill the register R1 with the 32 bit constant #aabb
>
> You find all the details of the RISC5 instruction set in this paper:
> https://www.inf.ethz.ch/personal/wirth/FPGA-relatedWork/RISC-Arch.pdf
>
> Jörg
>
>
>
> Gruss, Jörg
>> Am 13.07.2016 um 21:18 schrieb Srinivas Nayak <sinu.nayak2001 at gmail.com>:
>>
>> In math.Mod.txt we see
>>
>> q0 =  9.9999999E-1;
>> IF ODD(n) THEN f := (((((q6*yy + q5)*yy + q4)*yy + q3)*yy + q2)*yy + q1)*yy + q0
>>
>> ELSE
>>
>> For the last addition of q0, I see the code generated is:
>>
>> 61003F7F  MOV'  R1  R0  16255
>>
>> 4116FFFE  IOR  R1  R1     -2
>>
>> How it is different from
>>
>> 61003F80  MOV'  R1  R0  16256
>>
>>
>>
>>
>> With thanks and best regards,
>>
>> Yours sincerely,
>> Srinivas Nayak
>>
>> Home: http://www.mathmeth.com/sn/
>> Blog: http://srinivas-nayak.blogspot.in/
>> --
>> 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