framework icon indicating copy to clipboard operation
framework copied to clipboard

[10.x] Improve decimal cast precision

Open timacdonald opened this issue 2 years ago • 2 comments

This is a draft as we will need to:

  1. Merge #45454
  2. Merge 9.x into 10.x
  3. Update the failing test to use ValueException instead of TypeException

Fixes https://github.com/laravel/framework/issues/45454 Improves on https://github.com/laravel/framework/pull/45456

timacdonald avatar Dec 30 '22 00:12 timacdonald

On hold until https://github.com/laravel/framework/pull/45492 is merged.

timacdonald avatar Jan 03 '23 01:01 timacdonald

@timacdonald I guess this can be continued to work on now that PR is merged?

driesvints avatar Jan 05 '23 13:01 driesvints

@timacdonald I moved the bc-math requirement to "suggest" which is what you wanted to do I think.

driesvints avatar Jan 10 '23 08:01 driesvints

If it's in the suggest, then it crashes? This is different then https://github.com/laravel/framework/pull/45457 which checks if the extension is loaded. In this version for 10.x it always used bcmath

barryvdh avatar Jan 10 '23 08:01 barryvdh

@barryvdh it's in "suggest" because you don't have to use the decimal cast per se. It's suppose to crash if you don't have it installed. That's why it's a "suggest" and not a hard dependency.

Also, I think you wanted to link to a different PR?

driesvints avatar Jan 10 '23 08:01 driesvints

If you don't want to require it, maybe better to keep the fallback? Maybe add an exception if the float precision is to low? Something like https://github.com/laravel/framework/pull/45580/commits/f66db469ba740d1957a288b443a88f48c882a16c (Removed the exception in https://github.com/laravel/framework/pull/45580/ for 9.x now)

barryvdh avatar Jan 10 '23 09:01 barryvdh