[Icc-mot] RE: Icc-mot Digest, Vol 41, Issue 6

Rene Streubel r.streubel at emtec-papertest.de
Wed Jan 30 23:56:51 PST 2008


Of course I include math.h
I deactivate the fround function in math.h with comment "//".
//#define fround	 froundf
And the complete fround is:
signed long fround(float data_in)
{
    signed long data_out;
	
	if (data_in>0)
	{
	    data_out=(signed long)(data_in+0.5);
	}
	else
	{
	    data_out=(signed long)(data_in-0.5);
	}
	
	return data_out;
}
The important thing is that it crashes, if data_in is a signed value.

But please look at my other tests: They are simpler...
(With froundf I use the predefined froundf function from the include
path [math.h] and not my own function)

signed int foo(void) 
{return froundf(abs(-101.85));}

In this function I use "abs()" to get an unsigned value. This works.
But, if the function has to round a signed value, it crashes:

signed int foo(void) 
{return froundf(-101.85);}

This is reproducible on my system. I look to the include paths, but they
are correct! (Also the library path)
I think it only crashes, if the complete project is large and use
expanded memory pages. Do you use expanded memory pages in your tests?

Best regards 
Rene




-----Original Message-----
From: icc-mot-bounces at imagecraft.com
[mailto:icc-mot-bounces at imagecraft.com] On Behalf Of
icc-mot-request at imagecraft.com
Sent: Wednesday, January 30, 2008 9:00 PM
To: icc-mot at imagecraft.com
Subject: Icc-mot Digest, Vol 41, Issue 6

Send Icc-mot mailing list submissions to
	icc-mot at imagecraft.com

To subscribe or unsubscribe via the World Wide Web, visit
	http://dragonsgate.net/mailman/listinfo/icc-mot
or, via email, send a message with subject or body 'help' to
	icc-mot-request at imagecraft.com

You can reach the person managing the list at
	icc-mot-owner at imagecraft.com

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Icc-mot digest..."


Today's Topics:

   1. Re: fround problem / fp conversion (Richard Man)


----------------------------------------------------------------------

Message: 1
Date: Wed, 30 Jan 2008 01:23:47 -0800
From: Richard Man <richard-lists at imagecraft.com>
Subject: Re: [Icc-mot] fround problem / fp conversion
To: "Discussion List for ICC08/11/12/16 users. You do NOT need to
	subscribe to	icc-announce if you are a member of this."
	<icc-mot at imagecraft.com>, 	"Discussion List for
ICC08/11/12/16 users.
	You do NOT need tosubscribe	toicc-announce if you are a
member of
	this." <icc-mot at imagecraft.com>
Message-ID: <200801300939.m0U9daGj060899 at dragonsgate2.imagecraft.com>
Content-Type: text/plain; charset="us-ascii"; format=flowed

As with Edward, I can't reproduce this problem. Whatever it is, I 
don't think it's related to uint2fp or signed int to FP conversion..?

At 03:20 AM 1/23/2008, Edward Karpicz wrote:
>Both get_pressure2() variants seem to work me :-(. Do you have
>
>#include <math.h>
>
>in your code?
>
>
>Regarding your own fround:
>
>signed long fround(float data_in)
>{
>signed long data_out;
>if (data_in>0)
>{
>    data_out=(signed long)(data_in+0.5);
>}
>return data_out;
>}
>
>1) when data_in is negative or zero, data_out is undefined
>2) if you included math.h, then it should complain  about redefining 
>fround. fround should return float, not signed long. BTW is fround a 
>standard C function?
>3) without valid fround prototype you not only should get a warning 
>about missing prototype, but also it's expected to hang. Functions 
>returning longs and floats, such functions are pushing return value 
>to the stack. Callee has to pull return value from stack. Without 
>valid prototype, any function is assumed to be defined as int 
>foo(int). It wouldn't hang if fround was returning 
>int/short/char/void and signed variants of <=16bits wide return types.
>
>Also, is include path pointing to V7 include folder?
>
>Edward
>
>
>
>----- Original Message ----- From: "Rene Streubel" 
><r.streubel at emtec-papertest.de>
>To: <icc-mot at imagecraft.com>
>Sent: Wednesday, January 23, 2008 12:19 PM
>Subject: [Icc-mot] fround problem / fp conversion
>
>
>I tried to reduce the function:
>If the function have to round an unsigned value, so it is OK:
>
>signed int get_pressure2(unsigned char p_ch)
>{
>return froundf(abs(-101.85));
>}
>
>But, if the function have to round a signed value, it crashes:
>
>signed int get_pressure2(unsigned char p_ch)
>{
>return froundf(-101.85);
>}
>
>I checked my Program Memory. I had a mistake in my email. The 
>correct settings in my project are:
>Program Memory: 0x4000.0x7FFF:0xC000.0xEFFF
>My complete program needs pages 20..23 Is there a problem with the 
>memory mapping?
>
>I wrote about my own fround function and that it crahes with the if 
>statement inside.
>There is the same thing. If it is signed in the if statement it 
>crashes. Without the if statement it not crashes. I think there is a 
>problem with the signed fp conversion / emulation.
>
>Richard wrotes about the 7.03 Beta0 and that the compiler did not 
>generate calls to "uint2fp" for unsigned to FP conversion. Maybe 
>there is now a new bug with any conversion?
>
>What should I do?
>
>Rene
>
>
>
>-

// richard (This email is for mailing lists. To reach me directly, 
please use richard at imagecraft.com) 



------------------------------

_______________________________________________
Icc-mot mailing list
Icc-mot at imagecraft.com
http://dragonsgate.net/mailman/listinfo/icc-mot


End of Icc-mot Digest, Vol 41, Issue 6
**************************************





More information about the Icc-mot mailing list