Dear Inline users,

I've attempted to use the math functions of the BC library which is built during
the "make" step of Inline::BC. Unfortunately they don't appear to be accessible
from Inline::BC and there doesn't seem to exist an "Inline BC => Config" option
to load these functions.

Below is the Perl code that I've tried to run:

#!/usr/local/bin/perl
#------------------------------------------------------------------------------
# PERL SCRIPT     : sinhcalc.pl
# VERSION         : 1.00.0
# AUTHOR          : Ron Grunwald
# EMAIL           : ron...@yahoo.com.au
# DATE WRITTEN    : Jan 14, 2009
#------------------------------------------------------------------------------
MainFunction: {
   
   use strict;
   use warnings;
   use constant { MAIN_NAME       => q{sinhcalc.pl},
                  BOOL_T          => 1,
                  BOOL_F          => 0,
                  ERR_FLAG        => -1
                };
   use feature  ":5.10";
   use Inline BC => 'DATA',
              PRINT_INFO => 1;

   my ($n, $r);
   for ($n = 1; $n < 6.0; $n += 0.5) {
      $r = bc_sinh( $n );
      say (" N = $n SINH = $r");
   }
}

__DATA__
__BC__

/* Define the BC function sinh(u) */
  define bc_sinh (u) {
    scale = 12
    t = (e(u) - e(-u)) * 0.5
    return ( t )
  }


When this Perl code is executed, the following error messages appear:

<-----------------------Information Section----------------------------------->

Information about the processing of your Inline BC code:

Your source code needs to be compiled. I'll use this build directory:
/home/rong/dvlCorner/perlINL/_Inline/build/sinhcalc_pl_e17e

and I'll install the executable as:
/home/rong/dvlCorner/perlINL/_Inline/lib/auto/sinhcalc_pl_e17e/sinhcalc_pl_e17e.bc


<-----------------------End of Information Section---------------------------->
Runtime error (func=bc_sinh, adr=11): Function e not defined.
 N = 1 SINH = 
Runtime error (func=bc_sinh, adr=11): Function e not defined.
 N = 1.5 SINH = 
Runtime error (func=bc_sinh, adr=11): Function e not defined.
 N = 2 SINH = 
Runtime error (func=bc_sinh, adr=11): Function e not defined.
 N = 2.5 SINH = 
...


In BC itself the "-l" command line option must be supplied in order to
load the math library. The equivalent code in BC language works just
fine, and the code listing is shown below:

/* File: sinhcalc.b */

/* Define the BC function sinh(u) */
  define bc_sinh (u) {
    scale = 12
    t = (e(u) - e(-u)) * 0.5
    return ( t )
  }

for ( n=1; n < 6.0; n += 0.5 )
{   r = bc_sinh( n )
    print " N = ", n
    print " SINH = ", r
    print "\n"
}


When this code is executed with the command-line "bc -l sinhcalc.b",
it runs successfully and generates the following output:

bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
 N = 1 SINH = 1.175201193644
 N = 1.5 SINH = 2.129279455095
 N = 2.0 SINH = 3.626860407847
 N = 2.5 SINH = 6.050204481040
 N = 3.0 SINH = 10.017874927410
 N = 3.5 SINH = 16.542627287635
 N = 4.0 SINH = 27.289917197128
 N = 4.5 SINH = 45.003011151991
 N = 5.0 SINH = 74.203210577788
 N = 5.5 SINH = 122.343922746391


I will also log this problem as a bug report on rt.cpan.org.

 
Kind regards,
Ron.
[ron...@yahoo.com.au, ron.grunw...@ecu.edu.au]



      Stay connected to the people that matter most with a smarter inbox. Take 
a look http://au.docs.yahoo.com/mail/smarterinbox

Reply via email to