# BBC BASIC Programmers' Reference

### Site Tools

using_2032-bit_20floating_20point_20values

# Differences

This shows you the differences between two versions of the page.

 using_2032-bit_20floating_20point_20values [2018/03/31 13:19]127.0.0.1 external edit using_2032-bit_20floating_20point_20values [2018/04/17 19:24] (current)tbest3112 Added syntax highlighting 2018/04/17 19:24 tbest3112 Added syntax highlighting2018/03/31 13:19 external edit 2018/04/17 19:24 tbest3112 Added syntax highlighting2018/03/31 13:19 external edit Line 6: Line 6: * **FN_ConvertFromSingle** converts a number from a single precision floating point value * **FN_ConvertFromSingle** converts a number from a single precision floating point value \\ \\ + DEF FN_ConvertToSingle(A#​) DEF FN_ConvertToSingle(A#​) LOCAL A%,P% LOCAL A%,P% Line 40: Line 41: CALL F%,A%,A# CALL F%,A%,A# =A# =A# + ​ \\ **Note:** **FN_ConvertToSingle** is the same routine as **FN_f4** from the supplied //D3DLIB// library, but the assembly language has been commented and the name has been changed for clarity.\\ \\ **Note:** **FN_ConvertToSingle** is the same routine as **FN_f4** from the supplied //D3DLIB// library, but the assembly language has been commented and the name has been changed for clarity.\\ ---- ---- \\ //by Richard Russell, November 2006//\\ \\  The above routines use assembly language code to perform the conversion. An alternative is to use Windows API functions as follows:\\ \\ \\ //by Richard Russell, November 2006//\\ \\  The above routines use assembly language code to perform the conversion. An alternative is to use Windows API functions as follows:\\ \\ + DEF FN_ConvertToSingle(A#​) DEF FN_ConvertToSingle(A#​) LOCAL A% LOCAL A% Line 63: Line 66: SYS F%,A%,^A# SYS F%,A%,^A# =A# =A# + ​ If speed is critical, use this conversion function:​\\ ​ If speed is critical, use this conversion function:​\\ ​ + DEF FN_ConvertToSingle(A#​)=USR(f4) DEF FN_ConvertToSingle(A#​)=USR(f4) + ​ where the routine **f4** has been assembled previously as follows:​\\ ​ where the routine **f4** has been assembled previously as follows:​\\ ​ + .f4 .f4 mov   ​ecx,​[^A#​+4] mov   ​ecx,​[^A#​+4] Line 94: Line 101: pop   eax pop   eax ret ret + ​ Ensure there is at least a 2048-byte gap between the code and any writable data, to prevent thrashing of the instruction cache. Ensure there is at least a 2048-byte gap between the code and any writable data, to prevent thrashing of the instruction cache.