I'm just messing around with making a dll, and I can't make it return a negative float...
its the quadratic equation...
#include "stdafx.h"
#include "math.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
#define MYCOMMAND __declspec ( dllexport )
MYCOMMAND DWORD Tv_Quad( int p , float a, float b, float c )
{
float result;
if (p = 1)
{
result = (( -b ) + sqrt(( b * b ) - ( 4.0f * a * c ))) / ( 2.0f * a );
}
else
{
result = (( -b ) - sqrt(( b * b ) - ( 4.0f * a * c ))) / ( 2.0f * a );
}
return *(DWORD*)&result;
}
it runs in DBpro, and returns the positive float fine, but the negative just returns 0...
any ideas?
Yours Tv.

Click my signature for free webhosting!