ariksu: Frankly, I have no idea why coverage reduced. Looks like there are some uncovered or luck-based case for domain testing and cli exceptions. I believe that some additional tests would fix that, but those are out of scope for this commit.
fcurella: Thank you! ✨ 
diff --git a/faker/providers/python/__init__.py b/faker/providers/python/__init__.py
index ed9f9793..6b8d4bcf 100644
--- a/faker/providers/python/__init__.py
+++ b/faker/providers/python/__init__.py
@@ -53,8 +53,7 @@ class Provider(BaseProvider):
             self.random_int(1, sys.float_info.dig))
         right_digits = right_digits if right_digits is not None else (
             self.random_int(0, sys.float_info.dig - left_digits))
-        sign = 1 if positive else self.random_element((-1, 1))
-
+        sign = ''
         if (min_value is not None) or (max_value is not None):
             if min_value is None:
                 min_value = max_value - self.random_int()
@@ -63,9 +62,11 @@ class Provider(BaseProvider):
 
             left_number = self.random_int(min_value, max_value)
         else:
-            left_number = sign * self.random_number(left_digits)
+            sign = '+' if positive else self.random_element(('+', '-'))
+            left_number = self.random_number(left_digits)
 
-        return float("{0}.{1}".format(
+        return float("{0}{1}.{2}".format(
+            sign,
             left_number,
             self.random_number(right_digits),
         ))

pyfloat, pydecimal cannot be negative when left_digits=0
I am trying to fake random floats in the range `(-1, 1)`.  Currently, `pyfloat` and `pydecimal` will never be negative as long as `left_digits=0`, even if `positive=False`.

This seems to be because [the `sign` (-1, 1) is multiplied by only the left digits](https://github.com/joke2k/faker/blob/6e32e07/faker/providers/python/__init__.py#L62) (which in this case is 0, canceling out the `sign`), rather than by the entire numeric value.

### Steps to reproduce

```python
>>> import faker
>>> fake = faker.Faker()
>>> any(fake.pyfloat(left_digits=0, positive=False) < 0 for _ in range(10000))
False
```

### Expected behavior

I'd expect approximately half of the floats to be negative, when `positive` is not `True`

diff --git a/tests/test_factory.py b/tests/test_factory.py
index 6336b9ea..daca7957 100644
--- a/tests/test_factory.py
+++ b/tests/test_factory.py
@@ -460,6 +460,13 @@ class FactoryTestCase(unittest.TestCase):
         with pytest.raises(ValueError):
             provider.pyfloat(left_digits=0, right_digits=0)
 
+    def test_negative_pyfloat(self):
+        # tests for https://github.com/joke2k/faker/issues/813
+        factory = Faker()
+        factory.seed_instance(32167)
+        assert any(factory.pyfloat(left_digits=0, positive=False) < 0 for _ in range(100))
+        assert any(factory.pydecimal(left_digits=0, positive=False) < 0 for _ in range(100))
+
     def test_us_ssn_valid(self):
         from faker.providers.ssn.en_US import Provider
 

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio
3.9
requirements/base.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
coverage==7.8.0
exceptiongroup==1.2.2
execnet==2.1.1
-e git+https://github.com/joke2k/faker.git@daf73fb675d5f3c2f583f2cacd649d4f429a9206#egg=Faker
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
python-dateutil==2.9.0.post0
six==1.17.0
text-unidecode==1.2
tomli==2.2.1
typing_extensions==4.13.0

name: faker
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - coverage==7.8.0
      - exceptiongroup==1.2.2
      - execnet==2.1.1
      - iniconfig==2.1.0
      - packaging==24.2
      - pluggy==1.5.0
      - pytest==8.3.5
      - pytest-asyncio==0.26.0
      - pytest-cov==6.0.0
      - pytest-mock==3.14.0
      - pytest-xdist==3.6.1
      - python-dateutil==2.9.0.post0
      - six==1.17.0
      - text-unidecode==1.2
      - tomli==2.2.1
      - typing-extensions==4.13.0
prefix: /opt/conda/envs/faker

tests/test_factory.py::FactoryTestCase::test_negative_pyfloat
tests/test_factory.py::FactoryTestCase::test_add_provider_gives_priority_to_newly_added_provider tests/test_factory.py::FactoryTestCase::test_binary tests/test_factory.py::FactoryTestCase::test_cli_seed tests/test_factory.py::FactoryTestCase::test_cli_seed_with_repeat tests/test_factory.py::FactoryTestCase::test_cli_verbosity tests/test_factory.py::FactoryTestCase::test_command tests/test_factory.py::FactoryTestCase::test_command_custom_provider tests/test_factory.py::FactoryTestCase::test_documentor tests/test_factory.py::FactoryTestCase::test_email tests/test_factory.py::FactoryTestCase::test_ext_word_list tests/test_factory.py::FactoryTestCase::test_format_calls_formatter_on_provider tests/test_factory.py::FactoryTestCase::test_format_transfers_arguments_to_formatter tests/test_factory.py::FactoryTestCase::test_get_formatter_returns_callable tests/test_factory.py::FactoryTestCase::test_get_formatter_returns_correct_formatter tests/test_factory.py::FactoryTestCase::test_get_formatter_throws_exception_on_incorrect_formatter tests/test_factory.py::FactoryTestCase::test_instance_seed_chain tests/test_factory.py::FactoryTestCase::test_invalid_locale tests/test_factory.py::FactoryTestCase::test_ipv4 tests/test_factory.py::FactoryTestCase::test_ipv4_network_class tests/test_factory.py::FactoryTestCase::test_ipv4_private tests/test_factory.py::FactoryTestCase::test_ipv4_private_class_a tests/test_factory.py::FactoryTestCase::test_ipv4_private_class_b tests/test_factory.py::FactoryTestCase::test_ipv4_private_class_c tests/test_factory.py::FactoryTestCase::test_ipv4_public tests/test_factory.py::FactoryTestCase::test_ipv4_public_class_a tests/test_factory.py::FactoryTestCase::test_ipv4_public_class_b tests/test_factory.py::FactoryTestCase::test_ipv4_public_class_c tests/test_factory.py::FactoryTestCase::test_ipv6 tests/test_factory.py::FactoryTestCase::test_language_code tests/test_factory.py::FactoryTestCase::test_locale tests/test_factory.py::FactoryTestCase::test_magic_call_calls_format tests/test_factory.py::FactoryTestCase::test_magic_call_calls_format_with_arguments tests/test_factory.py::FactoryTestCase::test_nl_BE_ssn_valid tests/test_factory.py::FactoryTestCase::test_no_words tests/test_factory.py::FactoryTestCase::test_no_words_paragraph tests/test_factory.py::FactoryTestCase::test_no_words_sentence tests/test_factory.py::FactoryTestCase::test_parse_returns_same_string_when_it_contains_no_curly_braces tests/test_factory.py::FactoryTestCase::test_parse_returns_string_with_tokens_replaced_by_formatters tests/test_factory.py::FactoryTestCase::test_password tests/test_factory.py::FactoryTestCase::test_prefix_suffix_always_string tests/test_factory.py::FactoryTestCase::test_random_element tests/test_factory.py::FactoryTestCase::test_random_number tests/test_factory.py::FactoryTestCase::test_random_pyfloat tests/test_factory.py::FactoryTestCase::test_random_pystr_characters tests/test_factory.py::FactoryTestCase::test_random_sample_unique tests/test_factory.py::FactoryTestCase::test_slugify tests/test_factory.py::FactoryTestCase::test_some_words tests/test_factory.py::FactoryTestCase::test_texts_chars_count tests/test_factory.py::FactoryTestCase::test_texts_count tests/test_factory.py::FactoryTestCase::test_texts_word_list tests/test_factory.py::FactoryTestCase::test_unique_words tests/test_factory.py::FactoryTestCase::test_us_ssn_valid tests/test_factory.py::FactoryTestCase::test_words_ext_word_list tests/test_factory.py::FactoryTestCase::test_words_ext_word_list_unique tests/test_factory.py::FactoryTestCase::test_words_valueerror
faker/providers/python/__init__.py
faker/providers/python/__init__.py