@@ -31,6 +31,8 @@ pub use core::f32::{
31
31
impl f32 {
32
32
/// Returns the largest integer less than or equal to `self`.
33
33
///
34
+ /// This function always returns the precise result.
35
+ ///
34
36
/// # Examples
35
37
///
36
38
/// ```
@@ -52,6 +54,8 @@ impl f32 {
52
54
53
55
/// Returns the smallest integer greater than or equal to `self`.
54
56
///
57
+ /// This function always returns the precise result.
58
+ ///
55
59
/// # Examples
56
60
///
57
61
/// ```
@@ -73,6 +77,8 @@ impl f32 {
73
77
/// Returns the nearest integer to `self`. If a value is half-way between two
74
78
/// integers, round away from `0.0`.
75
79
///
80
+ /// This function always returns the precise result.
81
+ ///
76
82
/// # Examples
77
83
///
78
84
/// ```
@@ -99,6 +105,8 @@ impl f32 {
99
105
/// Returns the nearest integer to a number. Rounds half-way cases to the number
100
106
/// with an even least significant digit.
101
107
///
108
+ /// This function always returns the precise result.
109
+ ///
102
110
/// # Examples
103
111
///
104
112
/// ```
@@ -123,6 +131,8 @@ impl f32 {
123
131
/// Returns the integer part of `self`.
124
132
/// This means that non-integer numbers are always truncated towards zero.
125
133
///
134
+ /// This function always returns the precise result.
135
+ ///
126
136
/// # Examples
127
137
///
128
138
/// ```
@@ -145,6 +155,8 @@ impl f32 {
145
155
146
156
/// Returns the fractional part of `self`.
147
157
///
158
+ /// This function always returns the precise result.
159
+ ///
148
160
/// # Examples
149
161
///
150
162
/// ```
@@ -166,6 +178,8 @@ impl f32 {
166
178
167
179
/// Computes the absolute value of `self`.
168
180
///
181
+ /// This function always returns the precise result.
182
+ ///
169
183
/// # Examples
170
184
///
171
185
/// ```
@@ -249,6 +263,12 @@ impl f32 {
249
263
/// this is not always true, and will be heavily dependant on designing
250
264
/// algorithms with specific target hardware in mind.
251
265
///
266
+ /// # Precision
267
+ ///
268
+ /// The result of this operation is guaranteed to be the rounded
269
+ /// infinite-precision result. It is specified by IEEE 754 as
270
+ /// `fusedMultiplyAdd` and guaranteed not to change.
271
+ ///
252
272
/// # Examples
253
273
///
254
274
/// ```
@@ -276,6 +296,11 @@ impl f32 {
276
296
/// In other words, the result is `self / rhs` rounded to the integer `n`
277
297
/// such that `self >= n * rhs`.
278
298
///
299
+ /// # Precision
300
+ ///
301
+ /// The result of this operation is guaranteed to be the rounded
302
+ /// infinite-precision result.
303
+ ///
279
304
/// # Examples
280
305
///
281
306
/// ```
@@ -309,6 +334,11 @@ impl f32 {
309
334
/// property `self == self.div_euclid(rhs) * rhs + self.rem_euclid(rhs)`
310
335
/// approximately.
311
336
///
337
+ /// # Precision
338
+ ///
339
+ /// The result of this operation is guaranteed to be the rounded
340
+ /// infinite-precision result.
341
+ ///
312
342
/// # Examples
313
343
///
314
344
/// ```
@@ -337,6 +367,10 @@ impl f32 {
337
367
/// It might have a different sequence of rounding operations than `powf`,
338
368
/// so the results are not guaranteed to agree.
339
369
///
370
+ /// # Platform-specific precision
371
+ ///
372
+ /// The precision of this function varies by platform and Rust version.
373
+ ///
340
374
/// # Examples
341
375
///
342
376
/// ```
@@ -355,6 +389,10 @@ impl f32 {
355
389
356
390
/// Raises a number to a floating point power.
357
391
///
392
+ /// # Platform-specific precision
393
+ ///
394
+ /// The precision of this function varies by platform and Rust version.
395
+ ///
358
396
/// # Examples
359
397
///
360
398
/// ```
@@ -375,6 +413,12 @@ impl f32 {
375
413
///
376
414
/// Returns NaN if `self` is a negative number other than `-0.0`.
377
415
///
416
+ /// # Precision
417
+ ///
418
+ /// The result of this operation is guaranteed to be the rounded
419
+ /// infinite-precision result. It is specified by IEEE 754 as `squareRoot`
420
+ /// and guaranteed not to change.
421
+ ///
378
422
/// # Examples
379
423
///
380
424
/// ```
@@ -398,6 +442,10 @@ impl f32 {
398
442
399
443
/// Returns `e^(self)`, (the exponential function).
400
444
///
445
+ /// # Platform-specific precision
446
+ ///
447
+ /// The precision of this function varies by platform and Rust version.
448
+ ///
401
449
/// # Examples
402
450
///
403
451
/// ```
@@ -420,6 +468,10 @@ impl f32 {
420
468
421
469
/// Returns `2^(self)`.
422
470
///
471
+ /// # Platform-specific precision
472
+ ///
473
+ /// The precision of this function varies by platform and Rust version.
474
+ ///
423
475
/// # Examples
424
476
///
425
477
/// ```
@@ -440,6 +492,10 @@ impl f32 {
440
492
441
493
/// Returns the natural logarithm of the number.
442
494
///
495
+ /// # Platform-specific precision
496
+ ///
497
+ /// The precision of this function varies by platform and Rust version.
498
+ ///
443
499
/// # Examples
444
500
///
445
501
/// ```
@@ -466,6 +522,10 @@ impl f32 {
466
522
/// `self.log2()` can produce more accurate results for base 2, and
467
523
/// `self.log10()` can produce more accurate results for base 10.
468
524
///
525
+ /// # Platform-specific precision
526
+ ///
527
+ /// The precision of this function varies by platform and Rust version.
528
+ ///
469
529
/// # Examples
470
530
///
471
531
/// ```
@@ -486,6 +546,10 @@ impl f32 {
486
546
487
547
/// Returns the base 2 logarithm of the number.
488
548
///
549
+ /// # Platform-specific precision
550
+ ///
551
+ /// The precision of this function varies by platform and Rust version.
552
+ ///
489
553
/// # Examples
490
554
///
491
555
/// ```
@@ -506,6 +570,10 @@ impl f32 {
506
570
507
571
/// Returns the base 10 logarithm of the number.
508
572
///
573
+ /// # Platform-specific precision
574
+ ///
575
+ /// The precision of this function varies by platform and Rust version.
576
+ ///
509
577
/// # Examples
510
578
///
511
579
/// ```
@@ -529,6 +597,12 @@ impl f32 {
529
597
/// * If `self <= other`: `0.0`
530
598
/// * Else: `self - other`
531
599
///
600
+ /// # Platform-specific precision
601
+ ///
602
+ /// The precision of this function varies by platform and Rust version.
603
+ /// This function currently corresponds to the `fdimf` from libc on Unix
604
+ /// and Windows. Note that this might change in the future.
605
+ ///
532
606
/// # Examples
533
607
///
534
608
/// ```
@@ -561,6 +635,12 @@ impl f32 {
561
635
562
636
/// Returns the cube root of a number.
563
637
///
638
+ /// # Platform-specific precision
639
+ ///
640
+ /// The precision of this function varies by platform and Rust version.
641
+ /// This function currently corresponds to the `cbrtf` from libc on Unix
642
+ /// and Windows. Note that this might change in the future.
643
+ ///
564
644
/// # Examples
565
645
///
566
646
/// ```
@@ -584,6 +664,12 @@ impl f32 {
584
664
/// right-angle triangle with other sides having length `x.abs()` and
585
665
/// `y.abs()`.
586
666
///
667
+ /// # Platform-specific precision
668
+ ///
669
+ /// The precision of this function varies by platform and Rust version.
670
+ /// This function currently corresponds to the `hypotf` from libc on Unix
671
+ /// and Windows. Note that this might change in the future.
672
+ ///
587
673
/// # Examples
588
674
///
589
675
/// ```
@@ -605,6 +691,10 @@ impl f32 {
605
691
606
692
/// Computes the sine of a number (in radians).
607
693
///
694
+ /// # Platform-specific precision
695
+ ///
696
+ /// The precision of this function varies by platform and Rust version.
697
+ ///
608
698
/// # Examples
609
699
///
610
700
/// ```
@@ -624,6 +714,10 @@ impl f32 {
624
714
625
715
/// Computes the cosine of a number (in radians).
626
716
///
717
+ /// # Platform-specific precision
718
+ ///
719
+ /// The precision of this function varies by platform and Rust version.
720
+ ///
627
721
/// # Examples
628
722
///
629
723
/// ```
@@ -643,6 +737,12 @@ impl f32 {
643
737
644
738
/// Computes the tangent of a number (in radians).
645
739
///
740
+ /// # Platform-specific precision
741
+ ///
742
+ /// The precision of this function varies by platform and Rust version.
743
+ /// This function currently corresponds to the `tanf` from libc on Unix and
744
+ /// Windows. Note that this might change in the future.
745
+ ///
646
746
/// # Examples
647
747
///
648
748
/// ```
@@ -663,6 +763,12 @@ impl f32 {
663
763
/// the range [-pi/2, pi/2] or NaN if the number is outside the range
664
764
/// [-1, 1].
665
765
///
766
+ /// # Platform-specific precision
767
+ ///
768
+ /// The precision of this function varies by platform and Rust version.
769
+ /// This function currently corresponds to the `asinf` from libc on Unix
770
+ /// and Windows. Note that this might change in the future.
771
+ ///
666
772
/// # Examples
667
773
///
668
774
/// ```
@@ -686,6 +792,12 @@ impl f32 {
686
792
/// the range [0, pi] or NaN if the number is outside the range
687
793
/// [-1, 1].
688
794
///
795
+ /// # Platform-specific precision
796
+ ///
797
+ /// The precision of this function varies by platform and Rust version.
798
+ /// This function currently corresponds to the `acosf` from libc on Unix
799
+ /// and Windows. Note that this might change in the future.
800
+ ///
689
801
/// # Examples
690
802
///
691
803
/// ```
@@ -708,6 +820,12 @@ impl f32 {
708
820
/// Computes the arctangent of a number. Return value is in radians in the
709
821
/// range [-pi/2, pi/2];
710
822
///
823
+ /// # Platform-specific precision
824
+ ///
825
+ /// The precision of this function varies by platform and Rust version.
826
+ /// This function currently corresponds to the `atanf` from libc on Unix
827
+ /// and Windows. Note that this might change in the future.
828
+ ///
711
829
/// # Examples
712
830
///
713
831
/// ```
@@ -734,6 +852,12 @@ impl f32 {
734
852
/// * `y >= 0`: `arctan(y/x) + pi` -> `(pi/2, pi]`
735
853
/// * `y < 0`: `arctan(y/x) - pi` -> `(-pi, -pi/2)`
736
854
///
855
+ /// # Platform-specific precision
856
+ ///
857
+ /// The precision of this function varies by platform and Rust version.
858
+ /// This function currently corresponds to the `atan2f` from libc on Unix
859
+ /// and Windows. Note that this might change in the future.
860
+ ///
737
861
/// # Examples
738
862
///
739
863
/// ```
@@ -764,6 +888,12 @@ impl f32 {
764
888
/// Simultaneously computes the sine and cosine of the number, `x`. Returns
765
889
/// `(sin(x), cos(x))`.
766
890
///
891
+ /// # Platform-specific precision
892
+ ///
893
+ /// The precision of this function varies by platform and Rust version.
894
+ /// This function currently corresponds to the `(f32::sin(x),
895
+ /// f32::cos(x))`. Note that this might change in the future.
896
+ ///
767
897
/// # Examples
768
898
///
769
899
/// ```
@@ -787,6 +917,12 @@ impl f32 {
787
917
/// Returns `e^(self) - 1` in a way that is accurate even if the
788
918
/// number is close to zero.
789
919
///
920
+ /// # Platform-specific precision
921
+ ///
922
+ /// The precision of this function varies by platform and Rust version.
923
+ /// This function currently corresponds to the `expm1f` from libc on Unix
924
+ /// and Windows. Note that this might change in the future.
925
+ ///
790
926
/// # Examples
791
927
///
792
928
/// ```
@@ -809,6 +945,12 @@ impl f32 {
809
945
/// Returns `ln(1+n)` (natural logarithm) more accurately than if
810
946
/// the operations were performed separately.
811
947
///
948
+ /// # Platform-specific precision
949
+ ///
950
+ /// The precision of this function varies by platform and Rust version.
951
+ /// This function currently corresponds to the `log1pf` from libc on Unix
952
+ /// and Windows. Note that this might change in the future.
953
+ ///
812
954
/// # Examples
813
955
///
814
956
/// ```
@@ -831,6 +973,12 @@ impl f32 {
831
973
832
974
/// Hyperbolic sine function.
833
975
///
976
+ /// # Platform-specific precision
977
+ ///
978
+ /// The precision of this function varies by platform and Rust version.
979
+ /// This function currently corresponds to the `sinhf` from libc on Unix
980
+ /// and Windows. Note that this might change in the future.
981
+ ///
834
982
/// # Examples
835
983
///
836
984
/// ```
@@ -854,6 +1002,12 @@ impl f32 {
854
1002
855
1003
/// Hyperbolic cosine function.
856
1004
///
1005
+ /// # Platform-specific precision
1006
+ ///
1007
+ /// The precision of this function varies by platform and Rust version.
1008
+ /// This function currently corresponds to the `coshf` from libc on Unix
1009
+ /// and Windows. Note that this might change in the future.
1010
+ ///
857
1011
/// # Examples
858
1012
///
859
1013
/// ```
@@ -877,6 +1031,12 @@ impl f32 {
877
1031
878
1032
/// Hyperbolic tangent function.
879
1033
///
1034
+ /// # Platform-specific precision
1035
+ ///
1036
+ /// The precision of this function varies by platform and Rust version.
1037
+ /// This function currently corresponds to the `tanhf` from libc on Unix
1038
+ /// and Windows. Note that this might change in the future.
1039
+ ///
880
1040
/// # Examples
881
1041
///
882
1042
/// ```
@@ -900,6 +1060,10 @@ impl f32 {
900
1060
901
1061
/// Inverse hyperbolic sine function.
902
1062
///
1063
+ /// # Platform-specific precision
1064
+ ///
1065
+ /// The precision of this function varies by platform and Rust version.
1066
+ ///
903
1067
/// # Examples
904
1068
///
905
1069
/// ```
@@ -923,6 +1087,10 @@ impl f32 {
923
1087
924
1088
/// Inverse hyperbolic cosine function.
925
1089
///
1090
+ /// # Platform-specific precision
1091
+ ///
1092
+ /// The precision of this function varies by platform and Rust version.
1093
+ ///
926
1094
/// # Examples
927
1095
///
928
1096
/// ```
@@ -948,6 +1116,10 @@ impl f32 {
948
1116
949
1117
/// Inverse hyperbolic tangent function.
950
1118
///
1119
+ /// # Platform-specific precision
1120
+ ///
1121
+ /// The precision of this function varies by platform and Rust version.
1122
+ ///
951
1123
/// # Examples
952
1124
///
953
1125
/// ```
@@ -969,6 +1141,12 @@ impl f32 {
969
1141
970
1142
/// Gamma function.
971
1143
///
1144
+ /// # Platform-specific precision
1145
+ ///
1146
+ /// The precision of this function varies by platform and Rust version.
1147
+ /// This function currently corresponds to the `tgammaf` from libc on Unix
1148
+ /// and Windows. Note that this might change in the future.
1149
+ ///
972
1150
/// # Examples
973
1151
///
974
1152
/// ```
@@ -991,6 +1169,12 @@ impl f32 {
991
1169
///
992
1170
/// The integer part of the tuple indicates the sign of the gamma function.
993
1171
///
1172
+ /// # Platform-specific precision
1173
+ ///
1174
+ /// The precision of this function varies by platform and Rust version.
1175
+ /// This function currently corresponds to the `lgamma_r` from libc on Unix
1176
+ /// and Windows. Note that this might change in the future.
1177
+ ///
994
1178
/// # Examples
995
1179
///
996
1180
/// ```
0 commit comments