* Sign of tanh ???
@ 2001-04-21 11:35 Bobby D. Bryant
2001-04-22 14:56 ` Wilhelm Spickermann
0 siblings, 1 reply; 3+ messages in thread
From: Bobby D. Bryant @ 2001-04-21 11:35 UTC (permalink / raw)
Isn't tanh supposed to preserve the sign of its argument?
---8<-------
with
Ada.Float_Text_IO,
Ada.Numerics.Elementary_Functions;
use
Ada.Float_Text_IO,
Ada.Numerics.Elementary_Functions;
procedure Test is
begin
Put( Tanh( 0.5 ), Fore => 3, Exp => 0 );
Put( Tanh( -0.5 ), Fore => 3, Exp => 0 );
end Test;
---8<-------
% gnatmake test
gnatgcc -c test.adb
gnatbind -x test.ali
gnatlink test.ali
gnatlink: warning: executable name "test" may conflict with existing
command
% ./test
0.46212 0.46212
% rpm -q gnat
gnat-3.13p-5
Thanks,
Bobby Bryant
Austin, Texas
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Sign of tanh ???
2001-04-22 14:56 ` Wilhelm Spickermann
@ 2001-04-22 7:12 ` Bobby D. Bryant
0 siblings, 0 replies; 3+ messages in thread
From: Bobby D. Bryant @ 2001-04-22 7:12 UTC (permalink / raw)
Wilhelm Spickermann wrote:
> On 21-Apr-01 Bobby D. Bryant wrote:
> > Isn't tanh supposed to preserve the sign of its argument?
>
> Sure. But I get the result
> 0.46212 -0.46212
> and I use the gnat-3.13p-5 rpm (from ALT) too.
>
> Perhaps it´s the C-library. Gnat uses the C-Library to compute the tanh (if
> the result cannot be easily found to be -1.0 1.0 or the argument). Does the
> problem occur in C too?
No, it works OK in C.
Odd...
Bobby Bryant
Austin, Texas
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: Sign of tanh ???
2001-04-21 11:35 Sign of tanh ??? Bobby D. Bryant
@ 2001-04-22 14:56 ` Wilhelm Spickermann
2001-04-22 7:12 ` Bobby D. Bryant
0 siblings, 1 reply; 3+ messages in thread
From: Wilhelm Spickermann @ 2001-04-22 14:56 UTC (permalink / raw)
To: comp.lang.ada
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 383 bytes --]
On 21-Apr-01 Bobby D. Bryant wrote:
> Isn't tanh supposed to preserve the sign of its argument?
Sure. But I get the result
0.46212 -0.46212
and I use the gnat-3.13p-5 rpm (from ALT) too.
Perhaps it�s the C-library. Gnat uses the C-Library to compute the tanh (if
the result cannot be easily found to be -1.0 1.0 or the argument). Does the
problem occur in C too?
Wilhelm
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-04-22 14:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-21 11:35 Sign of tanh ??? Bobby D. Bryant
2001-04-22 14:56 ` Wilhelm Spickermann
2001-04-22 7:12 ` Bobby D. Bryant
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox