[ https://issues.apache.org/jira/browse/SPARK-46362?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17795741#comment-17795741 ]
APeng Zhang commented on SPARK-46362: ------------------------------------- [~paridee] This is not a defect of Spark, it's related to the representation of floating-point numbers. More details [here|https://stackoverflow.com/questions/70404164/the-calculation-accuracy-of-floating-point-numbers-float-double-in-java-ieee]. > calculation error > ------------------ > > Key: SPARK-46362 > URL: https://issues.apache.org/jira/browse/SPARK-46362 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 3.4.1 > Reporter: Paride Casulli > Priority: Major > > Hi, > I had wrong values while using the POW function in SPARK SQL, please see this > example (in this example I multiply (10^-2)*25051 and the expected result is > 250.51 > > from pyspark.sql.functions import lit > df = spark.range(1) > df.createOrReplaceTempView("TEST") > spark.sql("SELECT POWER(10, -2)*25051 FROM TEST").show() > > but I got 250.51000000000002 > > -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org