log2, log10, acosh and tgamma don't return NaN when they should #1256
Labels
No labels
bazel
bluetooth
board settings
boot_stage2
bug
build
c++
can't reproduce
clang
clib-interface
cmsis
code cleanliness
code size
compiler version issues
cyw43_driver
debug
discussion
documentation
duplicate
dynamic_clock
elf2uf2
enhancement
errata
filesystem
flash layout
floating point
FreeRTOS
hardware_adc
hardware_claim
hardware_clocks
hardware_dma
hardware_exception
hardware_flash
hardware_gpio
hardware_i2c
hardware_irq
hardware_pio
hardware_pwm
hardware_rcp
hardware_rtc
hardware_spi
hardware_sync
hardware_uart
hardware_vreg
hardware_watchdog
hardware_xosc
help wanted
host
IAR
installation
invalid
linker scripts
lto
lwip
mbedtls
missing API
needs reporter detail
networking
newlib
newlib-multicore
non-c
non-cmake
non-gcc
openocd
orphan PR
OS integration
pico_async_context
pico_base
pico_binary_info
pico_flash
picolibc
pico_lwip
pico_malloc
pico_multicore
pico_printf
pico_runtime
pico_stdio
pico_stdio_usb
pico_sync
pico_time
pico_util
pioasm
port
question
review
review2
rtos interop
runtime init
static library
svd
test
tinyusb
vscode
wifi integration
wontfix
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk#1256
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The following functions evaluated at the given points return a finite or infinite result when then should return Nan:
log2(-INFINITY)returns-INFINITYbut should return NaNlog10(-INFINITY)returns-INFINITYbut should return NaNacosh(-1.0)returns0.0but should return NaN (it should return NaN for all arguments less than 1)acosh(-INFINITY)returnsINFINITYbut should return NaNtgamma(-INFINITY)returnsINFINITYbut should return NaNI'm not sure exactly what the policy is for domain errors, but when
PICO_FLOAT_PROPAGATE_NANSis enabled a lot of other cases of NaN are handled, so one would expect the above to also be handled correctly.Edit: possibly also the following:
sqrt(-INFINITY)returns-INFINITYbut should return NaNlog(-INFINITY)returns-INFINITYbut should return NaNyes, there seems to be a mixture - initially the policy was intended to be PROPAGATE_NANs should take NAN input to NAN output, but we clearly have code in some places to fix this.
I'm surprised log(-INFINITY) isn't listed...
can you point me at the test for this in MP
tests/float/math_domain_special.pyis the test.That tests also see some strange behaviour of
math.asinh(0)returning-0.0when it should be0.0, but I couldn't track that bug down because when I ranasinhf(0.0)in C code it returned0.0as expected.Surprisingly we don't have a test for this... I'm in the process of adding one but it seems that it does pass on rp2 because we handle
math.log(x[, base])differently to log2 and log10: log explicitly checks that it's argument is positive.To run the tests on MP:
Then to see the diff of the expected (left) vs actual (right) results:
(The first one there is #1255.)