Division Auto Truncates Decimal Even After Casting Inputs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2023 10:52 AM
Division of two numbers is auto truncating decimals and I can't get a more precise result.
Example of things I've tried:
10 / 60 => 0.17
cast(10 as float) / cast(60 as float) => 0.17
cast(cast(10 as float) / cast(60 as float) as float) => 0.17
round(10 / 60, 4) => 0.17
Expected result of all of these should be some form of
0.166666....7
Any help is appreciated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2023 01:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 07:21 AM
This looks like it was in a notebook. Are you able to reproduce in Databricks SQL? That's where I'm seeing the truncation happen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2023 08:44 PM
Hi @Alex Python
Thank you for posting your question in our community! We are happy to assist you.
To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?
This will also help other community members who may have similar questions in the future.
Thank you for your participation and let us know if you need any further assistance!