C23 <math.h> Functions
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia con il paper P3935R0 collegato e C23 Annex H, quindi confronta la superficie verificata e non verificata con i nomi esistenti come comparetotal, read_payload, log1p, quantize e gli helper di conversione DPD/BID. Risolvi le questioni aperte dell’API per tutti e sei i tipi decimali, implementa le funzioni e le macro selezionate e aggiungi una copertura che dimostri il comportamento specificato da C23 e IEEE 754.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
P3935R0 "Rebasing <cmath> on C23"
proposes pulling the remaining C23 <math.h> functions into C++, since C++26 is based on C23
but <cmath> is still based on C17. The paper puts decimal floating-point out of its own scope,
but nearly everything it lists is an ISO/IEC 60559 operation that
C23 Annex H already requires for
_Decimal32 / _Decimal64 / _Decimal128. Boost.Decimal should provide all of them regardless
of what C++29 adopts — the paper even notes that iscanonical and canonicalize are "primarily
motivated by ISO/IEC 60559 decimal floating-point representations."
This issue tracks that surface across all six types (decimal32_t, decimal64_t, decimal128_t,
decimal_fast32_t, decimal_fast64_t, decimal_fast128_t), plus the decimal-only functions from
C23 Annex H that P3935R0 does not cover.
Checked items are already provided; a trailing note gives our current spelling where it differs
from C23.
Classification and canonicalization
-
issignaling— provided, documented under "Non-standard Functions" -
iscanonical— C23 specifies exactly which decimal encodings are canonical, so unlike the
binary case this has a hard definition (non-canonical declets in DPD, significands above
the format maximum in BID) -
issubnormal -
iszero -
canonicalize
Comparison
-
iseqsig—compareSignalingEqual; raisesFE_INVALIDon quiet NaN, unlikeoperator== -
totalorder— could alias the existingcomparetotal; see open questions -
totalordermag
NaN payload
-
getpayload— could alias the existingread_payload -
setpayload -
setpayloadsig
Trigonometric (pi-scaled)
-
acospi -
asinpi -
atanpi -
atan2pi -
cospi -
sinpi -
tanpi
Exponential and logarithmic
-
exp10 -
exp10m1 -
exp2m1 -
log10p1 -
logp1— same value as the existinglog1p, different C23 spelling -
log2p1
Power
-
compoundn—(1 + x)^n; -
pown—x^nfor integraln -
powr—e^(y * log(x)), defined only forx >= 0 -
rootn—x^(1/n) -
rsqrt—1 / sqrt(x)
Rounding and integer conversion
-
roundeven— nearest integer with halfway cases rounded to even -
fromfp -
ufromfp -
fromfpx -
ufromfpx
The fromfp family takes a rounding direction from the FP_INT_* macros below and a bit width,
and returns NaN when the value is not representable.
Maximum and minimum
C23 replaced C99's fmax / fmin NaN behaviour with an IEEE 754-2019 conforming set. The library
currently provides only fmax and fmin.
-
fmaximum -
fminimum -
fmaximum_num -
fminimum_num -
fmaximum_mag -
fminimum_mag -
fmaximum_mag_num -
fminimum_mag_num
Note that for decimal types these are not simply a comparison: when the operands compare equal but
belong to different cohorts, IEEE 754-2019 specifies which member of the cohort is returned.
Narrowing arithmetic
-
fadd -
fsub -
fmul -
fdiv -
ffma -
fsqrt
Narrowing arithmetic: compute in the wider format and round once to the narrower result format.
C23 spells the decimal versions d32addd64, d32addd128, d64addd128, and so on. P3935R0
proposes exposing them in C++ as function templates parameterised on the return type
(std::fadd<T>(x, y)) rather than by name suffix; see open questions.
Decimal-specific (C23 Annex H)
These have no binary counterpart and so are absent from P3935R0, but they belong in any complete
C23 decimal implementation.
-
quantize— provided asquantize -
samequantum— provided assamequantum -
quantexp— provided asquantexp -
encodedec/decodedec— provided asto_dpd/from_dpd -
encodebin/decodebin— provided asto_bid/from_bid -
quantum— returns the quantum of a finite value as a value of the same type -
llquantexp—quantexpreturninglong long
Macros
-
FP_INT_UPWARD -
FP_INT_DOWNWARD -
FP_INT_TOWARDZERO -
FP_INT_TONEARESTFROMZERO -
FP_INT_TONEAREST -
FP_FAST_*narrowing-arithmetic hints — C23 spells the decimal analogues
FP_FAST_D32ADDD64,FP_FAST_D32ADDD128,FP_FAST_D64ADDD128, and correspondingly for
SUB/MUL/DIV/FMA/SQRT
- Lingua principale
- C++
- Stelle
- 67
- Fork
- 16
- Merge medio
- 1g 15h
- PR unite (30g)
- 12
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di boostorg/decimal
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
I maintainer di solito rispondono entro 1 giorno
-
The decimal types have no operator<=> with GCC and Clang if no earlier header includes <compare>Forse già presa @ibmibmibm l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
comparetotal gives incorrect results for NaN operandsForse già presa @ibmibmibm l’ha presa 1 giorno fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
A comparison of a decimal and an integer gives incorrect resultsForse già presa @ibmibmibm l’ha presa 1 giorno fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
I maintainer di solito rispondono entro 1 giorno
-
A comparison of two decimal types can use the type with fewer digitsForse già presa @ibmibmibm l’ha presa 1 giorno fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di boostorg/decimal
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
sav-oss-org/ptusa_main#1610 ·
I maintainer di solito rispondono entro 1 giorno
-
Command gate: one shared constant for the just-below-1e-9 MoveAxis stop epsilon (ZWO, Bisque)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
open-astro/AlpacaBridge#2606 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Refactor force_torque_system integration test to use EcmScopeForse già presa @patelshivani2283-lab l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Niko1221/Strata#6731 · 2 commenti ·
I maintainer di solito rispondono entro 6 giorni
-
good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100