C language > Tips & tricks

Berkeley SoftFloat

<< < (2/3) > >>

jack:
for input/output I use ioldouble from http://www.moshier.net/#Rubid_pc filename smldbl12.zip

jack:
I built the softfloat lib with ioldouble included, but can't compile this simple example

--- Code: ---#include <stdio.h>
#include "SoftFloat.h"
#include "primitiveTypes.h"

extern void e64toasc(extFloat80_t *x, char *string, int ndigs);
extern void asctoe64( char *s, extFloat80_t *x );

int __cdecl main(int argc, char **argv)
{
char buf[128]="3.1415926535897932384626433832795";
extFloat80_t f80;
asctoe64( buf, &f80 );
e64toasc( &f80, buf, 10 );
printf("%s\n",buf);
return 0;
}

--- End code ---
POLINK: error: Unresolved external symbol 'alloca'

TimoVJL:
add
--- Code: ---#include <stdlib.h>
--- End code ---
and use compiler option -Go Define compatibility names.

jack:
I already tried that but no luck, gcc has no problem.

jack:
your advise is good, but it also had to be applied to building the soft float lib, now it works without complaints.

--- Code: ---#include <stdio.h>
#include <stdlib.h>

#include "SoftFloat.h"
#include "primitiveTypes.h"

extern void e64toasc(extFloat80_t *x, char *string, int ndigs);
extern void asctoe64( char *s, extFloat80_t *x );
extern void e113toasc(float128_t *x, char *string, int ndigs);
extern void asctoe113( char *s, float128_t *x );

int __cdecl main(int argc, char **argv)
{
char buf[128]="3.1415926535897932384626433832795028842";
float128_t f128, f128b;
asctoe113( buf, &f128 );
f128M_add(&f128, &f128, &f128b);
e113toasc( &f128b, buf, 33 );
printf("%s\n",buf);
return 0;
}

--- End code ---

--- Quote --- 6.283185307179586476925286766559006E0

--- End quote ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version