mirror of
https://dicksdeathabove.xyz/~mia/psh-fractional
synced 2024-11-08 16:24:18 +00:00
Mia T. Rain
0207f421f4
---- had issues due to an edge case before: ------ eg: 49518.81665 - 22399.4358 ------ produces: 47278.87307 ------ correct: 27119.38085 ---- this happened when ${#1} > ${#2} ---- if $2 contains decimals -- tester: ---- now exits `1` if answer is "false" -- division ---- debugging on going
45 lines
1.6 KiB
Plaintext
45 lines
1.6 KiB
Plaintext
---
|
|
psh-fractional
|
|
-- fractional math in pure sh, successor to psh-float-micro
|
|
---
|
|
Current Status
|
|
-- addition ~85% working
|
|
---- has some odd issues with decimals
|
|
---- has issues with "Illegal number"
|
|
------ eg: 18471.81672 + 27540.27237
|
|
---- will debug at later date
|
|
-- subtraction ~90% working
|
|
---- had issues due to an edge case before: see last commit
|
|
---- has an issue where $e in rad() somehow becomes malformed
|
|
------ eg: 23019.18605 - 1139
|
|
------ produces: 11629.18605
|
|
------ correct: 21880.18605
|
|
---- current method uses a system of removing the decimal from $1 & $2
|
|
---- and then subtracting them; (m1-m2)
|
|
---- the issue is likely in rad() as $((m1-m2)) is correct before
|
|
---- being handed to rad()
|
|
-- multiplication 100% working
|
|
---- length issues when comparing to bc (produces additional decimals)
|
|
------ I am not going to attempt to fix this
|
|
------ it's really not an issue
|
|
-- division ~90% working
|
|
---- may sometimes produce to many decimals
|
|
------ this will not be fixed
|
|
---- rarely places decimals in wrong places
|
|
------ eg: 324.81478 / 21715
|
|
------ produces: 1.49580833525212986414
|
|
------ correct: 0.01495808335252129864
|
|
---- Some odd edge case with $dp is causing this...
|
|
---- debugging ongoing
|
|
---
|
|
Outer Usage
|
|
-- it is recommended to use this library with psh-fc
|
|
-- if you wish to compare numbers that it produces
|
|
-- as decimal numbers are not considered numbers by posix sh
|
|
---- https://dicksdeathabove.xyz/~mia/psh-fc
|
|
---
|
|
Tester
|
|
-- a tester is present at ./tester; it is ofc not pure sh as it compares with bc
|
|
-- additionally using it requires that $RPATH is set to ?/psh-prng/ran
|
|
---
|