apoc.convert.toFloat

Function APOC Core Deprecated

apoc.convert.toFloat(value) | tries it’s best to convert the value to a float

Signature

apoc.convert.toFloat(object :: ANY?) :: (FLOAT?)

Input parameters

Name Type Default

object

ANY?

null

Usage Examples

Convert string to float
return apoc.convert.toFloat("1.7") AS output;
Table 1. Results
Output

1.7

Convert integer to float
return apoc.convert.toFloat(1) AS output;
Table 2. Results
Output

1.0

This function has been deprecated and will be removed in version 5.0. The functionality is replaced by the Neo4j functions toFloat(value) and the more permissive toFloatOrNull(value). The Neo4j functions do not have exactly the same behavior as the APOC ones - the following table is intended to assist migration by highlighting the differences:

Table 3. Migration Path to toFloat() / toFloatOrNull()
Input apoc.convert.toFloat toFloat() toFloatOrNull()

null

null

null

null

""

null

null

null

1

1.0

1.0

1.0

0

0.0

0.0

0.0

1.0

1.0

1.0

1.0

"not-a-number"

null

null

null

{a:'a'}

null

Error

null

true

1.0 [1]

Error

null

datetime("2000-01-01T00:00:00.000+0000")

null

Error

null

Node

null

Error

null

Relationship

null

Error

null

Path ()-[]-()

null

Error

null


1. Use toFloat(toInteger()) for this behaviour in Neo4j