SQLite Forum

Bug: MSVC uses intrinsic versions of ceil and floor for floating-point modes precise and fast (diagnosed)
Login
on a imprecision test:

pydef py_sin(s):
    "sinus function : example loading module, handling input/output as strings"
    import math as py_math
    return ("%s" %  py_math.sin(s*1));

WITH RECURSIVE
  cnt(x) AS (
     SELECT 1
     UNION ALL
     SELECT x+1 FROM cnt
      LIMIT 30000
  )

select sum(sin(x)) , sum(py_sin(x)) from cnt  

gives : 
1.0597896088923804 , 1.0597896088923986

vs for sqlserver 
1.05978960889238

==> so having the math function included is slightly better for precision.

sqlserver code:

WITH 
  cnt(x) AS (
     SELECT 1
     UNION ALL
     SELECT x+1 FROM cnt
      where x <=30000
  )

select sum(sin(x))  from cnt  
option (MAXRECURSION 31000) -- sqlserver 2019 (standard) is limited to 32767 recursions