Forums WoW Modding Support Archives WoWModding Support Archives [DiscordArchive] They are dividing by 0x7FFF there?

[DiscordArchive] They are dividing by 0x7FFF there?

[DiscordArchive] They are dividing by 0x7FFF there?

Pages (3): Previous 1 2 3 Next
rektbyfaith
Administrator
0
06-06-2018, 08:28 AM
#11
Archived author: Skarn • Posted: 2018-06-06T08:28:19.453000+00:00
Original source

You said it fails to read most values
rektbyfaith
06-06-2018, 08:28 AM #11

Archived author: Skarn • Posted: 2018-06-06T08:28:19.453000+00:00
Original source

You said it fails to read most values

rektbyfaith
Administrator
0
06-06-2018, 08:30 AM
#12
Archived author: schlumpf • Posted: 2018-06-06T08:30:28.704000+00:00
Original source

It tried to handle fixed16 and fixed_point the same, which is wrong.
The part it mostly failed with was writing iirc, with off by one rounding errors.
rektbyfaith
06-06-2018, 08:30 AM #12

Archived author: schlumpf • Posted: 2018-06-06T08:30:28.704000+00:00
Original source

It tried to handle fixed16 and fixed_point the same, which is wrong.
The part it mostly failed with was writing iirc, with off by one rounding errors.

rektbyfaith
Administrator
0
06-06-2018, 08:30 AM
#13
Archived author: Skarn • Posted: 2018-06-06T08:30:43.931000+00:00
Original source

```py
class fixed_point:
"""A fixed point real number, opposed to a floating point."""
def __init__(self, type_, dec_bits, int_bits):
self.type = type_
self.dec_bits = dec_bits
self.int_bits = int_bits
self.value = 0

def read(self, f):
fixed_point_val = self.type.read(f)
decimal_part = fixed_point_val & ((1 << self.dec_bits) - 1)
integral_part = (fixed_point_val >> self.dec_bits) & (1 << self.int_bits) - 1
sign = -1.0 if (fixed_point_val & (1 << (self.dec_bits + self.int_bits)) != 0) else 1.0

self.value = sign * (integral_part + decimal_part / (((1 << self.dec_bits) - 1) + 1.0))

return self

def write(self, f):
sign = 1 if self.value < 0 else 0
integral_part = int(self.value) & ((1 << self.int_bits) - 1)
decimal_part = int((self.value - int(self.value)) * (1 << self.dec_bits))
fixed_point_val = (sign << (self.int_bits + self.dec_bits)) | (integral_part << self.int_bits) | decimal_part

self.type.write(f, fixed_point_val)

return self
```
rektbyfaith
06-06-2018, 08:30 AM #13

Archived author: Skarn • Posted: 2018-06-06T08:30:43.931000+00:00
Original source

```py
class fixed_point:
"""A fixed point real number, opposed to a floating point."""
def __init__(self, type_, dec_bits, int_bits):
self.type = type_
self.dec_bits = dec_bits
self.int_bits = int_bits
self.value = 0

def read(self, f):
fixed_point_val = self.type.read(f)
decimal_part = fixed_point_val & ((1 << self.dec_bits) - 1)
integral_part = (fixed_point_val >> self.dec_bits) & (1 << self.int_bits) - 1
sign = -1.0 if (fixed_point_val & (1 << (self.dec_bits + self.int_bits)) != 0) else 1.0

self.value = sign * (integral_part + decimal_part / (((1 << self.dec_bits) - 1) + 1.0))

return self

def write(self, f):
sign = 1 if self.value < 0 else 0
integral_part = int(self.value) & ((1 << self.int_bits) - 1)
decimal_part = int((self.value - int(self.value)) * (1 << self.dec_bits))
fixed_point_val = (sign << (self.int_bits + self.dec_bits)) | (integral_part << self.int_bits) | decimal_part

self.type.write(f, fixed_point_val)

return self
```

rektbyfaith
Administrator
0
06-06-2018, 08:30 AM
#14
Archived author: Skarn • Posted: 2018-06-06T08:30:48.697000+00:00
Original source

That's the code I am talking about btw
rektbyfaith
06-06-2018, 08:30 AM #14

Archived author: Skarn • Posted: 2018-06-06T08:30:48.697000+00:00
Original source

That's the code I am talking about btw

rektbyfaith
Administrator
0
06-06-2018, 08:31 AM
#15
Archived author: Skarn • Posted: 2018-06-06T08:31:09.150000+00:00
Original source

Can you propose any solution to rounding though?
rektbyfaith
06-06-2018, 08:31 AM #15

Archived author: Skarn • Posted: 2018-06-06T08:31:09.150000+00:00
Original source

Can you propose any solution to rounding though?

rektbyfaith
Administrator
0
06-06-2018, 08:33 AM
#16
Archived author: schlumpf • Posted: 2018-06-06T08:33:09.905000+00:00
Original source

The code tries to implement fp as if it was fixed16 for read, so that will be wrong for any non fixed16. I can’t comment on my write function.
rektbyfaith
06-06-2018, 08:33 AM #16

Archived author: schlumpf • Posted: 2018-06-06T08:33:09.905000+00:00
Original source

The code tries to implement fp as if it was fixed16 for read, so that will be wrong for any non fixed16. I can’t comment on my write function.

rektbyfaith
Administrator
0
06-06-2018, 08:33 AM
#17
Archived author: schlumpf • Posted: 2018-06-06T08:33:23.044000+00:00
Original source

TLDR: ignore me and just do what others said above
rektbyfaith
06-06-2018, 08:33 AM #17

Archived author: schlumpf • Posted: 2018-06-06T08:33:23.044000+00:00
Original source

TLDR: ignore me and just do what others said above

rektbyfaith
Administrator
0
06-06-2018, 08:37 AM
#18
Archived author: Skarn • Posted: 2018-06-06T08:37:28.058000+00:00
Original source

<@250706991515828224> is your viewer capable of showing individual models like WMV?
rektbyfaith
06-06-2018, 08:37 AM #18

Archived author: Skarn • Posted: 2018-06-06T08:37:28.058000+00:00
Original source

<@250706991515828224> is your viewer capable of showing individual models like WMV?

rektbyfaith
Administrator
0
06-06-2018, 08:37 AM
#19
Archived author: Deamon • Posted: 2018-06-06T08:37:50.196000+00:00
Original source

<@197724887387734016> yes
rektbyfaith
06-06-2018, 08:37 AM #19

Archived author: Deamon • Posted: 2018-06-06T08:37:50.196000+00:00
Original source

<@197724887387734016> yes

rektbyfaith
Administrator
0
06-06-2018, 08:38 AM
#20
Archived author: Deamon • Posted: 2018-06-06T08:38:07.080000+00:00
Original source

the UI though is not there
rektbyfaith
06-06-2018, 08:38 AM #20

Archived author: Deamon • Posted: 2018-06-06T08:38:07.080000+00:00
Original source

the UI though is not there

Pages (3): Previous 1 2 3 Next
Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)