Floating point precision (CScriptBuilder?)

Started by
3 comments, last by WitchLord 6 years, 9 months ago

Hi, I've just updated AngelScript in my project from some 2 year old version to newest. Calling CScriptBuilder::BuildModule() now changes floating point precision from one I set in my application. I set this with _controlfp_s to use lower precision. Is there any reason any part of AS or add-on should change it? Does AS require some FP precision to work correctly? Can I set it back to lower precision and not worry? Older version of AS worked with lower precision and didn't change it

Advertisement

AngelScript doesn't require any specific floating point precision. I do not change the floating point precision in the AngelScript code (at least not intentionally). 

Can you locate where exactly in the code it is being changed? 

What platform are you working on? Perhaps there is something wrong in the assembler routines for supporting native calling conventions (as_callfunc_XXX). 

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I'm building for win32, and indeed it is changed somewhere in assembler. It changes in CallCDeclFunction in as_callfunc_x86. It happens in first block of assembler inside of #if defined ASM_INTEL. (when reading that assembler part, I vaguely remember seeing CLEAR_FPU_STACK mentioned somewhere before, quite possibly when I was changing that precision. Maybe that is somehow related?

EDIT: now I see it is defined in AngelScript, so I probably just visited this part of code some time ago

EDIT2: actually, I just checked my older version of AS and found "#define CLEAR_FPU_STACK emms" with commented out "#define CLEAR_FPU_STACK fninit" , which is what is used in newest version. After downloading older version, it seems that I must have changed it and memory of this is getting clearer too

)

Call-stack looks like this, along with some argument values if that helps (some are omitted if I see nothing readable):

CallCDeclFunction (paramSize = 8, func = StringFactory)

CallSystemFunctionNative (descr.name = $str, obj = 0, sysFunc->hostReturnInMemory = false, retQW2 = 0, secondObj = 0)

CallSystemFunction

CContext::ExecuteNext

CContext::Execute

CModule::CallInit

CModule::ResetGlobalVars

CScriptBuilder::Build

 

If there is anything else that could help, let me know

Yes, you should probably use '#define CLEAR_FPU_STACK emms'.

I would set it to emms by default except that I remember getting error reports from some people in the past when using 'emms'. In my own applications it doesn't make a difference either way, so I never could figure out why some people are getting trouble when using 'emms' rather than 'fninit'.

 

 

 

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement