Replies: 2 comments
-
|
I think it is possible to recover exact bit pattern (if you know size and format) just by using algebraic expressions, but I haven't thought about it much. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Please see an issue with related discussion about this: #1343 Maybe |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
For a plotting task (where floating-point-style errors are tolerable), I find myself needing injective mappings from rectangular grids$\{0..X\}\times\{0..Y\}\subset\mathbb{N}^2$ into $[0,1]\subset\mathbb{Q}$ , such that $(0,0)\mapsto 0$ and $(X,Y)\mapsto 1$ . One suitable approach would compose this mapping as the affine map,
with a second mapping$[0,1]^2 \rightarrow [0,1]$ constructed by interleaving [finite prefixes of] the bits of $\frac{x}{X}$ and $\frac{y}{Y}$ .
To this end, it would be expedient to have access to the mantissa of a floating point number, as e.g. with SWI's
float_parts/4. Obviously, this is something I could implement in Rust; but is there perhaps already a way (even a 'dirty trick') to access these bits in Scryer?I recognize we have
arithmetic:number_to_rational/3, but that seems roundabout and presumably computationally expensive.Beta Was this translation helpful? Give feedback.
All reactions