Skip to content Skip to sidebar Skip to footer

Exp() In Bigquery Returns Floating-point Error

I have the following query: SELECT EXP(col) FROM `project.dataset.tablename`; Where col is FLOAT. However, I get this error: Error: Floating point error in function: EXP. I've tri

Solution 1:

Probably you are working with numbers larger than 709.7827.

Weird number, but even in Fortran docs:

EXP(X)

Exponential.

X must be less than or equal to 709.7827.

http://sc.tamu.edu/IBM.Tutorial/docs/Compilers/xlf_8.1/html/lr277.HTM

This because numbers get too large after e^709.7827.

Solution 2:

Run the query:

SELECTMAX(col)
FROM project.dataset.tablename;

It will probably then be obvious why you are getting an overflow error. You can work around it by using a case:

SELECT (CASEWHEN col < ?? THENEXP(col) END)
FROM project.dataset.tablename;

I could suggest a value, but it is probably obvious from your application -- say something larger than 10 or 100 might just be unreasonable.

Post a Comment for "Exp() In Bigquery Returns Floating-point Error"