Incorrect Custom Float Property Value Readout #49304

Closed
opened 2016-09-08 22:53:22 +02:00 by Darren Waschow · 9 comments

System Information
Windows 7 Enterprise 64 w/ NVIDIA Quadro K2100M

Blender Version
Broken: 2.77a abf6f08 and 2.78 RC1 0e5089c
Worked: (optional)

Short description of error
Assigning custom float property values to objects stores incorrect values. I've tried by creating properties via the UI as well as with python code:

import bpy
ob = bpy.context.active_object
ob['property'] = 987654.321

Doing so (in both cases) the property is set to the correct value internally, but the UI reports the value as 987654.313.

Other numbers are also coming up with incorrect decimal parts of the value.

Exact steps for others to reproduce the error
Create a cube.
Add a new Custom Property using the UI or with the above code run via a text window.
Check property value via Python console (it'll be correct) and then look in the UI and see the incorrect value.

**System Information** Windows 7 Enterprise 64 w/ NVIDIA Quadro K2100M **Blender Version** Broken: 2.77a abf6f08 and 2.78 RC1 0e5089c Worked: (optional) **Short description of error** Assigning custom float property values to objects stores incorrect values. I've tried by creating properties via the UI as well as with python code: import bpy ob = bpy.context.active_object ob['property'] = 987654.321 Doing so (in both cases) the property is set to the correct value internally, but the UI reports the value as 987654.**313**. Other numbers are also coming up with incorrect decimal parts of the value. **Exact steps for others to reproduce the error** Create a cube. Add a new Custom Property using the UI or with the above code run via a text window. Check property value via Python console (it'll be correct) and then look in the UI and see the incorrect value.
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @DarrenWaschow

Added subscriber: @DarrenWaschow
Member

Added subscriber: @BrendonMurphy

Added subscriber: @BrendonMurphy
Member

hi, tested this out & found the error occurs after more than 8 digits are added, less than 8 digits & there's no difference, more than 8 & there is wrong comparison.

hi, tested this out & found the error occurs after more than 8 digits are added, less than 8 digits & there's no difference, more than 8 & there is wrong comparison.

Added subscriber: @mont29

Added subscriber: @mont29

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Bastien Montagne self-assigned this 2016-09-09 14:13:35 +02:00

Thanks for the report, but no bug here, that’s merely well-known floating point precision issue, you only have about 7 digits usable on 32bit floats, nothing to be done here.

Thanks for the report, but no bug here, that’s merely well-known floating point precision issue, you only have about 7 digits usable on 32bit floats, nothing to be done here.
Author

Bastien:

I'm not sure your explanation addresses what's actually happening here. The value stored in the object's property is correct. It's just the value that's shown in the UI under Custom Properties that's incorrect.

If you assign a floating point value of, say, 987654.321 to an object property, you can then query that value using ob['property'] in the Python console and it's correct. But the UI shows the value as 987654.313.

See the attached screen shot.

Thanks!

Property2.png

Bastien: I'm not sure your explanation addresses what's actually happening here. The value stored in the object's property is correct. It's just the value that's shown in the UI under Custom Properties that's incorrect. If you assign a floating point value of, say, **987654.321** to an object property, you can then query that value using ob['property'] in the Python console and it's correct. But the UI shows the value as **987654.313**. See the attached screen shot. Thanks! ![Property2.png](https://archive.blender.org/developer/F356609/Property2.png)

@DarrenWaschow That’s precisely the point - our UI code does not draw raw float values, for various reasons, so it ends up applying some transformations to it (see UI_calc_float_precision function in code), hence the float precision issue…

@DarrenWaschow That’s precisely the point - our UI code does not draw raw float values, for various reasons, so it ends up applying some transformations to it (see `UI_calc_float_precision` function in code), hence the float precision issue…
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#49304
No description provided.