Skip to content

Update README.md#102

Merged
thedavidmeister merged 1 commit into
mainfrom
thedavidmeister-patch-1
Aug 14, 2025
Merged

Update README.md#102
thedavidmeister merged 1 commit into
mainfrom
thedavidmeister-patch-1

Conversation

@thedavidmeister

@thedavidmeister thedavidmeister commented Aug 14, 2025

Copy link
Copy Markdown
Contributor

Motivation

Solution

Checks

By submitting this for review, I'm confirming I've done the following:

  • made this PR as small as possible
  • unit-tested any new functionality
  • linked any relevant issues or PRs
  • included screenshots (if this involves a front-end change)

Summary by CodeRabbit

  • Documentation
    • Expanded README with an overview of the rain.math.float library.
    • Explains why decimal floats are preferred over binary for finance.
    • Notes decimal floats that error on invalid operations.
    • Describes precision/representability (224-bit coefficient, 32-bit exponent) and caveats.
    • Provides an example: 0.2 + 0.7 = 0.9 (decimal exponents).
    • Adds a high-level explanation of internal decimal exponent representation.

@coderabbitai

coderabbitai Bot commented Aug 14, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

README.md updated to describe the rain.math.float library, its decimal floating-point approach, internal representation, behavior on invalid operations, precision characteristics, and rationale versus IEEE 754 binary floats.

Changes

Cohort / File(s) Summary
Documentation: rain.math.float overview
README.md
Expanded README with context, decimal float design, internal representation (coeff 224-bit, exponent 32-bit), examples (e.g., 0.2 + 0.7 = 0.9), and erroring on invalid operations.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • findolor
  • hardyjosh

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch thedavidmeister-patch-1

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@thedavidmeister thedavidmeister merged commit fc8ab61 into main Aug 14, 2025
7 of 8 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these settings in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c1a5675 and 07c82b1.

📒 Files selected for processing (1)
  • README.md (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: 0xgleb
PR: rainlanguage/rain.math.float#59
File: crates/float/src/lib.rs:233-242
Timestamp: 2025-06-17T10:17:56.205Z
Learning: In the rainlanguage/rain.math.float repository, the maintainer 0xgleb prefers to handle documentation additions and improvements in separate issues rather than inline with feature PRs.
Learnt from: 0xgleb
PR: rainlanguage/rain.math.float#64
File: src/concrete/DecimalFloat.sol:0-0
Timestamp: 2025-06-17T10:02:01.394Z
Learning: In the rain.math.float project, the Float type is designed with a specific bit layout: 224-bit signed coefficient and 32-bit signed exponent, represented as 32 bytes total. The LibDecimalFloat.unpack function returns values that are guaranteed to fit within int224 and int32 ranges due to this internal representation, making explicit range checks before casting unnecessary.
Learnt from: 0xgleb
PR: rainlanguage/rain.math.float#64
File: src/concrete/DecimalFloat.sol:0-0
Timestamp: 2025-06-17T10:02:01.394Z
Learning: In the rain.math.float project, the Float type is designed with a specific bit layout: 224-bit signed coefficient and 32-bit signed exponent, represented as 32 bytes total. The LibDecimalFloat.unpack function returns values that are guaranteed to fit within int224 and int32 ranges due to this internal representation, making explicit range checks before casting unnecessary.
📚 Learning: 2025-06-17T10:17:56.205Z
Learnt from: 0xgleb
PR: rainlanguage/rain.math.float#59
File: crates/float/src/lib.rs:233-242
Timestamp: 2025-06-17T10:17:56.205Z
Learning: In the rainlanguage/rain.math.float repository, the maintainer 0xgleb prefers to handle documentation additions and improvements in separate issues rather than inline with feature PRs.

Applied to files:

  • README.md
📚 Learning: 2025-06-16T13:17:28.513Z
Learnt from: 0xgleb
PR: rainlanguage/rain.math.float#58
File: src/concrete/DecimalFloat.sol:175-182
Timestamp: 2025-06-16T13:17:28.513Z
Learning: In the rainlanguage/rain.math.float codebase, there's an established naming convention where functions accepting a `Float` type parameter consistently use `float` as the parameter name, even though it shadows the type name. This pattern is used throughout `LibDecimalFloat.sol` and should be maintained for consistency in related contracts like `DecimalFloat.sol`.

Applied to files:

  • README.md
📚 Learning: 2025-06-17T10:02:01.394Z
Learnt from: 0xgleb
PR: rainlanguage/rain.math.float#64
File: src/concrete/DecimalFloat.sol:0-0
Timestamp: 2025-06-17T10:02:01.394Z
Learning: In the rain.math.float project, the Float type is designed with a specific bit layout: 224-bit signed coefficient and 32-bit signed exponent, represented as 32 bytes total. The LibDecimalFloat.unpack function returns values that are guaranteed to fit within int224 and int32 ranges due to this internal representation, making explicit range checks before casting unnecessary.

Applied to files:

  • README.md
📚 Learning: 2025-04-25T03:58:01.307Z
Learnt from: thedavidmeister
PR: rainlanguage/rain.math.float#30
File: test/src/lib/LibDecimalFloat.gt.t.sol:33-36
Timestamp: 2025-04-25T03:58:01.307Z
Learning: In the rain.math.float library, all values of `Float` (which is a type alias for bytes32) are considered valid and can be safely used with methods like gt(), lt(), or eq() without causing reverts.

Applied to files:

  • README.md
📚 Learning: 2025-07-24T04:32:14.171Z
Learnt from: rouzwelt
PR: rainlanguage/rain.math.float#83
File: src/concrete/DecimalFloat.sol:248-251
Timestamp: 2025-07-24T04:32:14.171Z
Learning: In the rainlanguage/rain.math.float project, functions in DecimalFloat.sol that return tuples from LibDecimalFloat calls must unpack the tuple into local variables before returning them (rather than returning directly) to maintain compatibility with Slither static analysis checks.

Applied to files:

  • README.md
🪛 LanguageTool
README.md

[grammar] ~3-~3: There might be a mistake here.
Context: # rain.math.float Decimal floating point math implemented in Solidity/Yul. ...

(QB_NEW_EN_OTHER)


[grammar] ~3-~3: Use correct spacing
Context: ... point math implemented in Solidity/Yul. ## Context IEEE 754 Floating point math su...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~5-~5: Use correct spacing
Context: ...implemented in Solidity/Yul. ## Context IEEE 754 Floating point math such as is ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[uncategorized] ~7-~7: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... in Solidity/Yul. ## Context IEEE 754 Floating point math such as is used by JavaScript is u...

(EN_COMPOUND_ADJECTIVE_INTERNAL)


[grammar] ~7-~7: There might be a mistake here.
Context: ...l. ## Context IEEE 754 Floating point math such as is used by JavaScript is usuall...

(QB_NEW_EN_OTHER)


[grammar] ~7-~7: There might be a mistake here.
Context: ... Floating point math such as is used by JavaScript is usually bad in finance for a few rea...

(QB_NEW_EN_OTHER)


[grammar] ~7-~7: Use correct spacing
Context: ...sually bad in finance for a few reasons. - The decimal representations of amounts a...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~9-~9: There might be a mistake here.
Context: ...representations in the underlying binary - Mathematical nonsense like dividing by 0...

(QB_NEW_EN_OTHER)


[grammar] ~10-~10: There might be a mistake here.
Context: ...es "special" values like Infinity and NaN which then propagate throughout busines...

(QB_NEW_EN_OTHER)


[grammar] ~10-~10: There might be a mistake here.
Context: ...hout business logic rather than erroring This lib provides decimal floats that do...

(QB_NEW_EN_OTHER)


[grammar] ~12-~12: Use correct spacing
Context: ...imal floats that do error upon nonsense. Everything you can type into a webform, ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~14-~14: Ensure spelling is correct
Context: ...nsense. Everything you can type into a webform, or Rainlang, etc. that fits into 224 b...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~14-~14: There might be a mistake here.
Context: ...u can type into a webform, or Rainlang, etc. that fits into 224 bit coefficient with...

(QB_NEW_EN_OTHER)


[grammar] ~14-~14: Use proper capitalization
Context: ...bform, or Rainlang, etc. that fits into 224 bit coefficient with 32 bit exponent (hu...

(QB_NEW_EN_OTHER_ERROR_IDS_6)


[grammar] ~14-~14: Use proper capitalization
Context: ...that fits into 224 bit coefficient with 32 bit exponent (huge values for both) will...

(QB_NEW_EN_OTHER_ERROR_IDS_6)


[grammar] ~14-~14: Use correct spacing
Context: ...s for both) will be exactly represented. This doesn't mean the floating point mat...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~16-~16: There might be a mistake here.
Context: ...esented. This doesn't mean the floating point math is perfect, for example 1/3 w...

(QB_NEW_EN_OTHER)


[grammar] ~16-~16: There might be a mistake here.
Context: ...doesn't mean the floating point math is perfect, for example 1/3 will still be some impr...

(QB_NEW_EN_OTHER)


[grammar] ~16-~16: There might be a mistake here.
Context: ...the floating point math is perfect, for example 1/3 will still be some imprecise rounde...

(QB_NEW_EN_OTHER)


[grammar] ~16-~16: There might be a mistake here.
Context: ...ill be some imprecise rounded 0.3333... value as we don't have infinite precision. I...

(QB_NEW_EN_OTHER)


[grammar] ~16-~16: Use correct spacing
Context: ...lue as we don't have infinite precision. It does mean that 0.2+0.7 is 0.9 rat...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~18-~18: Use correct spacing
Context: ... exponents rather than binary exponents. e.g. 0.2 internally is something like ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~20-~20: There might be a mistake here.
Context: ...onents rather than binary exponents. e.g. 0.2 internally is something like `2e-...

(QB_NEW_EN_OTHER)


[grammar] ~20-~20: There might be a mistake here.
Context: ...e.g. 0.2 internally is something like 2e-1 and 0.7 is 7e-1 so internally the r...

(QB_NEW_EN_OTHER)


[grammar] ~20-~20: There might be a mistake here.
Context: ...y is something like 2e-1 and 0.7 is 7e-1 so internally the result is 2+7 which...

(QB_NEW_EN_OTHER)


[grammar] ~20-~20: There might be a mistake here.
Context: ...is7e-1so internally the result is2+7which is9with an exponent of-1`. ...

(QB_NEW_EN_OTHER)


[grammar] ~20-~20: There might be a mistake here.
Context: ...which is9with an exponent of-1`.

(QB_NEW_EN)

🔇 Additional comments (1)
README.md (1)

14-14: Scope the “exactly representable” claim and anchor it to the bit layout

“Everything you can type into a webform…” is vague and overbroad. Prefer a precise statement tied to the 224‑bit coefficient and 32‑bit exponent constraints; also specify “decimal exponent” explicitly.

Do these clarifications align with current implementation?

  • Exactness applies to finite decimal literals whose coefficient fits in int224 when the decimal point is removed, within the int32 decimal exponent range.
  • Operations revert on invalid inputs (e.g., division by zero), rather than yielding NaN/Infinity.

Comment thread README.md
Comment on lines +3 to +20
Decimal floating point math implemented in Solidity/Yul.

## Context

IEEE 754 Floating point math such as is used by JavaScript is usually bad in finance for a few reasons.

- The decimal representations of amounts and prices of things don't have exact representations in the underlying binary
- Mathematical nonsense like dividing by 0 gives "special" values like `Infinity` and `NaN` which then propagate throughout business logic rather than erroring

This lib provides decimal floats that do error upon nonsense.

Everything you can type into a webform, or Rainlang, etc. that fits into 224 bit coefficient with 32 bit exponent (huge values for both) will be exactly represented.

This doesn't mean the floating point math is perfect, for example 1/3 will still be some imprecise rounded 0.3333... value as we don't have infinite precision.

It does mean that `0.2+0.7` is `0.9` rather than `0.8999999999999999` because the fractional values use decimal exponents rather than binary exponents.

e.g. `0.2` internally is something like `2e-1` and `0.7` is `7e-1` so internally the result is `2+7` which is `9` with an exponent of `-1`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Tighten wording, fix hyphenation/grammar, and clarify behavior; propose an editorial pass

Suggested rewrite improves clarity, tone, and technical precision (hyphenation, spacing, and neutral language), and aligns with the library’s decimal exponent and bit‑layout design.

-Decimal floating point math implemented in Solidity/Yul.
+Decimal floating‑point math implemented in Solidity/Yul.

 ## Context

-IEEE 754 Floating point math such as is used by JavaScript is usually bad in finance for a few reasons.
+IEEE 754 binary floating‑point (as used by JavaScript) is a poor fit for many financial use cases:

-- The decimal representations of amounts and prices of things don't have exact representations in the underlying binary
-- Mathematical nonsense like dividing by 0 gives "special" values like `Infinity` and `NaN` which then propagate throughout business logic rather than erroring
+- Many decimal fractions cannot be represented exactly in binary floating‑point formats.
+- Operations such as division by zero produce special values (`Infinity`, `NaN`) that can propagate through computations instead of reverting.

-This lib provides decimal floats that do error upon nonsense.
+This library provides decimal floats that revert on invalid operations rather than producing `NaN`/`Infinity`.

-Everything you can type into a webform, or Rainlang, etc. that fits into 224 bit coefficient with 32 bit exponent (huge values for both) will be exactly represented.
+Any finite decimal literal whose coefficient fits within 224 bits with a 32‑bit decimal exponent range is exactly representable in this format. Internally, the `Float` type packs a 224‑bit signed coefficient and a 32‑bit signed exponent into 32 bytes.

-This doesn't mean the floating point math is perfect, for example 1/3 will still be some imprecise rounded 0.3333... value as we don't have infinite precision.
+Not all values have exact decimal expansions; for example, 1/3 will be rounded (0.3333…), as precision is finite.

-It does mean that `0.2+0.7` is `0.9` rather than `0.8999999999999999` because the fractional values use decimal exponents rather than binary exponents.
+It does mean that `0.2 + 0.7` evaluates to `0.9`, because fractional values use base‑10 exponents rather than base‑2 exponents.

-e.g. `0.2` internally is something like `2e-1` and `0.7` is `7e-1` so internally the result is `2+7` which is `9` with an exponent of `-1`.
+For example, `0.2` is represented approximately as `2e-1` and `0.7` as `7e-1`; adding them yields `9e-1` (i.e., `0.9`).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Decimal floating point math implemented in Solidity/Yul.
## Context
IEEE 754 Floating point math such as is used by JavaScript is usually bad in finance for a few reasons.
- The decimal representations of amounts and prices of things don't have exact representations in the underlying binary
- Mathematical nonsense like dividing by 0 gives "special" values like `Infinity` and `NaN` which then propagate throughout business logic rather than erroring
This lib provides decimal floats that do error upon nonsense.
Everything you can type into a webform, or Rainlang, etc. that fits into 224 bit coefficient with 32 bit exponent (huge values for both) will be exactly represented.
This doesn't mean the floating point math is perfect, for example 1/3 will still be some imprecise rounded 0.3333... value as we don't have infinite precision.
It does mean that `0.2+0.7` is `0.9` rather than `0.8999999999999999` because the fractional values use decimal exponents rather than binary exponents.
e.g. `0.2` internally is something like `2e-1` and `0.7` is `7e-1` so internally the result is `2+7` which is `9` with an exponent of `-1`.
Decimal floating-point math implemented in Solidity/Yul.
## Context
IEEE 754 binary floating-point (as used by JavaScript) is a poor fit for many financial use cases:
- Many decimal fractions cannot be represented exactly in binary floating-point formats.
- Operations such as division by zero produce special values (`Infinity`, `NaN`) that can propagate through computations instead of reverting.
This library provides decimal floats that revert on invalid operations rather than producing `NaN`/`Infinity`.
Any finite decimal literal whose coefficient fits within 224 bits with a 32-bit decimal exponent range is exactly representable in this format. Internally, the `Float` type packs a 224-bit signed coefficient and a 32-bit signed exponent into 32 bytes.
Not all values have exact decimal expansions; for example, 1/3 will be rounded (0.3333…), as precision is finite.
It does mean that `0.2 + 0.7` evaluates to `0.9`, because fractional values use base-10 exponents rather than base-2 exponents.
For example, `0.2` is represented approximately as `2e-1` and `0.7` as `7e-1`; adding them yields `9e-1` (i.e., `0.9`).
🧰 Tools
🪛 LanguageTool

[grammar] ~3-~3: There might be a mistake here.
Context: # rain.math.float Decimal floating point math implemented in Solidity/Yul. ...

(QB_NEW_EN_OTHER)


[grammar] ~3-~3: Use correct spacing
Context: ... point math implemented in Solidity/Yul. ## Context IEEE 754 Floating point math su...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~5-~5: Use correct spacing
Context: ...implemented in Solidity/Yul. ## Context IEEE 754 Floating point math such as is ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[uncategorized] ~7-~7: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... in Solidity/Yul. ## Context IEEE 754 Floating point math such as is used by JavaScript is u...

(EN_COMPOUND_ADJECTIVE_INTERNAL)


[grammar] ~7-~7: There might be a mistake here.
Context: ...l. ## Context IEEE 754 Floating point math such as is used by JavaScript is usuall...

(QB_NEW_EN_OTHER)


[grammar] ~7-~7: There might be a mistake here.
Context: ... Floating point math such as is used by JavaScript is usually bad in finance for a few rea...

(QB_NEW_EN_OTHER)


[grammar] ~7-~7: Use correct spacing
Context: ...sually bad in finance for a few reasons. - The decimal representations of amounts a...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~9-~9: There might be a mistake here.
Context: ...representations in the underlying binary - Mathematical nonsense like dividing by 0...

(QB_NEW_EN_OTHER)


[grammar] ~10-~10: There might be a mistake here.
Context: ...es "special" values like Infinity and NaN which then propagate throughout busines...

(QB_NEW_EN_OTHER)


[grammar] ~10-~10: There might be a mistake here.
Context: ...hout business logic rather than erroring This lib provides decimal floats that do...

(QB_NEW_EN_OTHER)


[grammar] ~12-~12: Use correct spacing
Context: ...imal floats that do error upon nonsense. Everything you can type into a webform, ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~14-~14: Ensure spelling is correct
Context: ...nsense. Everything you can type into a webform, or Rainlang, etc. that fits into 224 b...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~14-~14: There might be a mistake here.
Context: ...u can type into a webform, or Rainlang, etc. that fits into 224 bit coefficient with...

(QB_NEW_EN_OTHER)


[grammar] ~14-~14: Use proper capitalization
Context: ...bform, or Rainlang, etc. that fits into 224 bit coefficient with 32 bit exponent (hu...

(QB_NEW_EN_OTHER_ERROR_IDS_6)


[grammar] ~14-~14: Use proper capitalization
Context: ...that fits into 224 bit coefficient with 32 bit exponent (huge values for both) will...

(QB_NEW_EN_OTHER_ERROR_IDS_6)


[grammar] ~14-~14: Use correct spacing
Context: ...s for both) will be exactly represented. This doesn't mean the floating point mat...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~16-~16: There might be a mistake here.
Context: ...esented. This doesn't mean the floating point math is perfect, for example 1/3 w...

(QB_NEW_EN_OTHER)


[grammar] ~16-~16: There might be a mistake here.
Context: ...doesn't mean the floating point math is perfect, for example 1/3 will still be some impr...

(QB_NEW_EN_OTHER)


[grammar] ~16-~16: There might be a mistake here.
Context: ...the floating point math is perfect, for example 1/3 will still be some imprecise rounde...

(QB_NEW_EN_OTHER)


[grammar] ~16-~16: There might be a mistake here.
Context: ...ill be some imprecise rounded 0.3333... value as we don't have infinite precision. I...

(QB_NEW_EN_OTHER)


[grammar] ~16-~16: Use correct spacing
Context: ...lue as we don't have infinite precision. It does mean that 0.2+0.7 is 0.9 rat...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~18-~18: Use correct spacing
Context: ... exponents rather than binary exponents. e.g. 0.2 internally is something like ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~20-~20: There might be a mistake here.
Context: ...onents rather than binary exponents. e.g. 0.2 internally is something like `2e-...

(QB_NEW_EN_OTHER)


[grammar] ~20-~20: There might be a mistake here.
Context: ...e.g. 0.2 internally is something like 2e-1 and 0.7 is 7e-1 so internally the r...

(QB_NEW_EN_OTHER)


[grammar] ~20-~20: There might be a mistake here.
Context: ...y is something like 2e-1 and 0.7 is 7e-1 so internally the result is 2+7 which...

(QB_NEW_EN_OTHER)


[grammar] ~20-~20: There might be a mistake here.
Context: ...is7e-1so internally the result is2+7which is9with an exponent of-1`. ...

(QB_NEW_EN_OTHER)


[grammar] ~20-~20: There might be a mistake here.
Context: ...which is9with an exponent of-1`.

(QB_NEW_EN)

🤖 Prompt for AI Agents
In README.md around lines 3 to 20, the copy uses informal phrasing, inconsistent
hyphenation, and ambiguous technical wording (e.g., "Decimal floating point
math", "does error upon nonsense"); perform an editorial pass to (1) use
consistent terminology like "decimal floating-point arithmetic", (2) replace
colloquialisms with precise phrases such as "raises an error on invalid
operations" instead of "does error upon nonsense", (3) normalize hyphenation
(e.g., "floating-point", "bit-layout"), capitalization and punctuation, (4)
clarify the representation guarantee as "exact representation for values whose
decimal coefficient fits in 224 bits with a 32-bit exponent" and keep the 1/3
explanation concise about rounding, and (5) tidy examples and code fragments
(e.g., `0.2 + 0.7` → `0.9`) for consistency and readability.

Comment thread README.md

Decimal floating point math implemented in Solidity/Yul.

## Context

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Consider adding follow-ups: API links and behavior specifics

Given maintainer preference to iterate docs via issues, propose opening issues to add:

  • Link(s) to LibDecimalFloat/DecimalFloat and the bit‑layout section
  • Rounding policy and overflow/underflow semantics
  • A short usage snippet (constructing/parsing, add/mul, comparisons)
  • Notes that all bytes32 Float values are valid for gt/lt/eq without revert

I can draft these issues with checklists if you want.

🧰 Tools
🪛 LanguageTool

[grammar] ~5-~5: Use correct spacing
Context: ...implemented in Solidity/Yul. ## Context IEEE 754 Floating point math such as is ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

🤖 Prompt for AI Agents
In README.md around line 5, add follow-up issue entries (since maintainers
prefer iterating via issues) linking to the LibDecimalFloat/DecimalFloat docs
and the bit-layout section, and create separate issues to document rounding
policy and overflow/underflow semantics, add a short usage snippet
(construct/parse, add/mul, comparisons), and note that all bytes32 Float values
are valid for gt/lt/eq without revert; include checklists in each issue so they
can be tracked and assign or tag me if you want me to draft the issue bodies.

Comment thread README.md
Comment on lines +18 to +20
It does mean that `0.2+0.7` is `0.9` rather than `0.8999999999999999` because the fractional values use decimal exponents rather than binary exponents.

e.g. `0.2` internally is something like `2e-1` and `0.7` is `7e-1` so internally the result is `2+7` which is `9` with an exponent of `-1`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Great illustrative example—keep it, just minor spacing/notation polish

The 0.2 + 0.7 example is valuable and correctly motivates decimal exponents; the suggested edit above only adds spacing and a clearer “For example” sentence.

🧰 Tools
🪛 LanguageTool

[grammar] ~18-~18: Use correct spacing
Context: ... exponents rather than binary exponents. e.g. 0.2 internally is something like ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~20-~20: There might be a mistake here.
Context: ...onents rather than binary exponents. e.g. 0.2 internally is something like `2e-...

(QB_NEW_EN_OTHER)


[grammar] ~20-~20: There might be a mistake here.
Context: ...e.g. 0.2 internally is something like 2e-1 and 0.7 is 7e-1 so internally the r...

(QB_NEW_EN_OTHER)


[grammar] ~20-~20: There might be a mistake here.
Context: ...y is something like 2e-1 and 0.7 is 7e-1 so internally the result is 2+7 which...

(QB_NEW_EN_OTHER)


[grammar] ~20-~20: There might be a mistake here.
Context: ...is7e-1so internally the result is2+7which is9with an exponent of-1`. ...

(QB_NEW_EN_OTHER)


[grammar] ~20-~20: There might be a mistake here.
Context: ...which is9with an exponent of-1`.

(QB_NEW_EN)

🤖 Prompt for AI Agents
In README.md around lines 18 to 20, polish the example sentence by replacing
"e.g." with "For example," and adjust spacing/notation for clarity: ensure
spaces around operators and commas, use consistent inline code formatting for
numeric literals and expressions (e.g., `0.2`, `0.7`, `0.9`, `2e-1`, `7e-1`),
and rephrase the second sentence to read clearly as "For example, `0.2`
internally is `2e-1` and `0.7` is `7e-1`, so the result is `2+7` with an
exponent of `-1`, yielding `0.9`."

@coderabbitai coderabbitai Bot mentioned this pull request Oct 1, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant