PipGauge · check the arithmetic

Calculation verification center

Run 25 independent examples against the same five calculation engines used by PipGauge. Inspect the inputs, derivation and tolerance.

Offline calculations · no financial-input uploads · no input values in URLs · no trade execution

Download fixed examples

25 examples ready; none run yet.

V01 · pip_value

EURUSD USD / 美元点值

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairEURUSD
accountCcyUSD
lots1

Fixed expected result

{"pip_value_account": 10}

.0001 USD/EUR × 100000 EUR = 10 USD/pip.

Units: USD/pip

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V02 · pip_value

USDJPY JPY / 日元点值

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairUSDJPY
accountCcyJPY
lots1

Fixed expected result

{"pip_value_account": 1000}

.01 JPY/USD × 100000 USD = 1000 JPY/pip.

Units: JPY/pip

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V03 · pip_value

USDJPY USD / 日元对换汇

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairUSDJPY
accountCcyUSD
price150
lots1

Fixed expected result

{"pip_value_account": 6.666666666666667}

1000 JPY ÷ 150 JPY/USD = 6.6666666667 USD/pip.

Units: USD/pip

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V04 · pip_value

EURUSD GBP / 第三币换算

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairEURUSD
accountCcyGBP
quoteToAccountRate0.8
lots1

Fixed expected result

{"pip_value_account": 8}

10 USD/pip × .8 GBP/USD = 8 GBP/pip.

Units: GBP/pip

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V05 · pip_value

Negative volume / 负手数

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairEURUSD
accountCcyUSD
lots-1

Fixed expected result

Expected rejection: lots must be > 0

Volume −1 is outside lots > 0. / 手数必须大于零。

Units: error

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V06 · position_size

Standard sizing / 标准仓位

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

accountBalance10000
riskPercent1
stopLossPips20
pipValuePerLot10

Fixed expected result

{"risk_amount": 100, "lots_standard_rounded": 0.5}

10000×.01=100; 100/(20×10)=.5 lots.

Units: account currency; lots

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V07 · position_size

Step .3 / 取整预算

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

accountBalance10000
riskPercent2
stopLossPips25
pipValuePerLot10
step0.3

Fixed expected result

{"risk_amount": 200, "lots_standard_rounded": 0.6, "units_rounded": 60000}

Budget200; raw lots200/250=.8; floor to .3=.6; units60000; planned risk .6×250=150 (budget remains200).

Units: account currency; lots; base units

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V08 · position_size

Tiny step / 小步进

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

accountBalance1
riskPercent1
stopLossPips100
pipValuePerLot10
step1e-06

Fixed expected result

{"risk_amount": 0.01, "lots_standard_rounded": 1e-05, "units_rounded": 1}

.01/(100×10)=.00001 lots, exactly ten .000001 steps, one base unit.

Units: account currency; lots; base units

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V09 · position_size

Zero stop / 零止损

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

accountBalance10000
riskPercent1
stopLossPips0
pipValuePerLot10

Fixed expected result

Expected rejection: stopLossPips must be > 0

Zero stop distance would divide by zero; must reject. / 止损距离为零必须拒绝。

Units: error

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V10 · position_size

Risk over 100% / 风险比例越界

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

accountBalance10000
riskPercent101
stopLossPips20
pipValuePerLot10

Fixed expected result

Expected rejection: riskPercent must be at most 100

101% exceeds the supported risk-percent range. / 超出支持范围。

Units: error

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V11 · margin

EURUSD USD / 美元保证金

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairEURUSD
accountCcyUSD
lots1
price1.2
leverage100

Fixed expected result

{"required_margin_account": 1200}

100000 EUR×1.2 USD/EUR /100 =1200 USD.

Units: USD

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V12 · margin

EURUSD EUR / 基础币保证金

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairEURUSD
accountCcyEUR
lots1
price1.2
leverage100

Fixed expected result

{"required_margin_account": 1000}

100000 EUR/100=1000 EUR; do not divide by price twice.

Units: EUR

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V13 · margin

USDJPY half lot / 半手日元对

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairUSDJPY
accountCcyUSD
lots0.5
price150
leverage50

Fixed expected result

{"required_margin_account": 1000}

100000 USD×.5/50=1000 USD.

Units: USD

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V14 · margin

Cross currency / 第三币保证金

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairEURUSD
accountCcyCHF
quoteToAccountRate0.8
lots1
price1.2
leverage100

Fixed expected result

{"required_margin_account": 960}

120000 USD /100 × .8 CHF/USD=960 CHF.

Units: CHF

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V15 · margin

Missing margin rule / 缺保证金规则

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairEURUSD
accountCcyUSD
lots1
price1.2

Fixed expected result

Expected rejection: provide either leverage or marginPercent

Neither leverage nor margin percentage is supplied; no justified margin result. / 缺规则不能确认。

Units: error

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V16 · pnl

Long gain / 多仓盈利

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairEURUSD
accountCcyUSD
directionlong
lots1
openPrice1.2
closePrice1.201

Fixed expected result

{"pnl_account": 100}

(1.201−1.2)×100000=100 USD.

Units: USD

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V17 · pnl

Short loss / 空仓亏损

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairEURUSD
accountCcyUSD
directionshort
lots1
openPrice1.2
closePrice1.201

Fixed expected result

{"pnl_account": -100}

(1.2−1.201)×100000=−100 USD.

Units: USD

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V18 · pnl

USDJPY short / 日元对空仓换算

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairUSDJPY
accountCcyUSD
directionshort
lots0.5
openPrice150
closePrice149

Fixed expected result

{"pnl_account": 335.5704697986577}

(150−149)×50000=50000 JPY; at close149, 50000/149 USD.

Units: USD

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V19 · pnl

EUR account / 欧元账户盈亏

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairEURUSD
accountCcyEUR
directionlong
lots1
openPrice1.2
closePrice1.212

Fixed expected result

{"pnl_account": 990.0990099009902}

.012×100000=1200 USD; 1200/1.212 EUR at close.

Units: EUR

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V20 · pnl

Zero exit price / 零平仓价

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairEURUSD
accountCcyUSD
directionlong
lots1
openPrice1.2
closePrice0

Fixed expected result

Expected rejection: closePrice must be > 0

Exit must be positive; zero is unsupported. / 平仓价须为正。

Units: error

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V21 · spread_cost

Spread plus commission / 点差加双边佣金

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairEURUSD
accountCcyUSD
lots0.1
spreadPips2
commissionPerSide3.5

Fixed expected result

{"spread_cost_account": 2, "commission_cost_account": 0.7, "total_cost_account": 2.7}

2pips×10USD/pip/lot×.1lot=2; commission3.5×2×.1=.7; total2.7.

Units: USD

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V22 · spread_cost

Zero costs / 零成本情景

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairEURUSD
accountCcyUSD
lots1
spreadPips0
commissionPerSide0

Fixed expected result

{"total_cost_account": 0}

0 spread +0 commission=0. This is a scenario, not a broker fee claim. / 示例并非券商报价。

Units: USD

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V23 · spread_cost

GBP fee units / 英镑费用口径

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairEURUSD
accountCcyGBP
quoteToAccountRate0.8
lots1
spreadPips2
commissionPerSide2

Fixed expected result

{"total_cost_account": 20}

2pips×10USD×.8=16GBP; commission2GBP×2=4GBP; total20GBP.

Units: GBP

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V24 · spread_cost

Bid ask precision / 买卖价精度

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairEURUSD
accountCcyUSD
lots1
bidPrice1.2
askPrice1.2003

Fixed expected result

{"spread_pips": 3, "total_cost_account": 30}

(1.2003−1.2)/.0001=3pips; 3×10USD=30USD. No extra ×10.

Units: pips; USD

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0
V25 · spread_cost

Crossed quotes / 卖价低于买价

Not run in this browser yet.

Inputs, expected value and derivation

Inputs

pairEURUSD
accountCcyUSD
lots1
bidPrice1.2
askPrice1.1999

Fixed expected result

Expected rejection: must be >= 0

Ask−bid<0; reject crossed spread. / 负点差拒绝。

Units: error

Linear contract; fixed stated FX conversion; no unentered costs. / 线性合约;使用给定换算率;不含未填写费用。

absolute 1e-7 + relative 1e-10; formula r4-2026-10-09; case 1.0.0

Revision record and corrections

2026-10-09 · v1.0.0 · Initial 25 independently derived cases. Maintained by PipGauge; no named expert certification is claimed.

Found a discrepancy? Include the case ID, observed result and the convention you expected. Avoid sending account information. Report a calculation issue

How to reproduce the checks

Expected values are fixed from the written arithmetic and exact rational calculations before they are compared with the existing JavaScript engines. The engine under test does not generate its own expected answer. Expand a case to inspect inputs, units, derivation and tolerance; a result appears only after you run it.

A numeric result passes when absolute difference is no greater than 1e−7 plus 1e−10 times the absolute expected value. Invalid-input cases must match the stated error category; any arbitrary exception is not a pass. Every site build runs these 25 public cases, 28 preflight benchmarks, 67 decimal boundary cases and 22 volume-grid/exact-lot cases, and stops on a mismatch.

There are five cases each for pip value, position sizing, margin, P&L and spread cost, covering ordinary arithmetic, currency conversion, rounding and invalid inputs. These are reproducible examples, not proof for every market or broker convention, expert certification or a claim of strategy advantage.

Formula references

Definitions and educational concepts, checked 2026-10-09. These do not verify a broker contract.

Formula version 1.0.0 · Revised 2026-10-09 · Educational scenario tools.