Repository: pytorch
Issue: _refs.div.floor_rounding returns NaN instead of +- inf when a divide by 0 occurs
Labels: module: cpu,triaged

### 🐛 Describe the bug

Currently, in `test/test_ops.py::TestCommonCPU::test_python_ref_torch_fallback__refs_div_floor_rounding_cpu_bfloat16` the floor div operator is tested using `torch` and `torch._refs`. In `PYTORCH_OPINFO_SAMPLE_INPUT_INDEX=13` the divisor is very small. When this occurs, the `torch` result contains `+/- inf`, and the `torch._refs` result contains `NaN` which causes the test to fail.

This issue is dependent on https://github.com/pytorch/pytorch/pull/136308 landing which ensures the rounding mode will be passed through the kwargs and adds a skip for this test.

Reproducer:
Once the above PR is landed, disable the skip in `<base dir>/test/test_ops.py:535`

```
PYTORCH_OPINFO_SAMPLE_INPUT_INDEX=13 python test/test_ops.py TestCommonCPU.test_python_ref_torch_fallback__refs_div_floor_rounding_cpu_bfloat16
```

### Versions

PyTorch version: 2.6.0a0+gitfeb5547
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.4 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: 14.0.0-1ubuntu1.1
CMake version: version 3.29.2
Libc version: glibc-2.35

Python version: 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:40:32) [GCC 12.3.0] (64-bit runtime)
Python platform: Linux-5.15.0-119-generic-x86_64-with-glibc2.35
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Address sizes:                        48 bits physical, 48 bits virtual
Byte Order:                           Little Endian
CPU(s):                               60
On-line CPU(s) list:                  0-59
Vendor ID:                            AuthenticAMD
Model name:                           AMD EPYC 7742 64-Core Processor
CPU family:                           23
Model:                                49
Thread(s) per core:                   2
Core(s) per socket:                   30
Socket(s):                            1
Stepping:                             0
BogoMIPS:                             4491.56
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm rep_good nopl cpuid extd_apicid tsc_known_freq pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core ssbd ibrs ibpb stibp vmmcall fsgsbase tsc_adjust bmi1 avx2 smep bmi2 rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 clzero xsaveerptr wbnoinvd arat npt lbrv nrip_save tsc_scale vmcb_clean pausefilter pfthreshold v_vmsave_vmload vgif umip rdpid arch_capabilities
Virtualization:                       AMD-V
Hypervisor vendor:                    KVM
Virtualization type:                  full
L1d cache:                            1.9 MiB (30 instances)
L1i cache:                            1.9 MiB (30 instances)
L2 cache:                             15 MiB (30 instances)
L3 cache:                             16 MiB (1 instance)
NUMA node(s):                         2
NUMA node0 CPU(s):                    0-29
NUMA node1 CPU(s):                    30-59
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Mitigation; untrained return thunk; SMT enabled with STIBP protection
Vulnerability Spec rstack overflow:   Mitigation; safe RET
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Retpolines; IBPB conditional; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

Versions of relevant libraries:
[pip3] torch==2.6.0a0+gitfeb5547
[conda] Could not collect

cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10