Skip to main content

phoneme feature O2 issue

4 replies [Last post]
aimself
Offline
Joined: 2009-05-31
Points: 0

I meet a issue on vm of the phoneme feature mr3. I can pass all the CLDC1.1 TCK when I use libcldc_vm_g.a for out midp,but I can't pass the CLDC1.1 TCK when I use
libcldc_vm_r.a,which version is compiled with O2 flag.the failed TCK include double,float and Math.for example,api/java_lang/Double/index.html#DoubleToLongBits failed,the detail failed list can be found in the attachment.

by the way,we have the simple case TestfloatValue test this issue,we use the command:
[root@Linux java]#./cldc_vm_r -cp /mfoneroot/app/target/java/ TestFloatValue
============TestFloatValue====
============Double():1.8540471384485064E-308
===============floatValue():7.7554E-40
===============floatValue()2222:7.7554E-40
,but use the cldc_vm_g,the result is right. the testfloatvalue.java source is list:

import java.lang.Double;

public class TestFloatValue {

public TestFloatValue() {
// TODO Auto-generated constructor stub
System.out.println("============TestFloatValue====");
}

public int testDoubleFloatValue()
{
double d = 1.1;
double d1;

d1 = new Double(d).floatValue();
System.out.println("======testDoubleFloatValue:" + d + "====>" + d1);

return 0;
}
/**a
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
TestFloatValue tester = new TestFloatValue();
tester.testDoubleFloatValue();
}

}

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
aimself
Offline
Joined: 2009-05-31
Points: 0

Hi danila:
I compiled the cldc_vm_r with -fno-strict-aliasing,but we run TestMathCos,TestMathCeil,DoubleToString and so on,now ,this case are failed by running with cldc_vm_r.

for example,
1.# ./cldc_vm_r -cp /mfoneroot/app/target/java/ DoubleToString
==============Double2018=====
For -5.0E-324 returned -5.0E-324 instead of -4.9E-324
For 5.0E-324 returned 5.0E-324 instead of 4.9E-324
2 problems found in public static String toString(double x)

2.# ./cldc_vm_r -cp /mfoneroot/app/target/java/ TestMathCeil
=============Math0003=====

Failed with -1025.0 != check.
Failed with -1024.0 != check.
Failed with -1023.0 != check.
Failed with -256.0 != check.
Failed with -255.0 != check.
Failed with -254.0 != check.
Failed with -1.0 != check.
Failed with -5.0E-324 != check.
Failed with -5.0E-324 equals() check.
Failed with 5.0E-324 != check.
Failed with 5.0E-324 equals() check.
public static strictfp double ceil(double a)

the soure are below:

DoubleToString.java:

public class DoubleToString {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Double2018();
}

public static int Double2018()
{
int i = 0;

System.out.println("==============Double2018=====");

//double[] arrayOfDouble = { (-1.0D / 0.0D), -1.797693134862316E+308D, -1.0D, -4.940656458412465E-324D, -0.0D, 0.0D, 4.9E-324D, 1.0D, 1.7976931348623157E+308D, (1.0D / 0.0D), (0.0D / 0.0D) };
double[] arrayOfDouble = { (-1.0D / 0.0D), -1.797693134862316E+30D, -1.0D, -4.940656458412465E-324D, -0.0D, 0.0D, 4.9E-324D, 1.0D, 1.7976931348623157E+308D, (1.0D / 0.0D), (0.0D / 0.0D) };
//String[] arrayOfString = { "-Infinity", "-1.7976931348623157E308", "-1.0", "-4.9E-324", "-0.0", "0.0", "4.9E-324", "1.0", "1.7976931348623157E308", "Infinity", "NaN" };
String[] arrayOfString = { "-Infinity", "-1.797693134862316E30", "-1.0", "-4.9E-324", "-0.0", "0.0", "4.9E-324", "1.0", "1.7976931348623157E308", "Infinity", "NaN" };

for (int j = 0; j < arrayOfDouble.length; ++j) {
String str = Double.toString(arrayOfDouble[j]);
if (!(str.equals(arrayOfString[j]))) {
++i;
System.out.println("For " + arrayOfDouble[j] + " returned " + str + " instead of " + arrayOfString[j]);
}
}

if (i > 0){
System.out.println(i + " problems found in public static String toString(double x)");
return 0;
}

System.out.println("OKAY");

return 1;
}

}

TestMathCos.java:
import java.io.PrintStream;

public class TestMathCos {

public static void main(String[] args)
{
Math2001();
Math2002();
Math2003();
Math2004();
Math2005();
}

public static int Math2001()
{
String str = "Math2001";
System.out.println(str);
test_engine2 localtest_engine = new test_engine2(System.out, System.out);
localtest_engine.fcn = "cos";
localtest_engine.testcase = str;
localtest_engine.test_cos(-4604611780675359464L, 4607182418800017408L);
localtest_engine.test_cos(-4604623039674427890L, 4607181968443807658L);
localtest_engine.test_cos(-4604634298673496316L, 4607180617420213654L);
localtest_engine.test_cos(-4604645557672564742L, 4607178365864336630L);
localtest_engine.test_cos(-4604656816671633168L, 4607175214001330296L);
localtest_engine.test_cos(-4604668075670701594L, 4607171162146378328L);
localtest_engine.test_cos(-4604679334669770020L, 4607166210704662843L);
localtest_engine.test_cos(-4604690593668838446L, 4607160360171323888L);
localtest_engine.test_cos(-4604701852667906872L, 4607153611131409920L);
localtest_engine.test_cos(-4604713111666975298L, 4607145964259819306L);
localtest_engine.test_cos(-4604724370666043724L, 4607137420321232834L);
localtest_engine.test_cos(-4604735629665112150L, 4607127980170037242L);
localtest_engine.test_cos(-4604746888664180576L, 4607117644750239784L);
localtest_engine.test_cos(-4604758147663249002L, 4607106415095373824L);
localtest_engine.test_cos(-4604769406662317428L, 4607094292328395494L);
localtest_engine.test_cos(-4604780665661385854L, 4607081277661571387L);
localtest_engine.test_cos(-4604791924660454280L, 4607067372396357342L);
localtest_engine.test_cos(-4604803183659522706L, 4607052577923268291L);
localtest_engine.test_cos(-4604814442658591132L, 4607036895721739214L);
localtest_engine.test_cos(-4604825701657659558L, 4607020327359977198L);
localtest_engine.test_cos(-4604836960656727984L, 4607002874494804609L);
localtest_engine.test_cos(-4604848219655796410L, 4606984538871493423L);
localtest_engine.test_cos(-4604859478654864836L, 4606965322323590690L);
localtest_engine.test_cos(-4604870737653933262L, 4606945226772735186L);
localtest_engine.test_cos(-4604881996653001688L, 4606924254228465252L);
localtest_engine.test_cos(-4604893255652070114L, 4606902406788017837L);
localtest_engine.test_cos(-4604904514651138540L, 4606879686636118779L);
localtest_engine.test_cos(-4604915773650206966L, 4606856096044764336L);
localtest_engine.test_cos(-4604927032649275392L, 4606831637372993984L);
localtest_engine.test_cos(-4604938291648343818L, 4606806313066654517L);
localtest_engine.print_final_results();
if (localtest_engine.tests_failed == 0){
System.out.println("No errors");
return 1;
}

System.out.println("Check log");
return -1;
}

public static int Math2002()
{
String str = "Math2002";
System.out.println(str);
test_engine2 localtest_engine = new test_engine2(System.out, System.out);
localtest_engine.fcn = "cos";
localtest_engine.testcase = str;
localtest_engine.test_cos(-4604949550647412244L, 4606780125658155467L);
localtest_engine.test_cos(-4604960809646480670L, 4606753077766215860L);
localtest_engine.test_cos(-4604972068645549096L, 4606725172095602350L);
localtest_engine.test_cos(-4604983327644617522L, 4606696411436858744L);
localtest_engine.test_cos(-4604994586643685948L, 4606666798666026950L);
localtest_engine.test_cos(-4605005845642754374L, 4606636336744359374L);
localtest_engine.test_cos(-4605017104641822800L, 4606605028718022796L);
localtest_engine.test_cos(-4605028363640891226L, 4606572877717793761L);
localtest_engine.test_cos(-4605039622639959652L, 4606539886958745500L);
localtest_engine.test_cos(-4605050881639028078L, 4606506059739926425L);
localtest_engine.test_cos(-4605062140638096504L, 4606471399444030229L);
localtest_engine.test_cos(-4605073399637164930L, 4606435909537057617L);
localtest_engine.test_cos(-4605084658636233356L, 4606399593567969713L);
localtest_engine.test_cos(-4605095917635301782L, 4606362455168333162L);
localtest_engine.test_cos(-4605107176634370208L, 4606324498051956978L);
localtest_engine.test_cos(-4605118435633438634L, 4606285726014521170L);
localtest_engine.test_cos(-4605129694632507060L, 4606246142933197170L);
localtest_engine.test_cos(-4605140953631575486L, 4606205752766260125L);
localtest_engine.test_cos(-4605152212630643912L, 4606164559552693070L);
localtest_engine.test_cos(-4605163471629712338L, 4606122567411783035L);
localtest_engine.test_cos(-4605174730628780764L, 4606079780542709117L);
localtest_engine.test_cos(-4605185989627849190L, 4606036203224122568L);
localtest_engine.test_cos(-4605197248626917616L, 4605991839813718932L);
localtest_engine.test_cos(-4605208507625986042L, 4605946694747802280L);
localtest_engine.test_cos(-4605219766625054468L, 4605900772540841584L);
localtest_engine.test_cos(-4605231025624122894L, 4605854077785019271L);
localtest_engine.test_cos(-4605242284623191320L, 4605806615149772010L);
localtest_engine.test_cos(-4605253543622259746L, 4605758389381323775L);
localtest_engine.test_cos(-4605264802621328172L, 4605709405302211223L);
localtest_engine.test_cos(-4605276061620396598L, 4605659667810801444L);
localtest_engine.print_final_results();
if (localtest_engine.tests_failed == 0){
System.out.println("No errors");
return 1;
}

System.out.println("Check log");

return -1;
}

public static int Math2003()
{
String str = "Math2003";
System.out.println(str);
test_engine2 localtest_engine = new test_engine2(System.out, System.out);
localtest_engine.fcn = "cos";
localtest_engine.testcase = str;
localtest_engine.test_cos(-4605287320619465024L, 4605609181880802132L);
localtest_engine.test_cos(-4605298579618533450L, 4605557952560764216L);
localtest_engine.test_cos(-4605309838617601876L, 4605505984973577008L);
localtest_engine.test_cos(-4605321097616670302L, 4605453284315955921L);
localtest_engine.test_cos(-4605332356615738728L, 4605399855857922800L);
localtest_engine.test_cos(-4605343615614807154L, 4605345704942278924L);
localtest_engine.test_cos(-4605354874613875580L, 4605290836984070732L);
localtest_engine.test_cos(-4605366133612944006L, 4605235257470048323L);
localtest_engine.test_cos(-4605377392612012432L, 4605178971958116782L);
localtest_engine.test_cos(-4605388651611080858L, 4605121986076780398L);
localtest_engine.test_cos(-4605399910610149284L, 4605064305524579816L);
localtest_engine.test_cos(-4605411169609217710L, 4605005936069522189L);
localtest_engine.test_cos(-4605422428608286136L, 4604946883548504383L);
localtest_engine.test_cos(-4605433687607354562L, 4604887153866729289L);
localtest_engine.test_cos(-4605444946606422988L, 4604826752997115309L);
localtest_engine.test_cos(-4605456205605491414L, 4604765686979699072L);
localtest_engine.test_cos(-4605467464604559840L, 4604703961921031430L);
localtest_engine.test_cos(-4605478723603628266L, 4604641583993566813L);
localtest_engine.test_cos(-4605489982602696692L, 4604578559435045986L);
localtest_engine.test_cos(-4605501241601765118L, 4604514894547872282L);
localtest_engine.test_cos(-4605512500600833544L, 4604450595698481362L);
localtest_engine.test_cos(-4605523759599901970L, 4604385669316704584L);
localtest_engine.test_cos(-4605535018598970396L, 4604320121895126022L);
localtest_engine.test_cos(-4605546277598038822L, 4604253959988433210L);
localtest_engine.test_cos(-4605557536597107248L, 4604187190212761682L);
localtest_engine.test_cos(-4605568795596175674L, 4604119819245033364L);
localtest_engine.test_cos(-4605580054595244100L, 4604051853822288887L);
localtest_engine.test_cos(-4605591313594312526L, 4603983300741013888L);
localtest_engine.test_cos(-4605602572593380952L, 4603914166856459366L);
localtest_engine.test_cos(-4605613831592449378L, 4603844459081956167L);
localtest_engine.print_final_results();
if (localtest_engine.tests_failed == 0){
System.out.println("No errors");
return 1;
}

System.out.println("Check log");
return -1;
}

public static int Math2004()
{
String str = "Math2004";
System.out.println(str);
test_engine2 localtest_engine = new test_engine2(System.out, System.out);
localtest_engine.fcn = "cos";
localtest_engine.testcase = str;
localtest_engine.test_cos(-4605625090591517804L, 4603774184388223650L);
localtest_engine.test_cos(-4605636349590586230L, 4603703349802672627L);
localtest_engine.test_cos(-4605647608589654656L, 4603631962408702624L);
localtest_engine.test_cos(-4605658867588723082L, 4603560029344993549L);
localtest_engine.test_cos(-4605670126587791508L, 4603487557804791829L);
localtest_engine.test_cos(-4605681385586859934L, 4603414555035191092L);
localtest_engine.test_cos(-4605692644585928360L, 4603341028336407461L);
localtest_engine.test_cos(-4605703903584996786L, 4603266985061049543L);
localtest_engine.test_cos(-4605715162584065212L, 4603192432613383172L);
localtest_engine.test_cos(-4605726421583133638L, 4603117378448590987L);
localtest_engine.test_cos(-4605737680582202064L, 4603041830072026923L);
localtest_engine.test_cos(-4605748939581270490L, 4602965795038465679L);
localtest_engine.test_cos(-4605760198580338916L, 4602889280951347249L);
localtest_engine.test_cos(-4605771457579407342L, 4602812295462016584L);
localtest_engine.test_cos(-4605782716578475768L, 4602734846268958461L);
localtest_engine.test_cos(-4605793975577544194L, 4602635063061408381L);
localtest_engine.test_cos(-4605805234576612620L, 4602478356420701914L);
localtest_engine.test_cos(-4605816493575681046L, 4602320769113684088L);
localtest_engine.test_cos(-4605827752574749472L, 4602162316898954286L);
localtest_engine.test_cos(-4605839011573817898L, 4602003015621601936L);
localtest_engine.test_cos(-4605850270572886324L, 4601842881211622023L);
localtest_engine.test_cos(-4605861529571954750L, 4601681929682322100L);
localtest_engine.test_cos(-4605872788571023176L, 4601520177128720971L);
localtest_engine.test_cos(-4605884047570091602L, 4601357639725939204L);
localtest_engine.test_cos(-4605895306569160028L, 4601194333727581628L);
localtest_engine.test_cos(-4605906565568228454L, 4601030275464111992L);
localtest_engine.test_cos(-4605917824567296880L, 4600865481341219928L);
localtest_engine.test_cos(-4605929083566365306L, 4600699967838180398L);
localtest_engine.test_cos(-4605940342565433732L, 4600533751506205776L);
localtest_engine.test_cos(-4605951601564502158L, 4600366848966790749L);
localtest_engine.print_final_results();
if (localtest_engine.tests_failed == 0){
System.out.println("No errors");
return 1;
}

System.out.println("Check log");

return -1;
}

public static int Math2005()
{
String str = "Math2005";
System.out.println(str);
test_engine2 localtest_engine = new test_engine2(System.out, System.out);
localtest_engine.fcn = "cos";
localtest_engine.testcase = str;
localtest_engine.test_cos(-4605962860563570584L, 4600199276910050173L);
localtest_engine.test_cos(-4605974119562639010L, 4600031052093050078L);
localtest_engine.test_cos(-4605985378561707436L, 4599862191338131977L);
localtest_engine.test_cos(-4605996637560775862L, 4599692711531230647L);
localtest_engine.test_cos(-4606007896559844288L, 4599522629620185543L);
localtest_engine.test_cos(-4606019155558912714L, 4599351962613046037L);
localtest_engine.test_cos(-4606030414557981140L, 4599180727576370620L);
localtest_engine.test_cos(-4606041673557049566L, 4599008941633520264L);
localtest_engine.test_cos(-4606052932556117992L, 4598836621962946101L);
localtest_engine.test_cos(-4606064191555186418L, 4598663785796471587L);
localtest_engine.test_cos(-4606075450554254844L, 4598490450417569341L);
localtest_engine.test_cos(-4606086709553323270L, 4598316633159632807L);
localtest_engine.test_cos(-4606097968552391696L, 4598109483263209449L);
localtest_engine.test_cos(-4606109227551460122L, 4597760025613583626L);
localtest_engine.test_cos(-4606120486550528548L, 4597409708770585479L);
localtest_engine.test_cos(-4606131745549596974L, 4597058567765607378L);
localtest_engine.test_cos(-4606143004548665400L, 4596706637712457204L);
localtest_engine.test_cos(-4606154263547733826L, 4596353953803846998L);
localtest_engine.test_cos(-4606165522546802252L, 4596000551307873719L);
localtest_engine.test_cos(-4606176781545870678L, 4595646465564492464L);
localtest_engine.test_cos(-4606188040544939104L, 4595291731981982498L);
localtest_engine.test_cos(-4606199299544007530L, 4594936386033406465L);
localtest_engine.test_cos(-4606210558543075956L, 4594580463253063099L);
localtest_engine.test_cos(-4606221817542144382L, 4594223999232933835L);
localtest_engine.test_cos(-4606233076541212808L, 4593867029619123633L);
localtest_engine.test_cos(-4606244335540281234L, 4593347560298686880L);
localtest_engine.test_cos(-4606255594539349660L, 4592631812970304788L);
localtest_engine.test_cos(-4606266853538418086L, 4591915268909331453L);
localtest_engine.test_cos(-4606278112537486512L, 4591197999769575855L);
localtest_engine.test_cos(-4606289371536554938L, 4590480077277354247L);
localtest_engine.print_final_results();
if (localtest_engine.tests_failed == 0){
System.out.println("No errors");

return 1;
}

System.out.println("Check log");

return -1;
}
}

class test_engine2
{
public int tests;
public int tests_failed;
String fcn = "none";
String testcase;
PrintStream log;
PrintStream out;

public test_engine2(PrintStream paramPrintStream1, PrintStream paramPrintStream2)
{
this.log = paramPrintStream1;
this.out = paramPrintStream2;
}

protected void print_result(String paramString, long paramLong1, long paramLong2, long paramLong3) {
double d1 = Double.longBitsToDouble(paramLong3);
double d2 = Double.longBitsToDouble(paramLong2);

this.tests += 1;

if ((d1 == d2) || ((Double.isNaN(d1)) && (Double.isNaN(d2))))
{
return; }
if ((Double.isNaN(d1)) || (Double.isNaN(d2)) || (paramString.equals("sqrt")) || (!(check_ulp_diff(d2, d1, 1))))
{
this.tests_failed += 1;
this.log.print(this.testcase + " : " + paramString + " failed for ");
this.log.print(toHexString(paramLong1));
this.log.print(" Expected ");
this.log.print(toHexString(paramLong2) + " +/- 1 ulp");
this.log.print(" Got: ");
this.log.println(toHexString(paramLong3));
}
}

protected void print_result(String paramString, long paramLong1, long paramLong2, long paramLong3, long paramLong4)
{
double d1 = Double.longBitsToDouble(paramLong4);
double d2 = Double.longBitsToDouble(paramLong3);

this.tests += 1;

if ((d1 == d2) || ((Double.isNaN(d1)) && (Double.isNaN(d2))))
{
return; }
if ((Double.isNaN(d1)) || (Double.isNaN(d2)) || (paramString.equals("IEEEremainder")) || ((!(check_ulp_diff(d2, d1, 1))) && (!(paramString.equals("atan2")))) || ((!(check_ulp_diff(d2, d1, 2))) && (paramString.equals("atan2"))))
{
this.tests_failed += 1;
this.log.print(this.testcase + " : " + paramString + " failed for ");
this.log.print(toHexString(paramLong1) + " , " + toHexString(paramLong2));
this.log.print(" Expected ");
this.log.print(toHexString(paramLong3) + " +/- accuracy");
this.log.print(" Got: ");
this.log.println(toHexString(paramLong4));
}
}

public void test_sin(long paramLong1, long paramLong2) {
long l = Double.doubleToLongBits(Math.sin(Double.longBitsToDouble(paramLong1)));
print_result("sin", paramLong1, paramLong2, l);
}

public void test_cos(long paramLong1, long paramLong2) {
long l = Double.doubleToLongBits(Math.cos(Double.longBitsToDouble(paramLong1)));
print_result("cos", paramLong1, paramLong2, l);
}

public void test_tan(long paramLong1, long paramLong2) {
long l = Double.doubleToLongBits(Math.tan(Double.longBitsToDouble(paramLong1)));
print_result("tan", paramLong1, paramLong2, l);
}

public void test_sqrt(long paramLong1, long paramLong2) {
long l = Double.doubleToLongBits(Math.sqrt(Double.longBitsToDouble(paramLong1)));
print_result("sqrt", paramLong1, paramLong2, l);
}

public void print_final_results()
{
this.log.println(" failed " + this.tests_failed + " out of " + " tests");
}

public static double ulp(double paramDouble)
{
double d = 0.0D;
long l = (Double.doubleToLongBits(paramDouble) & 0x0) >> 52;

if ((paramDouble != 0.0D) && (Math.abs(paramDouble) > Double.longBitsToDouble(4503599627370495L)))
{
d = power2(l - 1023L - 52L);
}
else d = power2(-1074L);

return d;
}

public static double power2(long paramLong)
{
double d = 0.0D;
long l1 = 0L;
long l2 = 0L;

if (paramLong + 1023L <= 0L) {
l2 = 1L << (int)(51L + 1023L + paramLong);
l1 |= l2;
} else {
l1 = paramLong + 1023L << 52;
}
d = Double.longBitsToDouble(l1);

return d;
}

public static boolean check_ulp_diff(double paramDouble1, double paramDouble2, int paramInt)
{
double d1 = ulp(paramDouble1);
double d2 = 0.0D;

for (int i = 0; i < paramInt; ++i) {
d2 += d1;
}

return (Math.abs(paramDouble1 - paramDouble2) <= d2);
}

public static String toHexString(long paramLong)
{
char[] arrayOfChar = new char[130];
int i = 130;
long l = paramLong;
while ((i > 2) && (l != 0L)) {
--i;
int j = (byte)((byte)(int)l & 0xF);
switch (j) {
case 0:
arrayOfChar[i] = '0'; break;
case 1:
arrayOfChar[i] = '1'; break;
case 2:
arrayOfChar[i] = '2'; break;
case 3:
arrayOfChar[i] = '3'; break;
case 4:
arrayOfChar[i] = '4'; break;
case 5:
arrayOfChar[i] = '5'; break;
case 6:
arrayOfChar[i] = '6'; break;
case 7:
arrayOfChar[i] = '7'; break;
case 8:
arrayOfChar[i] = '8'; break;
case 9:
arrayOfChar[i] = '9'; break;
case 10:
arrayOfChar[i] = 'a'; break;
case 11:
arrayOfChar[i] = 'b'; break;
case 12:
arrayOfChar[i] = 'c'; break;
case 13:
arrayOfChar[i] = 'd'; break;
case 14:
arrayOfChar[i] = 'e'; break;
case 15:
arrayOfChar[i] = 'f';
}
l >>>= 4;
}
arrayOfChar[(--i)] = 'x';
arrayOfChar[(--i)] = '0';
return new String(arrayOfChar, i, 130 - i);
}
}

TestMathCeil.java:

public class TestMathCeil {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Math0003();
}

public static int Math0003()
{

System.out.println("=============Math0003=====\n");
//double[] arrayOfDouble = { (-1.0D / 0.0D), -1.797693134862316E+308D, -1025.0D, -1024.0D, -1023.0D, -256.0D, -255.0D, -254.0D, -1.0D, -Double.MIN_VALUE, -0.0D, 0.0D, Double.MIN_VALUE, 1.0D, 254.0D, 255.0D, 256.0D, 1023.0D, 1024.0D, 1025.0D, 1.7976931348623157E+308D, (1.0D / 0.0D) };
double[] arrayOfDouble = { (-1.0D / 0.0D), -1.797693134862316E+30D, -1025.0D, -1024.0D, -1023.0D, -256.0D, -255.0D, -254.0D, -1.0D, -Double.MIN_VALUE, -0.0D, 0.0D, Double.MIN_VALUE, 1.0D, 254.0D, 255.0D, 256.0D, 1023.0D, 1024.0D, 1025.0D, 1.7976931348623157E+308D, (1.0D / 0.0D) };
int i = 0;

for (int j = 0; j < arrayOfDouble.length; ++j) {
double d2;
double d1 = arrayOfDouble[j];

if ((d1 > -1.0D) && (d1 < 1.0D)) {
d2 = 0.0D;
}
else
d2 = -0.5D;

if ((d1 > 0.0D) && (d1 < 1.0D))
d1 = 1.0D;

if ((d1 > -1.0D) && (d1 < -0.0D))
d1 = -0.0D;

if ((Math.ceil(arrayOfDouble[j]) != d1) || (Math.ceil(arrayOfDouble[j] + d2) != d1)) {
i = 1;
System.out.println("Failed with " + arrayOfDouble[j] + " != check.");
}

Double localDouble1 = new Double(Math.ceil(arrayOfDouble[j]));
Double localDouble2 = new Double(Math.ceil(arrayOfDouble[j] + d2));
Double localDouble3 = new Double(d1);
if (localDouble1.equals(localDouble3)) { if (d2 != 0.0D) if (localDouble2.equals(localDouble3));
} else {
i = 1;
System.out.println("Failed with " + arrayOfDouble[j] + " equals() check.");
}
}

if (i != 0){
System.out.println("public static strictfp double ceil(double a)");
return -1;
}

System.out.println("OKAY");

return 1;
}

}

aimself
Offline
Joined: 2009-05-31
Points: 0

the arm-linux-g++ -v:

Reading specs from /opt/ACCESS/NEC/mp2xx/lib/gcc/arm-linux/3.4.6/specs
Configured with: ../configure --target=arm-linux --prefix=/opt/ACCESS/NEC/mp2xx --program-prefix=arm-linux- --disable-threads --disable-shared --enable-languages=c --with-float=soft --enable-interwork --enable-multilib --with-arch=armv5t --with-cpu=arm926ej_s --with-tune=arm926ejs : (reconfigured) ../configure --target=arm-linux --prefix=/opt/ACCESS/NEC/mp2xx --program-prefix=arm-linux- --enable-multilib --enable-languages=c,c++ --enable-threads=posix --enable-shared --enable-interwork --with-float=soft --with-cpu=arm926ej_s --with-interwork --with-arch=armv5t --with-tune=arm926ejs
Thread model: posix
gcc version 3.4.6

danila
Offline
Joined: 2006-09-25
Points: 0

Try to disable strict aliasing gcc optimization with -fno-strict-aliasing and check if it helps.

aimself
Offline
Joined: 2009-05-31
Points: 0

Thanks,danila,I have compiled cldc with -fno-strict-aliasing ,now we run the TestFloatValue and the result is right,but we run the cldc1.1 tck,it still has some fails,such as Math.cos,Math.ceil and so on.
I have write a test for the Math.cesil,and run on the midp,it can't run rightly,the result is:
java.lang.RuntimeException
- java.lang.FloatingDecimal.dtoa(), bci=792
- java.lang.FloatingDecimal.(), bci=206
- java.lang.Double.toString(), bci=5
- java.lang.String.valueOf(), bci=1
- java.lang.StringBuffer.append(), bci=2
- java.lang.Double.(), bci=17
- TestMathCeil.Math0003(), bci=305
- TestMathCeil.startApp(), bci=1
- javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1
- com.sun.midp.midlet.MIDletPeer.startApp(), bci=4
- com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=245
- com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=39
- com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=5
- com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=134
- com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26

the source of the TestMathCeil.java is below:

import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class TestMathCeil extends MIDlet {

public TestMathCeil() {
// TODO Auto-generated constructor stub
}

protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO Auto-generated method stub

}

protected void pauseApp() {
// TODO Auto-generated method stub

}

protected void startApp() throws MIDletStateChangeException {
// TODO Auto-generated method stub
Math0003();
}

public int Math0003()
{

System.out.println("=============Math0003=====\n");
//double[] arrayOfDouble = { (-1.0D / 0.0D), -1.797693134862316E+308D, -1025.0D, -1024.0D, -1023.0D, -256.0D, -255.0D, -254.0D, -1.0D, -Double.MIN_VALUE, -0.0D, 0.0D, Double.MIN_VALUE, 1.0D, 254.0D, 255.0D, 256.0D, 1023.0D, 1024.0D, 1025.0D, 1.7976931348623157E+308D, (1.0D / 0.0D) };
double[] arrayOfDouble = { (-1.0D / 0.0D), -1.797693134862316E+30D, -1025.0D, -1024.0D, -1023.0D, -256.0D, -255.0D, -254.0D, -1.0D, -Double.MIN_VALUE, -0.0D, 0.0D, Double.MIN_VALUE, 1.0D, 254.0D, 255.0D, 256.0D, 1023.0D, 1024.0D, 1025.0D, 1.7976931348623157E+308D, (1.0D / 0.0D) };
int i = 0;

for (int j = 0; j < arrayOfDouble.length; ++j) {
double d2;
double d1 = arrayOfDouble[j];

if ((d1 > -1.0D) && (d1 < 1.0D)) {
d2 = 0.0D;
}
else
d2 = -0.5D;

if ((d1 > 0.0D) && (d1 < 1.0D))
d1 = 1.0D;

if ((d1 > -1.0D) && (d1 < -0.0D))
d1 = -0.0D;

if ((Math.ceil(arrayOfDouble[j]) != d1) || (Math.ceil(arrayOfDouble[j] + d2) != d1)) {
i = 1;
System.out.println("Failed with " + arrayOfDouble[j] + " != check.");
}

Double localDouble1 = new Double(Math.ceil(arrayOfDouble[j]));
Double localDouble2 = new Double(Math.ceil(arrayOfDouble[j] + d2));
Double localDouble3 = new Double(d1);
if (localDouble1.equals(localDouble3)) { if (d2 != 0.0D) if (localDouble2.equals(localDouble3));
} else {
i = 1;
System.out.println("Failed with " + arrayOfDouble[j] + " equals() check.");
}
}

if (i != 0){
System.out.println("public static strictfp double ceil(double a)");
return -1;
}

System.out.println("OKAY");

return 1;
}
}

can you know why?