Hex Casting

Hex Casting

7M Downloads

Abacus number acts differently than the formated one

prodigylock opened this issue ยท 4 comments

commented

Modloader

Fabric

Minecraft version

1.20.1

Hex Casting version

0.11.2

Modloader version

Fabroc 0.16.10 + API 0.92.4

Modpack info

Isolated hexcasting with all dependancies(Cardinal 5.2.3; Cloth 11.1.136; 1.13.1Kotlin.2.1.10; Inline 1.1.0; Paucal 0.6.0)

The latest.log file

No response

Issue description

When using an abacus can create numbers that don't act like they are supposed to.
Operations with the number are misleading since formated and actual value differ

Steps to reproduce

Given is one example:
Take abacus in main hand.
Shift scroll down until abacus reaches 22 (an increment of 1 up)
Place in second hand and shift scroll up until abacus readout shows 21 (increment of 0.1 down)
Cast Scribe's Reflection

Multiple Problems:

  1. Casting Floor turns 21 into 20 (expected is 21)
  2. Casting Modulo with 3 (21%3) returns 3 (expected is 0)

Other information

Seems to be a floating point problem.

commented

I don't think this is actually solvable, floats are just jank. But I won't close it yet in case anyone else has any ideas?

commented

maybe we could use BigDecimal or something internally and convert to float when reading the value with hex?

commented

I was thinking more along the lines of 'round value in Abacus to the nearest 0.01 when scrolling'

commented

or actually, store it as an int/long internally and divide by 100 or whatever when displaying/reading