[ECOS] libm on SH7750.
Jonathan Larmour
jifl@eCosCentric.com
Fri Oct 18 21:17:00 GMT 2002
ryosuke-tajima@mosk.tytlabs.co.jp wrote:
> Hi, all. Thanks for very useful advice in this mailing list, and now I
> have another problem.
>
> I want to use math library on SH7750 system. I cannot get correct
> result from some math function (sin, cos, and sqrt) in my program. The
> result of multiply, division, plus and minus operation for floating
> value is correct.
>
> The sh-elf-gcc has several switch for floating operation, then, I
> tried some math tests in eCos package with gcc switch -m4, -m4-single,
> -m4-single-only. Result was:
>
>
> -m4:
> sqrt.c: passed.
> cos.c, sin.c: hang up.
>
> -m4-single:
> sqrt.c: passed.
> cos.c, sin.c: torelance error.
>
> -m4-single-only:
> Cannot compile because of an error "IEEE-style 64-bit
> doubles are required to use the math library"
>
> How can I use math library on SH4? Had anyone made these function work
> correctly?
Given your follow up message, then I assume you have a hardware FPU.
Taking a brief look at the GCC docs, it appears that the correct setting
of -m4 versus -m4-single is a property of whether the FPU has been set up
in single or double precision mode by default. You should find out which
of these is the case.
The fact that -m4-single at least doesn't hang is _something_ in its
favour. The fact it gets a tolerance error may not necessarily mean
there's a problem - the maths tests only work by checking if a returned
value is withing an acceptable tolerance. It's possible that that in
single precision mode, the results are not quite accurate enough and hence
the tests fail. That's a good line of inquiry for you to check anyway.
Jifl
--
eCosCentric http://www.eCosCentric.com/ <info@eCosCentric.com>
--[ "You can complain because roses have thorns, or you ]--
--[ can rejoice because thorns have roses." -Lincoln ]-- Opinions==mine
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
More information about the Ecos-discuss
mailing list