Brian Dunning's FileMaker Custom Functions

GetAsDouble ( text )

Return text as a double precision floating-point number with 16 digits to the right of the decimal point. Useful when comparing field values to variables, because Decimals are stored with higher precision in fields than in variables.

  Be the first to rate this function Log in to vote

Marcus Nilsson   Marcus Nilsson - Show more from this author
Square Moon
https://www.squaremoon.se/

Share on Facebook Share on Twitter

  Sample input:
GetAsDouble ( 0,33333333333333333 )
  Sample output:
0,3333333333333333

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

/**
* ==================================================================
* GetAsDouble ( text )
*
* PARAMETERS:
* text
* RETURNS:
* (double) Double precision floating-point number with 16 digits to the right of the decimal point
* SETS:
* none
* EXAMPLE:
* GetAsDouble ( 0,33333333333333333 ) = 0,3333333333333333
* DEPENDENCIES:
* GetAsNumber ( text )
* SetPrecision ( expression ; precision )
* AUTHOR:
* Marcus Nilsson, Square Moon Industries AB, marcus@squaremoon.se
* PURPOSE:
* Return text as a double precision floating-point number with 16 digits to the right of the decimal point. Useful when comparing field values to variables, because Decimals are stored with higher precision in fields than in variables.
* NOTES:
* none
* REVISIONS:
* 2019-10-08, Marcus Nilsson. Created.
* 2019-10-09, Marcus Nilsson. Replaced "SetPrecision ( expression ; precision )" with "Truncate ( number ; precision )" for better clarity.
* ==================================================================
*
*/

Truncate ( GetAsNumber ( text ) ; 16 )

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: