diff --git a/hugr-core/src/std_extensions/arithmetic/float_types.rs b/hugr-core/src/std_extensions/arithmetic/float_types.rs index 3275548dd..c5ffa5d6c 100644 --- a/hugr-core/src/std_extensions/arithmetic/float_types.rs +++ b/hugr-core/src/std_extensions/arithmetic/float_types.rs @@ -38,6 +38,18 @@ pub fn float64_type() -> Type { #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] /// A floating-point value. +/// +/// This constant type does **not** implement equality. Any two instances of +/// `ConstF64` are considered different. +// +// The main problem for equality checking is comparisons of serialized values +// with different precision in `CustomSerialized`. +// For example, `3.3508025818765467e243 /= 3.350802581876547e243` for serde, +// but they would be equal after loaded as a `ConstF64` type. +// +// `serde_json` provides some options to overcome this issue, but since +// custom values are encoded inside `serde_json::Value`s they are not directly +// reachable by these solutions. pub struct ConstF64 { /// The value. value: f64,