C language > Tips & tricks

Berkeley SoftFloat

(1/3) > >>

TimoVJL:
Berkeley SoftFloat support 80-bit and 128-bit floats too.
I try to get it work with PellesC.

example
--- Code: ---#include <stdio.h>
#define SOFTFLOAT_FAST_INT64
#include <SoftFloat.h>
#include <primitiveTypes.h>
#if defined(_WIN64) || __POCC_TARGET__ >= 3
#pragma comment(lib, "SoftFloat3x64.lib")
#else
#pragma comment(lib, "SoftFloat3.lib")
#endif

int __cdecl main(int argc, char **argv)
{
char buf[128];
unsigned char *p;
extFloat80_t f80 = i32_to_extF80( 1 );
extFloat80_t f80s = extF80_add(f80, f80);
p = (unsigned char *)&f80;
for (int i=0; i<10; i++) printf("%02X ", (unsigned char)*p++);
puts("");
p = (unsigned char *)&f80s;
for (int i=0; i<10; i++) printf("%02X ", (unsigned char)*p++);
puts("");
float128_t f128 = ui64_to_f128( 1 );
p = (unsigned char *)&f128;
for (int i=0; i<16; i++) printf("%02X ", (unsigned char)*p++);
puts("");
return 0;
}

--- End code ---
EDIT: missing platform.h and msvcrt_void.c added.
EDIT: project with source in zip TestSoftFloat80_WS_src.zip

To test ready-made libraries, use SoftFloat3_WS_test.zip and SoftFloat3lib.zip as example.

jj2007:
The IDE says
Don't know how to build "C:\Masm32\PellesC\Projects\Timo\SoftFloat\source\extF80_add.c".
 :(
Anything else missing?

TimoVJL:
It was without source.

Downloaded from here

EDIT: project with source in zip TestSoftFloat80_WS_src.zip

jj2007:
Any idea why the IDE tells me "Bad version on TestSoftFloat80X64.ppj"?

TimoVJL:
It happens, if someone opened workspace in poide.exe version 8 (32-bit)

Navigation

[0] Message Index

[#] Next page

Go to full version