A few days ago I tried to build some perls with 32 bit ints and 128 bit floats. Cue test failures. Today I tried again, and this time I read my notes from last time on how to do it, and it Just Works.

Yay past me!

(the #BigInt modules bundled with some versions of perl don't like that combination of data sizes; the solution is to ignore their test failures, install anyway, and then upgrade to the latest versions from the #CPAN)

#perl #32bit #RidiculousComputing #ComputationalPerversions

🥴 Ah, yes, the age-old challenge: cramming infinite data into finite space using #JavaScript Bigints. Because who doesn't love turning their codebase into a monument of inefficiency just to realize, "Oh wait, maybe this wasn't such a genius move after all?" 🤦‍♂️
https://jonathan-frere.com/posts/bigints-are-cool/ #BigInt #DataManagement #CodeInefficiency #DeveloperHumor #TechChallenges #HackerNews #ngated
Storing Unwise Amounts of Data in JavaScript Bigints | Jonathan's Blog

Storing Unwise Amounts of Data in JavaScript Bigints This is a short note to document storing data in JS’s bigint type. I tried this out in a project recently, and it’s not obviously a terrible idea, as long as you take into account all the caveats that make it only useful for very specific cases. Why This is a performance1 thing. In the project where I was exploring this, we had a large amount of objects representing configuration values. The possible configuration keys were the same, but different objects had different keys set. This approach was causing some issues:

[Перевод] Как хранить деньги в базах данных и почему это не так просто, как кажется

Хранение денежных сумм в базах данных и API: анализ подходов платежных систем Хранение денег — вещь только на первый взгляд простая, а на деле содержит множество подводных камней. Выбрав не тот тип данных, можно получить неточности в расчётах, возможна путаница при переводе суммы из одной валюты в другую. А если ещё и подключать внешние API, у каждого из которых своя точность для одних и тех же валют, уследить за совместимостью еще труднее. Разбираем, как решают эти проблемы Stripe, PayPal, Google Wallet и другие платежные системы. Сравниваем три основных подхода: Integer minor units, Decimal base units и String base units.

https://habr.com/ru/articles/924838/

#валюты #валюты_мира #финансовые_системы #decimal #bigint #типы_данных #float #double #хранение_данных #платежные_системы

Как хранить деньги в базах данных и почему это не так просто, как кажется

Хранение денег — вещь только на первый взгляд простая, а на деле содержит множество подводных камней. Выбрав не тот тип данных, можно получить неточности в расчётах, возможна путаница при переводе...

Хабр

[Перевод] Как хранить деньги в базах данных и почему это не так просто, как кажется

Хранение денежных сумм в базах данных и API: анализ подходов платежных систем Хранение денег — вещь только на первый взгляд простая, а на деле содержит множество подводных камней. Выбрав не тот тип данных, можно получить неточности в расчётах, возможна путаница при переводе суммы из одной валюты в другую. А если ещё и подключать внешние API, у каждого из которых своя точность для одних и тех же валют, уследить за совместимостью еще труднее. Разбираем, как решают эти проблемы Stripe, PayPal, Google Wallet и другие платежные системы. Сравниваем три основных подхода: Integer minor units, Decimal base units и String base units.

https://habr.com/ru/articles/924838/

#валюты #валюты_мира #финансовые_системы #decimal #bigint #типы_данных #float #double #хранение_данных #платежные_системы

Как хранить деньги в базах данных и почему это не так просто, как кажется

Хранение денег — вещь только на первый взгляд простая, а на деле содержит множество подводных камней. Выбрав не тот тип данных, можно получить неточности в расчётах, возможна путаница при переводе...

Хабр
Understanding SQL Server BIGINT Data Type and Implicit Conversions
Master SQL Server BIGINT data type conversions! Avoid implicit casting issues & use explicit CAST/CONVERT for robust code. Prevent subtle bugs & improve readability. #SQLServer #BIGINT #DataTypeConversion #ImplicitCasting #ExplicitCasting #Database
https://tech-champion.com/database/sql-server/understanding-sql-server-bigint-data-type-and-implicit-conversions/
...
Understanding SQL Server BIGINT Data Type and Implicit Conversions
Master SQL Server BIGINT data type conversions! Avoid implicit casting issues & use explicit CAST/CONVERT for robust code. Prevent subtle bugs & improve readability. #SQLServer #BIGINT #DataTypeConversion #ImplicitCasting #ExplicitCasting #Database
https://tech-champion.com/database/sql-server/understanding-sql-server-bigint-data-type-and-implicit-conversions/
...
#JavaScript is a weird language; it has #bigint, but it doesn't have a function that returns a number of bits in the bigint. Neither it has #log2 function for the bigints. If you need a workaround for the problem, see the article https://medium.com/@sergeyshandar/improving-the-log2-algorithm-for-bigint-in-javascript-7e5692e7bf0b?sk=9ac18367f61b524704cc8d82707aed3d
Improving the Log2 Algorithm for BigInt in JavaScript

I usually use the bigint type in JavaScript and FunctionalScript as a vector of bits, and I often need to know how many bits are in a specific bigint instance. Every JavaScript engine that has a…

Medium

Does anyone know how to make a fast log2 function for bigint in JavaScript?

I know that JS VM can do it in almost O(1) because it has information about the size of bigint. My current best algorithm is O(log(n)). The algorithm performs faster than x.toString(2).length and consumes less memory. Do you have any ideas for improvement?

https://github.com/functionalscript/functionalscript/blob/a9a1cd2c1b0f4c025faf2223eb6ff96f48e8374b/types/bigint/module.f.cjs#L65

#JavaScript #bigint #log2 #Algorithm

functionalscript/types/bigint/module.f.cjs at a9a1cd2c1b0f4c025faf2223eb6ff96f48e8374b · functionalscript/functionalscript

FunctionalScript is a purely functional subset of JavaScript - functionalscript/functionalscript

GitHub
I may skip adding `Uint8Array` and other typed arrays to FunctionalScript because `bigint` is a good enough representation of a sequence of bits. #javascript #ecmascript #bigint #typedarray
The GNU MP Bignum Library