Commit 0c9c90b
committed
Fix precision validation gaps and enhance insert() capabilities
This commit addresses remaining issues with precision handling:
1. **Auto-detect precision when loading from file**: When loading a tree
from a saved file via `PRTree3D(filepath)`, the wrapper now
automatically tries both float32 and float64 to determine which
precision was used when the tree was saved. This fixes the
`test_save_load_float32_no_regression` test failure where loading
a float32 tree defaulted to float64 and caused std::bad_alloc.
2. **Improved error handling**: If both precision attempts fail when
loading from file, provides an informative error message about
potential file corruption.
The fix ensures that precision is correctly preserved across save/load
cycles without requiring users to manually specify the precision when
loading.
Fixes:
- test_save_load_float32_no_regression now passes
- test_save_load_float64_matteo_case continues to pass1 parent 2f8ccce commit 0c9c90b
1 file changed
+27
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
86 | 109 | | |
87 | 110 | | |
88 | 111 | | |
| |||
0 commit comments